diff --git a/data2vecageneralframeworkforselfsupervisedlearninginspeechvisionandlanguage/83893051-930a-4186-b83a-dad5454bf41d_content_list.json b/data2vecageneralframeworkforselfsupervisedlearninginspeechvisionandlanguage/83893051-930a-4186-b83a-dad5454bf41d_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..3b40aa52d3613ec55472b2dc0d9a695b57d43f1b --- /dev/null +++ b/data2vecageneralframeworkforselfsupervisedlearninginspeechvisionandlanguage/83893051-930a-4186-b83a-dad5454bf41d_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:800c8884d581d4e0774e76b2a1e29b85ab21e9354b39f6e722c5f661b1945655 +size 97350 diff --git a/data2vecageneralframeworkforselfsupervisedlearninginspeechvisionandlanguage/83893051-930a-4186-b83a-dad5454bf41d_model.json b/data2vecageneralframeworkforselfsupervisedlearninginspeechvisionandlanguage/83893051-930a-4186-b83a-dad5454bf41d_model.json new file mode 100644 index 0000000000000000000000000000000000000000..4bdb14c03eaa460b8d3056473ab7cc5adf92cf91 --- /dev/null +++ b/data2vecageneralframeworkforselfsupervisedlearninginspeechvisionandlanguage/83893051-930a-4186-b83a-dad5454bf41d_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9dd13a6a31f1844027b85a4dc4df81b828300cf5012b33ff80aeeec201cf320a +size 126346 diff --git a/data2vecageneralframeworkforselfsupervisedlearninginspeechvisionandlanguage/83893051-930a-4186-b83a-dad5454bf41d_origin.pdf b/data2vecageneralframeworkforselfsupervisedlearninginspeechvisionandlanguage/83893051-930a-4186-b83a-dad5454bf41d_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..c1721fa6cfaf2bb229cf42dacff49f72e867a277 --- /dev/null +++ b/data2vecageneralframeworkforselfsupervisedlearninginspeechvisionandlanguage/83893051-930a-4186-b83a-dad5454bf41d_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea233949982e6bb0bb60c1ea96588a9c3e8653efa461f7573419508dfc800515 +size 886091 diff --git a/data2vecageneralframeworkforselfsupervisedlearninginspeechvisionandlanguage/full.md b/data2vecageneralframeworkforselfsupervisedlearninginspeechvisionandlanguage/full.md new file mode 100644 index 0000000000000000000000000000000000000000..5883c35533f4148d243506728e298db8033ab1d4 --- /dev/null +++ b/data2vecageneralframeworkforselfsupervisedlearninginspeechvisionandlanguage/full.md @@ -0,0 +1,373 @@ +# data2vec: A General Framework for Self-supervised Learning in Speech, Vision and Language + +Alexei Baevski1 Wei-Ning Hsu1 Qiantong Xu2 Arun Babu1 Jiatao Gu1 Michael Auli1 + +# Abstract + +While the general idea of self-supervised learning is identical across modalities, the actual algorithms and objectives differ widely because they were developed with a single modality in mind. To get us closer to general self-supervised learning, we present data2vec, a framework that uses the same learning method for either speech, NLP or computer vision. The core idea is to predict latent representations of the full input data based on a masked view of the input in a self-distillation setup using a standard Transformer architecture. Instead of predicting modality-specific targets such as words, visual tokens or units of human speech which are local in nature, data2vec predicts contextualized latent representations that contain information from the entire input. Experiments on the major benchmarks of speech recognition, image classification, and natural language understanding demonstrate a new state of the art or competitive performance to predominant approaches. Models and code are available at www.github.com/pytorch/fairseq/tree/master/examples/data2vec. + +# 1. Introduction + +Self-supervised learning builds representations of data without human annotated labels which led to significant advances in natural language processing (NLP; Peters et al. 2018; Radford et al. 2018; Devlin et al. 2019; Brown et al. 2020), speech processing (van den Oord et al., 2018; Schneider et al., 2019; Baevski et al., 2020b) as well as computer vision (Chen et al., 2020; 2021b; Caron et al., 2021; Bao et al., 2021; He et al., 2021). Self-supervised representations have even enabled completely unsupervised learning + +$^{1}$ Meta AI $^{2}$ SambaNova, work done while at Meta AI. Correspondence to: Alexei Baevski , Michael Auli . + +Proceedings of the $39^{th}$ International Conference on Machine Learning, Baltimore, Maryland, USA, PMLR 162, 2022. Copyright 2022 by the author(s). + +in tasks such as machine translation (Lample et al., 2018) and speech recognition (Baevski et al., 2021). + +Research in self-supervised algorithms has focused on individual modalities which results in specific designs and learning biases. For example, in speech processing, there is no vocabulary of speech units over which we can define a self-supervised learning task such as words in $\mathrm{NLP}^1$ and therefore several prominent models are equipped with mechanisms to learn an inventory of speech units (Baevski et al., 2020b; Hsu et al., 2021). A similar problem exists for computer vision, where researchers either learn discrete visual tokens (Radford et al., 2021a; Bao et al., 2021), regress the input (He et al., 2021) or learn representations invariant to data augmentation (Chen et al., 2020; Grill et al., 2020; Caron et al., 2021). + +While learning biases are certainly helpful, it is often unclear whether they will generalize to other modalities. Moreover, leading theories on the biology of learning (Friston & Kiebel, 2009; Friston, 2010) imply that humans likely use similar learning processes to understand the visual world as they do for language. Relatedly, general neural network architectures have been shown to perform very well compared to modality-specific counterparts (Jaegle et al., 2021b). + +In an effort to get closer to machines that learn in general ways about the environment, we designed data2vec, a framework for general self-supervised learning that works for images, speech and text where the learning objective is identical in each modality. The present work unifies the learning algorithm but still learns representations individually for each modality. We hope that a single algorithm will make future multi-modal learning simpler, more effective and lead to models that understand the world better through multiple modalities. + +Our method combines masked prediction (Devlin et al., 2019; Baevski et al., 2020b; Bao et al., 2021) with the learning of latent target representations (Grill et al., 2020; Caron et al., 2021) but generalizes the latter by using multiple network layers as targets and shows that this approach works across several modalities. Specifically, we train an off-the + +![](images/99c60efe9a98cd4dce5d6e274ce6d1f57d929f4d927ee4f96b81ab70faa8e162.jpg) +Figure 1. Illustration of how data2vec follows the same learning process for different modalities. The model first produces representations of the original input example (teacher mode) which are then regressed by the same model based on a masked version of the input. The teacher parameters are an exponentially moving average of the student weights. The student predicts the average of $K$ network layers of the teacher (shaded in blue). + +shelf Transformer network (Vaswani et al., 2017) which we use either in teacher or student mode (Illustration in Figure 1): we first build representations of the full input data whose purpose is to serve as targets in the learning task (teacher mode). Next, we encode a masked version of the input sample with which we predict the full data representations (student mode). The weights of the teacher are an exponentially decaying average of the student (He et al., 2019; Grill et al., 2020; Caron et al., 2021). Since different modalities have vastly different inputs, e.g., pixels vs. words, we use modality-specific feature encoders and masking strategies from the literature. + +Since our method works with the latent network representations of the learner itself, it can be seen as a simplification of many modality-specific designs such as learning a fixed set of visual tokens (Radford et al., 2021a; van den Oord et al., 2017), or normalization of the input to create suitable targets (He et al., 2021), or the learning of a vocabulary of discrete speech units (Baevski et al., 2020b; Hsu et al., 2021). Moreover, our target representations are continuous and contextualized, through the use of self-attention, which makes them richer than a fixed set of targets and/or targets based on local context such as used in most prior work. + +Experimental results show data2vec to be effective in all three modalities, setting a new state of the art for ViT-B with single models and ViT-L on ImageNet-1K, improving over the best prior work in speech processing on speech recognition (Baevski et al., 2020b; Hsu et al., 2021) and outperforming a like for like RoBERTa baseline on the GLUE natural language understanding benchmark (Liu et al., 2019). + +# 2. Related Work + +Self-supervised Learning in Computer Vision. Unsupervised pre-training for computer vision has been a very active area of research with methods contrasting representa + +tions of augmentations of the same image, entirely different images (Chen et al., 2020; Grill et al., 2020; Caron et al., 2021; Chen et al., 2021b) as well as online clustering (Caron et al., 2020). Similar to our work, both BYOL (Grill et al., 2020) and DINO (Caron et al., 2021) regress neural network representations of a momentum encoder, but our work differs in that it uses a masked prediction task and we regress multiple neural network layer representations instead of just the top layer which we find to be more effective. Moreover, data2vec works for multiple modalities. + +The most recent work focuses on training vision Transformers (Dosovitskiy et al., 2020) with masked prediction objectives (Bao et al., 2021; He et al., 2021; Xie et al., 2021) whose performance surpasses supervised-only training on ImageNet-1K. Several of these methods predict visual tokens (Bao et al., 2021; He et al., 2021; Dong et al., 2022) learned in a separate step before pre-training (van den Oord et al., 2017; Ramesh et al., 2021), during pretraining (Zhou et al., 2021), and others directly predict the input pixels (He et al., 2021; Xie et al., 2021). + +Instead, data2vec predicts the latent representations of the input data. Another difference to this body of work is that the latent target representations are contextualized, incorporating relevant features from the entire image instead of targets which contain information isolated to the current patch, such as visual tokens or pixels. + +Self-supervised Learning in NLP. Pre-training has been very successful in advancing natural language understanding (McCann et al., 2017; Peters et al., 2018; Radford et al., 2018; Baevski et al., 2019; Devlin et al., 2019; Yang et al., 2019; Brown et al., 2020). The most prominent model is BERT (Devlin et al., 2019) which solves a masked prediction task where some of the input tokens are blanked out in order to be predicted given the remaining input. For many languages it is easy to determine word boundaries and most + +methods therefore predict word or sub-word units for pretraining. There is also work on knowledge distillation to obtain smaller BERT-style models, both for pre-training and fine-tuning (Jiao et al., 2020). + +Compared to prior NLP algorithms, data2vec does not predict discrete linguistic tokens such as words, sub-words or bytes but rather a continuous and contextualized representation. This has two advantages: first, the targets themselves are not predefined, nor is their number limited. This enables the model to adapt to a particular input example. Second, targets are contextualized, taking context information into account. This is unlike BERT-style models which learn a single embedding for each target which needs to fit all instances of a particular target in the data. + +Self-supervised Learning in Speech. Work in self-supervised learning for speech includes autoregressive models (van den Oord et al., 2018; Schneider et al., 2019; Baevski et al., 2020a; Chung et al., 2019) as well as bidirectional models (Baevski et al., 2020b; Hsu et al., 2021; Ao et al., 2021; Chen et al., 2021a). Two prominent models, wav2vec 2.0 and HuBERT are based on predicting discrete units of speech, either learned jointly during pretraining (Baevski et al., 2020b), or in an iterative pipeline approach (Hsu et al., 2021) where pre-training and clustering alternate. Another line of work directly reconstructs the input features (Eloff et al., 2019; Liu et al., 2021). + +In comparison to wav2vec 2.0, data2vec directly predicts contextualized latent representations without quantization. HuBERT discretizes representations from different layers across iterations and predicts these discretized units whereas data2vec predicts the average over multiple layers. Similar to other modalities, there is work on distilling larger self-supervised models into smaller models but primarily for the purpose of efficiency (Chang et al., 2021). + +Multimodal Pre-training. There has been a considerable body of research on learning representations of multiple modalities simultaneously often using paired data (Aytar et al., 2017; Radford et al., 2021b; Wang et al., 2021; Singh et al., 2021) with the aim to produce cross-modal representations which can perform well on multi-modal tasks and with modalities benefiting from each other through joint training (Alayrac et al., 2020; Akbari et al., 2021) with recent methods exploring few-shot learning (Tsimpoukelli et al., 2021). Our work does not perform multimodal training but aims to unify the learning objective for self-supervised learning in different modalities. We hope that this will enable better multimodal representations in the future. + +2Quantization is optional for wav2vec 2.0 (Baevski et al., 2020b; Zhang et al., 2020) but helpful for noisy speech (Chung et al., 2021). + +# 3. Method + +data2vec is trained by predicting the model representations of the full input data given a partial view of the input (Figure 1). We first encode a masked version of the training sample (model in student mode) and then construct training targets by encoding the unmasked version of the input with the same model but when parameterized as an exponentially moving average of the model weights (model in teacher mode; Grill et al. 2020; Caron et al. 2021). The target representations encode all of the information in the training sample and the learning task is for the student to predict these representations given a partial view of the input. + +# 3.1. Model Architecture + +We use the standard Transformer architecture (Vaswani et al., 2017) with a modality-specific encoding of the input data borrowed from prior work: for computer vision, we use the ViT-strategy of encoding an image as a sequence of patches, each spanning 16x16 pixels, input to a linear transformation (Dosovitskiy et al., 2020; Bao et al., 2021). Speech data is encoded using a multi-layer 1-D convolutional neural network that maps $16\mathrm{kHz}$ waveform to $50\mathrm{Hz}$ representations (Baevski et al., 2020b). Text is pre-processed to obtain sub-word units (Sennrich et al., 2016; Devlin et al., 2019), which are then embedded in distributional space via learned embedding vectors. We detail these methods below ( $\S 4$ ). + +# 3.2. Masking + +After the input sample has been embedded as a sequence of tokens, we mask part of these units by replacing them with a learned MASK embedding token and feed the sequence to the Transformer network. For computer vision, we follow the block-wise masking strategy of Bao et al. (2021), for speech we mask spans of latent speech representations (Baevski et al., 2020b) and for language we mask tokens (Devlin et al., 2019); §4 details each strategy. + +# 3.3. Training Targets + +The model is trained to predict the model representations of the original unmasked training sample based on an encoding of the masked sample. We predict model representations only for time-steps which are masked. The representations we predict are contextualized representations, encoding the particular time-step but also other information from the sample due to the use of self-attention in the Transformer network. $^4$ This is an important difference to BERT (De + +vlin et al., 2019), wav2vec 2.0 (Baevski et al., 2020b) or BEiT, MAE, SimMIM, and MaskFeat (Bao et al., 2021; He et al., 2021; Xie et al., 2021; Wei et al., 2021) which predict targets lacking contextual information. Below, we detail how we parameterize the teacher which predicts the network representations that will serve as targets as well as how we construct the final target vectors to be predicted by the model in student-mode. + +Teacher Parameterization. The encoding of the un-masked training sample is parameterized by an exponentially moving average (EMA) of the model parameters $(\theta; \text{Tarvainen & Valpola 2018; Grill et al. 2020; Caron et al. 2021})$ where the weights of the model in target-mode $\Delta$ are: + +$$ +\Delta \gets \tau \Delta + (1 - \tau) \theta +$$ + +We use a schedule for $\tau$ that linearly increases this parameter from $\tau_0$ to the target value $\tau_{e}$ over the first $\tau_{n}$ updates after which the value is kept constant for the remainder of training. This strategy results in the teacher being updated more frequently at the beginning of training, when the model is random, and less frequently later in training, when good parameters have already been learned. We found it more efficient and slightly more accurate to share the parameters of the feature encoder and the positional encoder between the teacher and student networks. + +Targets. Training targets are constructed based on the output of the top $K$ blocks of the teacher network for time-steps which are masked in student-mode. $^{5}$ The output of block $l$ at time-step $t$ is denoted as $a_{t}^{l}$ . We apply a normalization to each block to obtain $\hat{a}_{t}^{l}$ before averaging the top $K$ blocks $y_{t} = \frac{1}{K}\sum_{l = L - K + 1}^{L}\hat{a}_{t}^{l}$ for a network with $L$ blocks in total to obtain the training target $y_{t}$ for time-step $t$ . This creates training targets that are to be regressed by the model when in student mode. In preliminary experiments we found that averaging performed as well as predicting each block separately with a dedicated projection while enjoying the advantage of being more efficient. + +Normalizing the targets helps prevent the model from collapsing into a constant representation for all time-steps and it also prevents layers with high norm to dominate the target features. For speech representations, we use instance normalization (Ulyanov et al., 2016) without any learned parameters over the current input sample since neighboring representations are highly correlated due to the small stride over the input data, while for NLP and vision we found parameter-less layer normalization (Ba et al., 2016) to be sufficient. Variance-Invariance-Covariance regularization (Bardes et al., 2021) also addresses this problem but + +we found the above strategy to perform well and it does not introduce additional hyper-parameters. + +# 3.4. Objective + +Given contextualized training targets $y_{t}$ , we use a Smooth L1 loss to regress these targets: + +$$ +\mathcal {L} (y _ {t}, f _ {t} (x)) = \left\{ \begin{array}{l l} \frac {1}{2} (y _ {t} - f _ {t} (x)) ^ {2} / \beta & | y _ {t} - f _ {t} (x) | \leq \beta \\ (| y _ {t} - f _ {t} (x) | - \frac {1}{2} \beta) & \text {o t h e r w i s e} \end{array} \right. +$$ + +where $\beta$ controls the transition from a squared loss to an $L_{1}$ loss, depending on the size of the gap between the target $y_{t}$ and the model prediction $f_{t}(x)$ at time-step $t$ . The advantage of this loss is that it is less sensitive to outliers, however, we need to tune the setting of $\beta$ . + +# 4. Experimental Setup + +We experiment with two model sizes: data2vec Base and data2vec Large, containing either $L = 12$ or $L = 24$ Transformer blocks with $H = 768$ or $H = 1024$ hidden dimension (with $4 \times H$ feed-forward inner-dimension). EMA updates are performed in fp32 for numerical stability (Manohar et al., 2021). + +# 4.1. Computer Vision + +We embed images of $224 \times 224$ pixels as patches of $16 \times 16$ pixels (Dosovitskiy et al., 2020). Each patch is linearly transformed and a sequence of 196 representations is input to a standard Transformer. We follow BEiT (Bao et al., 2021) by masking blocks of multiple adjacent patches where each block contains at least 16 patches with a random aspect ratio. Different to their work, we found it more accurate to mask $60\%$ of the patches instead of $40\%$ . We use randomly applied resized image crops, horizontal flipping, and color jittering (Bao et al., 2021). We use the same modified image both in teacher mode and student mode. + +ViT-B models are pre-trained for 800 epochs. As batch size we use 2,048 for ViT-B and 8,192 for ViT-L. We use Adam (Kingma & Ba, 2015) and a cosine schedule (Loshchilov & Hutter, 2016) with a single cycle where we warm up the learning rate for 40 epochs to 0.002 for ViT-B and for 80 epochs to 0.001 for ViT-L after which the learning rate is annealed following the cosine schedule. For ViT-B and ViT-L, we use $\beta = 2$ , $K = 6$ and $\tau = 0.9998$ as a constant value with no schedule which worked well. We use stochastic depth with rate 0.2 (Huang et al., 2016). For ViT-L, we train for 1,600 epochs in total, the first 800 epochs use $\tau = 0.9998$ , we then reset the learning rate schedule and the teacher weights to the student and continue for another 800 epochs with $\tau = 0.9999$ . + +For image classification we mean-pool the output of the + +last Transformer block and input it to a softmax-normalized classifier. We fine-tune ViT-B for 100 epochs and ViT-L for 50 epochs using Adam and a cosine schedule where we warm up the learning rate for 20 epochs to 0.004 for ViT-B and for 5 epochs to 0.004 for ViT-L after which the learning rate follows the cosine schedule. We build on the open source implementation of BEiT (Bao et al., 2021). + +# 4.2. Speech Processing + +Models are implemented in fairseq (Ott et al., 2019) and take as input $16\mathrm{kHz}$ waveform which is processed by a feature encoder (Baevski et al., 2020b) containing seven temporal convolutions with 512 channels, strides $(5,2,2,2,2,2,2)$ and kernel widths $(10,3,3,3,3,2,2)$ . This results in an encoder output frequency of $50\mathrm{Hz}$ with a stride of about $20\mathrm{ms}$ between each sample, and a receptive field of 400 input samples or $25\mathrm{ms}$ of audio. The raw waveform input to the encoder is normalized to zero mean and unit variance. + +The masking strategy for the Base model is also identical to Baevski et al. (2020b): we sample $p = 0.065$ of all time-steps to be starting indices and mask the subsequent ten time-steps. This results in approximately $49\%$ of all time-steps to be masked for a typical training sequence. During pre-training we linearly anneal $\tau$ using $\tau_0 = 0.999$ , $\tau_e = 0.9999$ and $\tau_n = 30,000$ , average the top $K = 8$ blocks as targets and found a simple L2 loss to work well. + +We optimize with Adam (Kingma & Ba, 2015), with a peak learning rate of $5 \times 10^{-4}$ for data2vec Base. The Base model uses a tri-stage scheduler which linearly warms up the learning rate over the first $3\%$ of updates, holds it for $90\%$ of updates and then linearly decays it over the remaining $7\%$ . We train data2vec Base for 400K updates with a batch size of 63 minutes of audio (61M frames). We follow the fine-tuning regime of wav2vec 2.0 (Baevski et al., 2020b) whose hyper-parameters depend on the labeled data setup. + +# 4.3. Natural Language Processing + +We build on the BERT re-implementation RoBERTa (Liu et al., 2019) available in fairseq (Ott et al., 2019). The input data is tokenized using a byte-pair encoding (Sennrich et al., 2016) of 50K types and the model learns an embedding for each type (Devlin et al., 2019; Liu et al., 2019) Once the data is embedded, we apply the BERT masking strategy to $15\%$ of uniformly selected tokens: $80\%$ are replaced by a learned mask token, $10\%$ are left unchanged and $10\%$ are replaced by randomly selected vocabulary token; we do not use the next-sentence prediction task. We also consider the wav2vec 2.0 strategy of masking spans of four tokens. + +For pre-training we use $\tau_0 = 0.999$ , $\tau_e = 0.9999$ and $\tau_n = 100,000$ , $K = 10$ and set $\beta = 4$ . The model is optimized with Adam over 1M updates using a tri-stage + +Table 1. Computer vision: top-1 validation accuracy on ImageNet-1K with ViT-B and ViT-L models. data2vec ViT-B was trained for 800 epochs and ViT-L for 1,600 epochs. We distinguish between individual models and setups composed of multiple models (BEiT/PeCo train separate visual tokenizers and PeCo also distills two MoCo-v3 models). + +
ViT-BViT-L
Multiple models
BEiT (Bao et al., 2021)83.285.2
PeCo (Dong et al., 2022)84.586.5
Single models
MoCo v3 (Chen et al., 2021b)83.284.1
DINO (Caron et al., 2021)82.8-
MAE (He et al., 2021)83.685.9
SimMIM (Xie et al., 2021)83.8-
iBOT (Zhou et al., 2021)83.8-
MaskFeat (Wei et al., 2021)84.085.7
data2vec84.286.6
+ +learning rate schedule (5%, 80% and 15% of updates for warm-up, holding and linearly decaying, respectively). The peak learning rate is $2 \times 10^{-4}$ . We train on 16 GPUs with a total batch size of 256 sequences and each sequence is up to 512 tokens. For downstream tasks, we fine-tune the pretrained model with four different learning rates ( $1 \times 10^{-5}$ , $2 \times 10^{-5}$ , $3 \times 10^{-5}$ , $4 \times 10^{-5}$ ) and choose the one which performs best across all considered NLP downstream tasks. + +# 5. Results + +# 5.1. Computer Vision + +To evaluate our approach for computer vision, we pretrain data2vec on the images of the ImageNet-1K training set (Deng et al., 2009) and fine-tune the resulting model for image classification using the labeled data of the same benchmark ( $\S 4.1$ ). Following standard practice, models are evaluated in terms of top-1 accuracy on the validation set. We distinguish between results based on a single self-supervised model, and results which train a separate visual tokenizer on additional data (Bao et al., 2021) or distill other self-supervised models (Dong et al., 2022). + +Table 1 shows that data2vec outperforms prior work with ViT-B and ViT-L in the single model setting and all prior work for ViT-L. Predicting contextualized latent representations in a masked prediction setup can perform very well compared to approaches which predict local targets such as the original input pixels (He et al., 2021; Xie et al., 2021), engineered image features (Wei et al., 2021) or visual tokens (Bao et al., 2021). It also outperforms prior self-distillation methods (Caron et al., 2021) which regressed + +Table 2. Speech processing: word error rate on the Librispeech test-other test set when fine-tuning pre-trained models on the Libri-light low-resource labeled data setups (Kahn et al., 2020) of $10\mathrm{min}$ , 1 hour, 10 hours, the clean 100h subset of Librispeech and the full 960h of Librispeech. Models use the 960 hours of audio from Librispeech (LS-960) as unlabeled data. We indicate the language model used during decoding (LM). Results for all dev/test sets and other LMs can be found in the supplementary material (Table 6). + +
Unlabeled dataLMAmount of labeled data
10m1h10h100h960h
Base models
wav2vec 2.0 (Baevski et al., 2020b)LS-9604-gram15.611.39.58.06.1
HuBERT (Hsu et al., 2021)LS-9604-gram15.311.39.48.1-
WavLM (Chen et al., 2021a)LS-9604-gram-10.89.27.7-
data2vecLS-9604-gram12.39.18.16.85.5
Large models
wav2vec 2.0 (Baevski et al., 2020b)LS-9604-gram10.37.15.84.63.6
HuBERT (Hsu et al., 2021)LS-9604-gram10.16.85.54.53.7
WavLM (Chen et al., 2021a)LS-9604-gram-6.65.54.6-
data2vecLS-9604-gram8.46.35.34.63.7
+ +the final layer of the student network while inputting two different augmented versions of an image to the student and teacher networks. + +# 5.2. Speech and Audio Processing + +For speech processing, we pre-train data2vec on the 960 hours of speech audio data from Librispeech (LS-960). This dataset contains relatively clean speech audio from read audiobooks in English and is a standard benchmark in the speech community. To get a sense of performance in different resource settings, we fine-tune models for automatic speech recognition using different amounts of labeled data, ranging from just 10 minutes to 960 hours. We also compare to other work from the literature, including wav2vec 2.0 (Baevski et al., 2020b) and HuBERT (Hsu et al., 2021), two popular algorithms for speech representation learning relying on discrete units of speech. + +Table 2 shows improvements for most labeled data setups with the largest gains for 10 minutes of labeled data (20% relative WER improvement) for the Base models. For Large models, there are strong improvements for the smallest labeled data setups, and comparable performance for the resource-rich settings of 100 hours and 960 hours of labeled data where performance is generally saturating for many models (Zhang et al., 2020; Chung et al., 2021). Our results suggest that learning discrete units is not required when rich contextualized targets are used and that learning contextualized targets during pre-training improves performance. + +To further validate our approach for speech, we also trained a model on the AudioSet benchmark (Gemmeke et al., 2017). The pre-training setup is the same as Librispeech, but we set + +Table 3. Audio event classification: mean average precision (mAP) on the eval set of AudioSet when pre-training on all of AudioSet (AS) and/or Librispeech (LS) and fine-tuning on the 20K subset. + +
Pretrain datamAP
SSAST (Gong et al., 2021)AS, LS31.0
MaskSpec (Chong et al., 2022)AS32.3
MAE-AST (Baade et al., 2022)AS, LS30.6
data2vecAS34.5
+ +$K = 12$ and train for $200\mathrm{K}$ updates with a batch size of 94.5 minutes of audio. We apply DeepNorm (Wang et al., 2022) and layer normalization of the targets to stabilize training. Finetuning is done on the balanced subset over $13\mathrm{k}$ updates with a batch size of 21.3 minutes. Similar to Srivastava et al. (2021), we use linear softmax pooling (Wang et al., 2018b) and mixup (Tokozume et al., 2017) with probability 0.7. We add a single linear projection layer into 527 audioset classes and set the projection learning rate to $2e - 4$ . The pre-trained parameters are trained with a learning rate of $3e - 5$ and we use masking during fine-tuning similar to Baevski et al. (2020b) with $p = 0.45$ and mask length of 4. The results (Table 3) show that data2vec can outperform a comparable setup that uses the same pre-training and fine-tuning data. + +# 5.3. Natural Language Processing + +To get a sense of how data2vec performs for language, we adopt the same training setup as BERT (Devlin et al., 2019) by pre-training on the Books Corpus (Zhu et al., 2015) and English Wikipedia data over 1M updates and a batch size of 256 sequences. We evaluate on the General Language + +Table 4. Natural language processing: GLUE results on the development set for single-task fine-tuning of individual models. For MNLI we report accuracy on both the matched and unmatched dev sets, for MRPC and QQP, we report the unweighted average of accuracy and F1, for STS-B the unweighted average of Pearson and Spearman correlation, for CoLA we report Matthews correlation and for all other tasks we report accuracy. BERT Base results are from Wu et al. (2020) and our baseline is RoBERTa re-trained in a similar setup as BERT. We also report results with wav2vec 2.0 style masking of spans of four BPE tokens with no unmasked tokens or random targets. + +
MNLIQNLIRTEMRPCQQPSTS-BCoLASSTAvg.
BERT (Devlin et al., 2019)84.0/84.489.061.086.389.189.557.393.080.7
Baseline (Liu et al., 2019)84.1/83.990.469.389.089.388.956.892.382.5
data2vec83.2/83.090.967.090.289.187.262.291.882.7
+ wav2vec 2.0 masking82.8/83.491.169.990.089.087.760.392.482.9
+ +Understanding Evaluation (GLUE) benchmark (Wang et al., 2018a) which includes tasks for natural language inference (MNLI, QNLI, RTE), sentence similarity (MRPC, QQP and STS-B), grammaticality (CoLA), and sentiment analysis (SST-2). We fine-tune data2vec separately on the labeled data provided by each task and report the average accuracy on the development sets over five fine-tuning runs. We compare to the published BERT results as well as to the results we obtain by retraining RoBERTa in the current setup (Baseline; Liu et al. 2019) which provides a more suitable baseline to data2vec since we build on their open source code. + +The results (Table 4) show that data2vec outperforms the RoBERTa baseline. When we mask spans of four BPE tokens with masking probability 0.35 (Baevski et al., 2020b), then results improve further. This strategy does not leave tokens unmasked or uses random targets as for BERT ( $\S 4.3$ ). + +To our knowledge this is the first successful pre-trained NLP model which does not use discrete units (words, subwords, characters or bytes) as the training target. Instead, the model predicts a contextualized latent representation emerging from self-attention over the entire unmasked text sequence. This enables a learning task where the model needs to predict targets with specific properties of the current text sequence rather than representations which are generic to every text sequence in which the particular discrete unit occurs. Moreover, the set of training targets is not fixed, i.e., not a closed vocabulary, and the model can choose to define + +$^{6}$ MNLI (Multi Genre Natural Language Inference; Williams et al. 2018), Stanford Question Answering Dataset (QNLI; Rajpurkar et al. 2016), Recognizing Textual Entailment (RTE; Dagan et al. 2006; Haim et al. 2006; Giampiccolo et al. 2007; Bentivogli et al. 2009), and we exclude Winograd NLI task from our results similar to Devlin et al. (2019), Microsoft Research Paragraph Corpus (MRPC; Dolan & Brockett 2005), Quora Question Pairs benchmark (QQP), and the Semantic Textual Similarity Benchmark (STS-B; Cer et al. 2018), Corpus of Linguistic Acceptability (CoLA; Warstadt et al. 2018), Stanford Sentiment Treebank (SST-2; Socher et al. 2013) + +7We used a cosine learning rate schedule for this result. + +new targets as it sees fit, akin to an open vocabulary setting. + +# 5.4. Ablations + +Layer-averaged Targets. One of the main differences of our method compared to BYOL is the use of targets which are based on averaging multiple layers from the teacher network (§3.3). This idea was partly inspired by the fact that the top layers of wav2vec 2.0 do not perform as well for downstream tasks as layers in the middle of the network (Baevski et al., 2021; Pasadena et al., 2021). + +In the next experiment, we measure performance for all three modalities when averaging $K = 1, \dots, 12$ layers where $K = 1$ corresponds to predicting only the top layer similar to BYOL. For faster experimental turn-around, we train Base models with $L = 12$ layers in total. For speech, we pre-train for 200K updates on Librispeech, fine-tune on the 10 hour labeled split of Libri-light (Kahn et al., 2019) and report word error rate without a language model on dev-other. For NLP, we report the average GLUE score on the validation set (\$5.3) and for computer vision we pre-train models for 300 epochs and report the top-1 accuracy on ImageNet (\$5.1). + +Figure 2 shows that targets based on multiple layers improves over using only the top layer ( $K = 1$ ) for all modalities. Using all layers is generally a good choice and only slightly worse than a carefully tuned value of $K$ . Neural networks build features over multiple layers and different types of features are extracted at different layers. Using features from multiple layers enriches the self-supervised task and improves accuracy. + +Target Contextualization. Teacher representations are based on self-attention over the entire input which results in contextualized targets. This distinguishes data2vec from other self-supervised approaches which construct a learning task by predicting or reconstructing local parts of the input ( $\S 2$ ). This poses the natural question of whether contextualized targets are required for data2vec to work well. + +![](images/a5d389f6a419703047c2fee1b365071f5f0d50299f9b2857300d552468266289.jpg) +(a) Speech + +![](images/38b47047ad870d79e615ff9f3781243b827443724210ec653d9e4b2fa48ec135.jpg) +(b) NLP +Figure 2. Predicting targets which are the average of multiple layers is more robust than predicting only the top most layer ( $K = 1$ ) for most modalities. We show the performance of predicting the average of $K$ teacher layer representations (§3.3). The effect is very pronounced for speech and NLP while for vision there is still a slight advantage of predicting more than a single layer. + +![](images/40ed046f1d4b174d20528fdec0d0ad3258b83e1d48b271955bd03664c2a6f7fd.jpg) +(c) Vision + +![](images/161142234a73257bc28d51175ad548fac58ec6971f8cf4853f34ab1edd5d0deb.jpg) + +![](images/2abfdcb4e0667466ceff2520cb00a211e8a089779a4194341c4a9957e6e6fc7f.jpg) +(a) Speech +(b) Vision +Figure 3. Contextualized target representations improve accuracy. We mask all but a fraction of the data when constructing the target representations in the teacher for pre-training and report downstream performance for speech and vision. Time-steps for speech are more fine-grained (20ms patches) compared to vision (16x16 pixels per patch). + +Table 5. Effect of using different features from the teacher model as targets: we compare using the output of the self-attention module, the feed-forward module (FFN) as well as after the final residual connection (FFN + residual) and layer normalization (End of block). Results are not directly comparable to the main results since we use a reduced setup ( $\S 5.4$ ). + +
LayerWER
self-attention100.0
FFN13.1
FFN + residual14.8
End of block14.5
+ +In order to get a better sense of this, we construct target representations which do not have access to the entire input sample but rather only a pre-defined fraction of it. Concretely, we restrict the self-attention mechanism of the teacher to only be able to access a portion of the input surrounding the current time-step. Once the model is trained, we fine-tune it so that it can access the full context size. Figure 3 shows that larger context sizes lead to better downstream performance. The best accuracy is achieved when the entire input sample is visible. This shows that richer target representations can indeed lead to better performance. + +Target Feature Type. Transformers blocks contain several layers which can each serve as targets. To get a sense of how different layers impact performance, we pre-train speech models on Librispeech using different layers as target features. Table 5 shows that the output of the feedforward network (FFN) block works best while the output of the self-attention block does not yield a usable model. We believe this is because the self-attention is before the residual connection and features are heavily biased towards other time-steps. This issue is alleviated by the use of FFN features since these also include the features before the self-attention. + +# 6. Discussion + +# Modality-specific Feature Extractors and Masking. + +Our primary goal is to design a single learning mechanism for different modalities. Despite the unified learning regime, we still use modality-specific feature extractors and masking strategies. This makes sense given the vastly different nature of the input data: for example, in speech we learn from a very high resolution input (16 kHz waveform) which contains hundreds of thousands of samples for typical utterances. To process this, we apply a multilayer convolutional neural network to obtain a 50 Hz feature sequence. For NLP, word input sequences have vastly lower resolution which can be directly embedded in distributional space via a lookup table. The type of data also impacts how we should mask the input to create a challenging learning task: removing individual words provides a sufficiently challenging task but for speech it is necessary to mask spans since adjacent audio samples are highly correlated with each other. Relatedly, there has been recent work on a Transformer architecture that can directly operate on the raw data of different modalities without modality-specific feature encoders (Jaegle et al., 2021b;a). Their work is focused on supervised learning for classification tasks and we believe that our work is complementary. + +Structured and Contextualized Targets. One of the main differences of data2vec to most other masked prediction work (Devlin et al., 2019; Baevski et al., 2020b; Ling et al., 2020; Bao et al., 2021; He et al., 2021; Wei et al., 2021) is that the features of the training targets are contextualized since the features are built with self-attention over the entire unmasked input in teacher mode. And while BYOL (Grill et al., 2020) and DINO (Caron et al., 2021) also use latent target representations based on the entire input, their focus is on learning transformation-invariant representations instead of structural information within a sample. + +One exception is HuBERT (Hsu et al., 2021) which builds a fixed set of discrete target units by clustering Transformer layer representations. In comparison, data2vec has no limitation on the number of target units. Instead of representing each instance of particular discrete target unit with the same set of features, data2vec can build target features that are specific to the current sequence. + +For NLP, we believe data2vec is the first work that does not rely on pre-defined target units. Most other work uses either words, sub-words (Radford et al., 2018; Devlin et al., 2019), characters (Tay et al., 2021) or even bytes (Xue et al., 2021). Aside, defining word boundaries is not straightforward for some Asian languages. Contextualized targets enable integrating features from the entire sequence into the training target which provides a richer self-supervised task. Further + +more, the representation of each instance of a particular unit (word/sub-word/character/byte) can differ for the masked prediction task. This enables to associate a different meaning to a particular depending on the context it occurs in. It also relieves the model from the need to learn a single set of features for a target unit that fits all instances of this unit. + +Representation Collapse. A common failure mode when learning targets is for similar representations for targets to be produced resulting in a trivial task (Jing et al., 2021). To deal with this, contrastive models such as wav2vec 2.0 (Baevski et al., 2020b) use the same target representation both as a positive and a negative example. BYOL (Grill et al., 2020) do not optimize the teacher parameters to minimize the loss and VicReg (Bardes et al., 2021) adds an explicit loss encouraging variance among different representations. + +We found that collapse is most likely to happen in the following scenarios: First, the learning rate is too large or the learning rate warmup is too short which can often be solved by tuning the respective hyperparameters. Second, $\tau$ is too low which leads to student model collapse and is then propagated to the teacher. This can be addressed by tuning $\tau_0$ , $\tau_e$ and $\tau_n$ . Third, we found collapse to be more likely for modalities where adjacent targets are very correlated and where longer spans need to be masked, e.g., speech. We address this by promoting variance through normalizing target representations over the sequence or batch (Grill et al., 2020). For models where targets are less correlated, such as vision and NLP, momentum tracking is sufficient. + +# 7. Conclusion + +Recent work showed that uniform model architectures can be effective for multiple modalities (Jaegle et al., 2021b). Whereas we show that a single self-supervised learning regime can be effective for vision, speech and language. The key idea is to regress contextualized representations based on a partial input view. data2vec outperforms prior self-supervised work on ImageNet-1K for ViT-B and ViT-L single models, it improves over prior work on speech recognition for the low-resource Libri-light setups, and it outperforms RoBERTa on GLUE in the original BERT setup. + +A single learning method for multiple modalities will make it easier to learn across modalities and future work may investigate tasks such as audio-visual speech recognition or cross-modal retrieval. Our approach still uses modality-specific input encoders and we adopt modality-specific masking strategies which future work may unify. + +# Acknowledgements + +We thank Brenden Lake, Dhruv Batra, Marco Baroni and Laurens van der Maaten for helpful discussions. + +# References + +Akbari, H., Yuan, L., Qian, R., Chuang, W.-H., Chang, S.-F., Cui, Y., and Gong, B. Vatt: Transformers for multimodal self-supervised learning from raw video, audio and text, 2021. +Alayrac, J.-B., Recasens, A., Schneider, R., Arandjelovic, R., Ramapuram, J., Fauw, J. D., Smaira, L., Dieleman, S., and Zisserman, A. Self-supervised multimodal versatile networks, 2020. +Ao, J., Wang, R., Zhou, L., Liu, S., Ren, S., Wu, Y., Ko, T., Li, Q., Zhang, Y., Wei, Z., Qian, Y., Li, J., and Wei, F. Speecht5: Unified-modal encoder-decoder pre-training for spoken language processing. arXiv, abs/2110.07205, 2021. +Aytar, Y., Vondrick, C., and Torralba, A. See, hear, and read: Deep aligned representations, 2017. +Ba, J. L., Kiros, J. R., and Hinton, G. E. Layer normalization. arXiv, abs/1607.06450, 2016. +Baade, A., Peng, P., and Harwath, D. Mae-ast: Masked autoencoding audio spectrogram transformer. arXiv, abs/2203.16691, 2022. +Baevski, A., Edunov, S., Liu, Y., Zettlemoyer, L., and Auli, M. Cloze-driven pretraining of self-attention networks. In Proc. of EMNLP, 2019. +Baevski, A., Schneider, S., and Auli, M. vq-wav2vec: Self-supervised learning of discrete speech representations. In Proc. of ICLR, 2020a. +Baevski, A., Zhou, Y., Mohamed, A., and Auli, M. wav2vec 2.0: A framework for self-supervised learning of speech representations. In Proc. of NeurIPS, 2020b. +Baevski, A., Hsu, W.-N., Conneau, A., and Auli, M. Unsupervised speech recognition. In Proc. of NeurIPS, 2021. +Bao, H., Dong, L., and Wei, F. Beit: BERT pre-training of image transformers. arXiv, abs/2106.08254, 2021. +Bardes, A., Ponce, J., and LeCun, Y. Vicreg: Variance-invariance-covariance regularization for self-supervised learning. arXiv, abs/2105.04906, 2021. +Bentivogli, L., Clark, P., Dagan, I., and Giampiccolo, D. The fifth pascal recognizing textual entailment challenge. In Proc. of TAC, 2009. +Brown, T. B., Mann, B., Ryder, N., Subbiah, M., Kaplan, J., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., Agarwal, S., Herbert-Voss, A., Krueger, G., Henighan, T., Child, R., Ramesh, A., Ziegler, D. M., Wu, J., Winter, C., Hesse, C., Chen, M., Sigler, E., Litwin, M., + +Gray, S., Chess, B., Clark, J., Berner, C., McCandlish, S., Radford, A., Sutskever, I., and Amodei, D. Language models are few-shot learners. In Proc. of NeurIPS, 2020. +Caron, M., Misra, I., Mairal, J., Goyal, P., Bojanowski, P., and Joulin, A. Unsupervised learning of visual features by contrasting cluster assignments. arXiv, abs/2006.09882, 2020. +Caron, M., Touvron, H., Misra, I., Jégou, H., Mairal, J., Bojanowski, P., and Joulin, A. Emerging properties in self-supervised vision transformers. arXiv, abs/2104.14294, 2021. +Cer, D. M., Diab, M. T., Agirre, E., Lopez-Gazpio, I., and Specia, L. Semeval-2017 task 1: Semantic textual similarity - multilingual and cross-lingual focused evaluation. In Proc. of SemEval, 2018. +Chang, H.-J., wen Yang, S., and yi Lee, H. Distilhubert: Speech representation learning by layer-wise distillation of hidden-unit bert. arXiv, abs/2110.01900, 2021. +Chen, S., Wang, C., Chen, Z., Wu, Y., Liu, S., Chen, Z., Li, J., Kanda, N., Yoshioka, T., Xiao, X., Wu, J., Zhou, L., Ren, S., Qian, Y., Qian, Y., Wu, J., Zeng, M., and Wei, F. Wavlm: Large-scale self-supervised pre-training for full stack speech processing. arXiv, abs/2110.13900, 2021a. +Chen, T., Kornblith, S., Norouzi, M., and Hinton, G. A simple framework for contrastive learning of visual representations. arXiv, abs/2002.05709, 2020. +Chen, X., Xie, S., and He, K. An empirical study of training self-supervised vision transformers. arXiv, abs/2104.02057, 2021b. +Chong, D., Wang, H., Zhou, P., and Zeng, Q. Masked spectrogram prediction for self-supervised audio pre-training. arXiv, abs/2204.12768, 2022. +Chung, Y., Hsu, W., Tang, H., and Glass, J. R. An unsupervised autoregressive model for speech representation learning. Proc. of Interspeech, 2019. +Chung, Y.-A., Zhang, Y., Han, W., Chiu, C.-C., Qin, J., Pang, R., and Wu, Y. W2v-bert: Combining contrastive learning and masked language modeling for self-supervised speech pre-training. arXiv, abs/2108.06209, 2021. +Dagan, I., Glickman, O., and Magnini, B. The Pascal recognizing textual entailment challenge. Machine learning challenges, evaluating predictive uncertainty, visual object classification, and recognizing textual entailment, pp. 177-190, 2006. +Deng, J., Dong, W., Socher, R., Li, L.-J., Li, K., and Fei-Fei, L. Imagenet: A large-scale hierarchical image database. In Proc. of CVPR, 2009. + +Devlin, J., Chang, M.-W., Lee, K., and Toutanova, K. Bert: Pre-training of deep bidirectional transformers for language understanding. Proc. of NAACL, 2019. +Dolan, W. B. and Brockett, C. Automatically constructing a corpus of sentential paraphrases. In Proc. of IWP, 2005. +Dong, X., Bao, J., Zhang, T., Chen, D., Zhang, W., Yuan, L., Chen, D., Wen, F., and Yu, N. Peco: Perceptual codebook for bert pre-training of vision transformers, 2022. +Dosovitskiy, A., Beyer, L., Kolesnikov, A., Weissenborn, D., Zhai, X., Unterthiner, T., Dehghani, M., Minderer, M., Heigold, G., Gelly, S., Uszkoreit, J., and Houlsby, N. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv, abs/2010.11929, 2020. +Eloff, R., Nortje, A., van Niekerk, B., Govender, A., Nortje, L., Pretorius, A., Van Biljon, E., van der Westhuizen, E., van Staden, L., and Kamper, H. Unsupervised acoustic unit discovery for speech synthesis using discrete latent-variable neural networks. arXiv, abs/1904.07556, 2019. +Friston, K. The free-energy principle: a unified brain theory? Nature reviews neuroscience, 2010. +Friston, K. and Kiebel, S. Predictive coding under the free-energy principle. Philosophical transactions of the Royal Society: Biological sciences, 2009. +Gemmeke, J. F., Ellis, D. P. W., Freedman, D., Jansen, A., Lawrence, W., Moore, R. C., Plakal, M., and Ritter, M. Audio set: An ontology and human-labeled dataset for audio events. In Proc. of ICASSP, 2017. +Giampiccolo, D., Magnini, B., Dagan, I., and Dolan, B. The pascal recognizing textual entailment challenge. Proc. of the ACL-PASCAL workshop on textual entailment and paraphrasing, 2007. +Gong, Y., Lai, C.-I. J., Chung, Y.-A., and Glass, J. Ssast: Self-supervised audio spectrogram transformer. arXiv, abs/2110.09784, 2021. +Grill, J.-B., Strub, F., Altché, F., Tallec, C., Richemond, P. H., Buchatskaya, E., Doersch, C., Pires, B. A., Guo, Z. D., Azar, M. G., Piot, B., Kavukcuoglu, K., Munos, R., and Valko, M. Bootstrap your own latent: A new approach to self-supervised learning. arXiv, abs/2006.07733, 2020. +Haim, R. B., Dagan, I., Dolan, B., Ferro, L., Giampiccolo, D., Magnini, B., and Szpektor, I. The pascal recognising textual entailment challenge. Lecture Notes in Computer Science, 2006. +He, K., Fan, H., Wu, Y., Xie, S., and Girshick, R. Momentum contrast for unsupervised visual representation learning. arXiv, abs/1911.05722, 2019. + +He, K., Chen, X., Xie, S., Li, Y., Dollar, P., and Girshick, R. Masked autoencoders are scalable vision learners. arXiv, abs/2111.06377, 2021. +Hsu, W.-N., Tsai, Y.-H. H., Bolte, B., Salakhutdinov, R., and Mohamed, A. Hubert: How much can a bad teacher benefit ASR pre-training? In Proc. of ICASSP, 2021. +Huang, G., Sun, Y., Liu, Z., Sedra, D., and Weinberger, K. Deep networks with stochastic depth. arXiv, abs/1603.09382, 2016. +Jaegle, A., Borgeaud, S., Alayrac, J.-B., Doersch, C., Ionescu, C., Ding, D., Koppula, S., Zoran, D., Brock, A., Shelhamer, E., Henaff, O., Botvinick, M. M., Zisserman, A., Vinyals, O., and Carreira, J. Perceiver io: A general architecture for structured inputs & outputs. arXiv, abs/2107.14795, 2021a. +Jaegle, A., Gimeno, F., Brock, A., Zisserman, A., Vinyals, O., and Carreira, J. Perceiver: General perception with iterative attention. arXiv, abs/2103.03206, 2021b. +Jiao, X., Yin, Y., Shang, L., Jiang, X., Chen, X., Li, L., Wang, F., and Liu, Q. Tinybert: Distilling bert for natural language understanding. arXiv, abs/1909.10351, 2020. +Jing, L., Vincent, P., LeCun, Y., and Tian, Y. Understanding dimensional collapse in contrastive self-supervised learning, 2021. +Kahn, J., Rivière, M., Zheng, W., Kharitonov, E., Xu, Q., Mazaré, P., Karadayi, J., Liptchinsky, V., Collobert, R., Fuegen, C., Likhomanenko, T., Synnaeve, G., Joulin, A., Mohamed, A., and Dupoux, E. Libri-light: A benchmark for asr with limited or no supervision. arXiv, abs/1912.07875, 2019. +Kahn, J. et al. Libri-light: A benchmark for asr with limited or no supervision. In Proc. of ICASSP, 2020. +Kingma, D. P. and Ba, J. Adam: A Method for Stochastic Optimization. In Proc. of ICLR, 2015. +Lample, G., Denoyer, L., and Ranzato, M. Unsupervised machine translation using monolingual corpora only. In Proc. of ICLR, 2018. +Likhomanenko, T., Xu, Q., Kahn, J., Synnaeve, G., and Collobert, R. slimipl: Language-model-free iterative pseudo-labeling. arXiv, abs/2010.11524, 2021. +Ling, S., Liu, Y., Salazar, J., and Kirchhoff, K. Deep contextualized acoustic representations for semi-supervised speech recognition. In Proc. of ICASSP, 2020. +Liu, A. T., Li, S.-W., and Lee, H.-y. Tera: Self-supervised learning of transformer encoder representation for speech. IEEE/ACM Trans. on Audio, Speech, and Language Processing, 2021. + +Liu, Y., Ott, M., Goyal, N., Du, J., Joshi, M., Chen, D., Levy, O., Lewis, M., Zettlemoyer, L., and Stoyanov, V. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692, 2019. +Loshchilov, I. and Hutter, F. SGDR: stochastic gradient descent with restarts. arXiv, abs/1608.03983, 2016. +Manohar, V., Likhomanenko, T., Xu, Q., Hsu, W.-N., Collobert, R., Saraf, Y., Zweig, G., and Mohamed, A. Kaizen: Continuously improving teacher using exponential moving average for semi-supervised speech recognition, 2021. +McCann, B., Bradbury, J., Xiong, C., and Socher, R. Learned in translation: Contextualized word vectors. arXiv, abs/1708.00107, 2017. +Ott, M., Edunov, S., Baevski, A., Fan, A., Gross, S., Ng, N., Grangier, D., and Auli, M. fairseq: A fast, extensible toolkit for sequence modeling. In Proc. of NAACL System Demonstrations, 2019. +Park, D. S., Zhang, Y., Jia, Y., Han, W., Chiu, C.-C., Li, B., Wu, Y., and Le, Q. V. Improved noisy student training for automatic speech recognition. Proc. of Interspeech, 2020. +Pasad, A., Chou, J.-C., and Livescu, K. Layer-wise analysis of a self-supervised speech representation model. arXiv, abs/2107.04734, 2021. +Peters, M. E., Neumann, M., Iyyer, M., Gardner, M., Clark, C., Lee, K., and Zettlemoyer, L. Deep contextualized word representations. In Proc. of ACL, 2018. +Radford, A., Narasimhan, K., Salimans, T., and Sutskever, I. Improving language understanding by generative pretraining. https://s3-us-west-2.amazon.com/openai-assets/research-covers/language-unsupervised/language_understanding_paper.pdf, 2018. +Radford, A., Kim, J. W., Hallacy, C., Ramesh, A., Goh, G., Agarwal, S., Sastry, G., Askell, A., Mishkin, P., Clark, J., Krueger, G., and Sutskever, I. Learning transferable visual models from natural language supervision. arXiv, abs/2103.00020, 2021a. +Radford, A., Kim, J. W., Hallacy, C., Ramesh, A., Goh, G., Agarwal, S., Sastry, G., Askell, A., Mishkin, P., Clark, J., Krueger, G., and Sutskever, I. Learning transferable visual models from natural language supervision. arXiv, abs/2103.00020, 2021b. +Rajpurkar, P., Zhang, J., Lopyrev, K., and Liang, P. Squad: 100, 000+ questions for machine comprehension of text. arXiv, abs/1606.05250, 2016. + +Ramesh, A., Pavlov, M., Goh, G., Gray, S., Voss, C., Radford, A., Chen, M., and Sutskever, I. Zero-shot text-to-image generation. arXiv, abs/2102.12092, 2021. +Schneider, S., Baevski, A., Collobert, R., and Auli, M. wav2vec: Unsupervised pre-training for speech recognition. In Proc. of Interspeech, 2019. +Sennrich, R., Haddow, B., and Birch, A. Neural machine translation of rare words with subword units. In Proc. of ACL, 2016. +Singh, A., Hu, R., Goswami, V., Couairon, G., Galuba, W., Rohrbach, M., and Kiela, D. FLAVA: A foundational language and vision alignment model. arXiv, abs/2112.04482, 2021. +Socher, R., Perelygin, A., Wu, J., Chuang, J., Manning, C. D., Ng, A., and Potts, C. Recursive deep models for semantic compositionality over a sentiment treebank. In Proc. of EMNLP, 2013. +Srivastava, S., Wang, Y., Tjandra, A., Kumar, A., Liu, C., Singh, K., and Saraf, Y. Conformer-based self-supervised learning for non-speech audio tasks. arXiv, abs/2110.07313, 2021. +Tarvainen, A. and Valpola, H. Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results, 2018. +Tay, Y., Tran, V. Q., Ruder, S., Gupta, J., Chung, H. W., Bahri, D., Qin, Z., Baumgartner, S., Yu, C., and Metzler, D. Charformer: Fast character transformers via gradient-based subword tokenization. arXiv, abs/2106.12672, 2021. +Tokozume, Y., Ushiku, Y., and Harada, T. Learning from between-class examples for deep sound recognition. arXiv, abs/1711.10282, 2017. +Tsimpoukelli, M., Menick, J., Cabi, S., Eslami, S. M. A., Vinyals, O., and Hill, F. Multimodal few-shot learning with frozen language models, 2021. +Ulyanov, D., Vedaldi, A., and Lempitsky, V. S. Instance normalization: The missing ingredient for fast stylization. arXiv, abs/1607.08022, 2016. +van den Oord, A., Vinyals, O., et al. Neural discrete representation learning. In Proc. of NeurIPS, 2017. +van den Oord, A., Li, Y., and Vinyals, O. Representation learning with contrastive predictive coding. Proc. of NIPS, 2018. +Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, L., and Polosukhin, I. Attention is all you need. In Proc. of NIPS, 2017. + +Wang, A., Singh, A., Michael, J., Hill, F., Levy, O., and Bowman, S. R. GLUE: A multi-task benchmark and analysis platform for natural language understanding. arXiv, abs/1804.07461, 2018a. +Wang, H., Ma, S., Dong, L., Huang, S., Zhang, D., and Wei, F. Deepnet: Scaling transformers to 1,000 layers. arXiv, abs/2203.00555, 2022. +Wang, W., Bao, H., Dong, L., and Wei, F. Vlmo: Unified vision-language pre-training with mixture-of-modality-experts. arXiv, abs/2111.02358, 2021. +Wang, Y., Li, J., and Metze, F. A comparison of five multiple instance learning pooling functions for sound event detection with weak labeling. arXiv, abs/1810.09050, 2018b. +Warstadt, A., Singh, A., and Bowman, S. Corpus of linguistic acceptability. https://nyu-mll.github.io/CoLA, 2018. +Wei, C., Fan, H., Xie, S., Wu, C.-Y., Yuille, A., and Feichtenhofer, C. Masked feature prediction for self-supervised visual pre-training. arXiv, abs/2112.09133, 2021. +Williams, A., Nangia, N., and Bowman, S. R. A broad-coverage challenge corpus for sentence understanding through inference. In Proc. of NAACL, 2018. +Wu, Z., Wang, S., Gu, J., Khabsa, M., Sun, F., and Ma, H. CLEAR: contrastive learning for sentence representation. arXiv, abs/2012.15466, 2020. +Xie, Z., Zhang, Z., Cao, Y., Lin, Y., Bao, J., Yao, Z., Dai, Q., and Hu, H. Simmim: A simple framework for masked image modeling. arXiv, abs/2111.09886, 2021. +Xu, Q., Likhomanenko, T., Kahn, J., Hannun, A., Synnaeve, G., and Collobert, R. Iterative pseudo-labeling for speech recognition. Proc. of Interspeech, 2020. +Xue, L., Barua, A., Constant, N., Al-Rfou, R., Narang, S., Kale, M., Roberts, A., and Raffel, C. Byt5: Towards a token-free future with pre-trained byte-to-byte models. arXiv, abs/2105.13626, 2021. +Yang, Z., Dai, Z., Yang, Y., Carbonell, J., Salakhutdinov, R., and Le, Q. V. Xlnet: Generalized autoregressive pretraining for language understanding. arXiv, abs/1906.08237, 2019. +Zhang, Y., Qin, J., Park, D. S., Han, W., Chiu, C.-C., Pang, R., Le, Q. V., and Wu, Y. Pushing the limits of semi-supervised learning for automatic speech recognition. Proc. of NeurIPS SAS Workshop, 2020. +Zhou, J., Wei, C., Wang, H., Shen, W., Xie, C., Yuille, A., and Kong, T. ibot: Image bert pre-training with online tokenizer, 2021. + +Zhu, Y., Kiros, R., Zemel, R. S., Salakhutdinov, R., Urtasun, R., Torralba, A., and Fidler, S. Aligning books and movies: Towards story-like visual explanations by watching movies and reading books. arXiv, abs/1506.06724, 2015. + +# A. Extended speech processing results + +Table 6. Speech processing: word error rate on the Librispeech dev/test sets when training on the Libri-light low-resource labeled data setups of $10\mathrm{min}$ 1 hour, 10 hours and the clean 100h subset of Librispeech. Models use the audio of Librispeech (LS-960) as unlabeled data. + +
ModelUnlabeled dataLMdevtest
cleanothercleanother
10 min labeled
wav2vec 2.0 Base (Baevski et al., 2020b)LS-9604-gram8.915.79.115.6
Hubert Base (Hsu et al., 2021)LS-9604-gram9.115.09.715.3
data2vec BaseLS-9604-gram7.311.67.912.3
1h labeled
wav2vec 2.0 Base (Baevski et al., 2020b)LS-9604-gram5.010.85.511.3
Hubert Base (Hsu et al., 2021)LS-9604-gram5.610.96.111.3
data2vec BaseLS-9604-gram4.08.54.69.1
10h labeled
wav2vec 2.0 Base (Baevski et al., 2020b)LS-9604-gram3.89.14.39.5
Hubert Base (Hsu et al., 2021)LS-9604-gram3.99.04.39.4
data2vec BaseLS-9604-gram3.37.53.98.1
100h labeled
Noisy student (Park et al., 2020)LS-860LSTM3.98.84.28.6
IPL (Xu et al., 2020)LL-60K4-gram+Transf.3.26.13.77.1
SlimIPL (Likhomanenko et al., 2021)LS-8604-gram+Transf.2.24.62.75.2
wav2vec 2.0 Base (Baevski et al., 2020b)LS-9604-gram2.77.93.48.0
Hubert Base (Hsu et al., 2021)LS-9604-gram2.77.83.48.1
data2vec BaseLS-9604-gram2.26.42.86.8
+ +# B. Comparison of loss functions + +Table 7 shows that different choices of the loss function have a relatively small effect on final performance. +Table 7. Different pre-training losses on Librispeech dev-other (no language model). + +
WER
L217.1
L117.2
Smooth L1 (β = 0.08)17.2
Smooth L1 (β = 0.25)16.8
Smooth L1 (β = 0.5)16.8
Smooth L1 (β = 1)17.3
+ +# C. Speech masking parameter ablation + +Our method requires different masking parameters for each modality and this makes intuitive sense: masking $15\%$ of inputs is effective for text but not for images since text tokens are highly semantic and it is sufficient to mask a smaller proportion of the input to construct a useful task. We rely largely on settings from the literature, except for images, where we found that a higher masking rate compared to BEiT works slightly better. When we tried tuning masking hyperparameters for other + +modalities than vision, we did not see significant improvements (e.g., see Table 8) for speech. The small improvements we saw are likely to disappear after adding a language model. + +Table 8. Ablation of speech masking parameters. Results are on Librispeech dev-other without a language model. + +
WER
baseline (mask prob = 0.65, mask len = 10)17.1
mask prob = 0.817.2
mask prob = 0.517.3
mask len = 522.1
mask len = 1518.9
\ No newline at end of file diff --git a/data2vecageneralframeworkforselfsupervisedlearninginspeechvisionandlanguage/images.zip b/data2vecageneralframeworkforselfsupervisedlearninginspeechvisionandlanguage/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..7b89478a832b6e95333d8201e26bcd79b494041c --- /dev/null +++ b/data2vecageneralframeworkforselfsupervisedlearninginspeechvisionandlanguage/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:12e0f4ea1a36b7e4176688bded09fc2a8c5ac0b6f07834ceac23c722e79f059e +size 437371 diff --git a/data2vecageneralframeworkforselfsupervisedlearninginspeechvisionandlanguage/layout.json b/data2vecageneralframeworkforselfsupervisedlearninginspeechvisionandlanguage/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..724bd8ecbbf9d5da594b880db4499f423c0ad87e --- /dev/null +++ b/data2vecageneralframeworkforselfsupervisedlearninginspeechvisionandlanguage/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:46da22a44f5695b7514b1255943d71d74f714df350e7cfb78cf46177aee65874 +size 485596 diff --git a/pathgcnlearninggeneralgraphspatialoperatorsfrompaths/b9f2d68b-bf22-49cd-b41b-62f5b4af44f1_content_list.json b/pathgcnlearninggeneralgraphspatialoperatorsfrompaths/b9f2d68b-bf22-49cd-b41b-62f5b4af44f1_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..2d3202c4660039e292b795d6a89aec62d194945a --- /dev/null +++ b/pathgcnlearninggeneralgraphspatialoperatorsfrompaths/b9f2d68b-bf22-49cd-b41b-62f5b4af44f1_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:570f369086d7bc0f0c56fc356db3fb07621490caef688411965beb325b166a16 +size 101967 diff --git a/pathgcnlearninggeneralgraphspatialoperatorsfrompaths/b9f2d68b-bf22-49cd-b41b-62f5b4af44f1_model.json b/pathgcnlearninggeneralgraphspatialoperatorsfrompaths/b9f2d68b-bf22-49cd-b41b-62f5b4af44f1_model.json new file mode 100644 index 0000000000000000000000000000000000000000..b6367f890e9b11669877ab22f4f4701f6eef67ad --- /dev/null +++ b/pathgcnlearninggeneralgraphspatialoperatorsfrompaths/b9f2d68b-bf22-49cd-b41b-62f5b4af44f1_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:262df35cfbd9e1cf08f450a6fd5d9d02db01f5d43ef6312931a5ed112809b0e8 +size 122859 diff --git a/pathgcnlearninggeneralgraphspatialoperatorsfrompaths/b9f2d68b-bf22-49cd-b41b-62f5b4af44f1_origin.pdf b/pathgcnlearninggeneralgraphspatialoperatorsfrompaths/b9f2d68b-bf22-49cd-b41b-62f5b4af44f1_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..645e3d7be228e96edd250a22032d2b886620f4b7 --- /dev/null +++ b/pathgcnlearninggeneralgraphspatialoperatorsfrompaths/b9f2d68b-bf22-49cd-b41b-62f5b4af44f1_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:84b26345391c61a696d6d5eb3eea5721a529a7c70c9ee840750dcc257b9e3729 +size 2105740 diff --git a/pathgcnlearninggeneralgraphspatialoperatorsfrompaths/full.md b/pathgcnlearninggeneralgraphspatialoperatorsfrompaths/full.md new file mode 100644 index 0000000000000000000000000000000000000000..a4b8b100c1ddd25c7d2bd91064697f1d1e95bee7 --- /dev/null +++ b/pathgcnlearninggeneralgraphspatialoperatorsfrompaths/full.md @@ -0,0 +1,396 @@ +# Moshe Eliasof1 Eldad Haber2 Eran Treister1 + +# Abstract + +Graph Convolutional Networks (GCNs), similarly to Convolutional Neural Networks (CNNs), are typically based on two main operations - spatial and point-wise convolutions. In the context of GCNs, differently from CNNs, a pre-determined spatial operator based on the graph Laplacian is often chosen, allowing only the point-wise operations to be learnt. However, learning a meaningful spatial operator is critical for developing more expressive GCNs for improved performance. In this paper we propose pathGCN, a novel approach to learn the spatial operator from random paths on the graph. We analyze the convergence of our method and its difference from existing GCNs. Furthermore, we discuss several options of combining our learnt spatial operator with point-wise convolutions. Our extensive experiments on numerous datasets suggest that by properly learning both the spatial and point-wise convolutions, phenomena like over-smoothing can be inherently avoided, and new state-of-the-art performance is achieved. + +# 1. Introduction + +The study of Graph Convolutional Networks (GCNs) has gained large popularity in recent years (Bruna et al., 2013; Defferrard et al., 2016; Kipf & Welling, 2016; Bronstein et al., 2017; Monti et al., 2017) in a wide variety of fields and applications such as computer graphics and vision (Boscaini et al., 2016; Monti et al., 2017; Wang et al., 2018; Eliasof & Treister, 2020), Bioinformatics (Strokach et al., 2020; Jumper et al., 2021), node classification (Kipf & Welling, 2016; Chen et al., 2020; Chamberlain et al., 2021) and others. The common ingredient that most of the methods share + +$^{1}$ Department of Computer Science, Ben-Gurion University, Israel. $^{2}$ Department of Earth, Ocean and Atmospheric Sciences, University of British Columbia, Canada.. Correspondence to: Moshe Eliasof , Eran Treister . + +Proceedings of the $39^{th}$ International Conference on Machine Learning, Baltimore, Maryland, USA, PMLR 162, 2022. Copyright 2022 by the author(s). + +![](images/c74afd7c9742ef846ddac02f0001bd714f2aac0a078579cc03cae3d35fcb74ab.jpg) +Figure 1. The spatial operator induced by a smoothing kernel on different graphs. The vertex with dashed outline is the path origin. + +is the use of a pre-determined spatial operator, often times based on the graph Laplacian. While this choice is intuitive and effective, it induces limitations on the behaviour of GCNs. First, it is limited in the aspect of the expressiveness of the networks. Unlike CNNs (Krizhevsky et al., 2012; He et al., 2016; Howard et al., 2017), where both the spatial filters (e.g., $3 \times 3$ depth-wise convolutions) and point-wise $(1 \times 1)$ convolutions are learnt, here only the latter are left to be determined. Secondly, it is well known (Wu et al., 2019) that the Laplacian operator, when applied as in (Kipf & Welling, 2016) smoothes the input features, and therefore a recurrent application of it may lead to over-smoothing, resulting in typically shallow networks. This phenomenon is well documented and studied in the field of GCNs (Wu et al., 2019; Zhao & Akoglu, 2020; Chen et al., 2020; Chamberlain et al., 2021; Eliasof et al., 2021). In this work we propose pathGCN – a novel approach that overcomes the limitations above, based on aggregation from random paths defined over the graph vertices. We show that using this approach it is possible to define spatial operators similarly to the ones used in 2D convolutions on images. Such operators have variable aperture and coefficients that may increase the expressiveness of GCNs. In addition, since the coefficients of the operator are learnt, its eigenvalues can be rather different than those of the graph Laplacian. This implies that the learnt kernels can take different roles, from smoothing to edge-detecting (or sharpening) operators. An example of the effective spatial operators that are induced by the smoothing spatial kernel [0.8, 1.0, 0.6] is presented in Fig. 1, where we can see that the spatial operator is dependent both on the graph topology and the spatial kernel. + +We provide an analysis of our method to motivate our approach in Sec. 3, and present actual learnt kernels by our network in Fig. 4, which suggests that greater spatial flexibility is required to obtain better performance and to avoid over-smoothing, as reflected in our experiments in Sec. 4. + +Our contributions are as follows: + +- We introduce pathGCN - a novel approach for learning expressive spatial operators for GCNs from random paths. pathGCN supports several formulations, similarly to standard CNNs - ranging from a global to per layer and per channel learnt spatial operators. +- We provide an analysis of the behaviour of our pathGCN, and present a stochastic path training policy. +- Our experiments reveal the significance of the learnt spatial operator by obtaining and improving the state-of-the-art accuracy on various benchmarks, while also inherently preventing over-smoothing. + +# 2. Related work + +# 2.1. Graph convolutional networks + +Notations. Assume we are given an undirected graph defined as $\mathcal{G} = (\mathcal{V},\mathcal{E})$ where $\mathcal{V}$ is a set of $n$ vertices (nodes) and $\mathcal{E}$ is a set of $m$ edges. Let us denote by $\mathbf{f}_i\in \mathbb{R}^c$ the feature vector that resides at the $i$ -th node of $\mathcal{G}$ with $c$ being the number of channels. Also, we denote the adjacency matrix $\mathbf{A}$ , where $\mathbf{A}_{ij} = 1$ if there exists an edge $(i,j)\in \mathcal{E}$ and the diagonal degree matrix $\mathbf{D}$ where $\mathbf{D}_{ii}$ equals to the degree of the $i$ -th node. The graph Laplacian is given by $\mathbf{L} = \mathbf{D} - \mathbf{A}$ , and its symmetric normalized formulation reads $\mathbf{L}^{sym} = \mathbf{I} - \mathbf{D}^{-\frac{1}{2}}\mathbf{A}\mathbf{D}^{-\frac{1}{2}}$ where $\mathbf{I}$ is the identity operator. Let us also denote the adjacency and degree matrices after adding a self-loop to the nodes by $\tilde{\mathbf{A}}$ and $\tilde{\mathbf{D}}$ respectively, and accordingly define the normalized Laplacian of $\mathcal{G}$ with added self-loops by $\tilde{\mathbf{L}}^{sym} = \mathbf{I} - \tilde{\mathbf{D}}^{-\frac{1}{2}}\tilde{\mathbf{A}}\tilde{\mathbf{D}}^{-\frac{1}{2}}$ . It follows that the spatial operation from GCN (Kipf & Welling, 2016), induced by the graph Laplacian is given by $\tilde{\mathbf{P}} = \mathbf{I} - \tilde{\mathbf{L}}^{sym}$ . We refer the readers to (Wu et al., 2019) for more information. + +The spatial operator in GCNs. GCNs typically involve two main ingredients: spatial and point-wise $(1 \times 1)$ convolutions to mix the channels. The majority of GCNs employ a spatial operator based on the graph Laplacian, followed by a point-wise convolution. For example, GCN (Kipf & Welling, 2016) is given by: + +$$ +\mathbf {f} ^ {(l + 1)} = \sigma \left(\mathbf {S} ^ {(l)} \mathbf {f} ^ {(l)} \mathbf {W} ^ {(l)}\right) \tag {1} +$$ + +where $\mathbf{S}^{(l)} = \tilde{\mathbf{P}}$ , and $\mathbf{W}^{(l)}$ is a $1 \times 1$ convolution operator. The combination of the operator $\tilde{\mathbf{P}}$ and a learnable $1 \times 1$ convolution continued in a series of works (Wu et al., 2019; Chen et al., 2020; Zhou et al., 2021). For instance, the spatial operation in GCNII (Chen et al., 2020) can be obtained by replacing $\mathbf{S}^{(l)}$ with: + +$$ +\mathbf {S} ^ {(l)} \left(\mathbf {f} ^ {(l)}, \mathbf {f} ^ {(0)}\right) = (1 - \alpha^ {(l)}) \tilde {\mathbf {P}} \mathbf {f} ^ {(l)} + \alpha^ {(l)} \mathbf {f} ^ {(0)}, \tag {2} +$$ + +with $\alpha^{(l)}\in [0,1]$ being a hyper-parameter and $\mathbf{f}^{(0)}$ are the features of the first (embedding) layer, which is also similar to APPNP (Klicpera et al., 2019). Another recent example is EGNN (Zhou et al., 2021) which performs + +$$ +\mathbf {S} ^ {(l)} \left(\mathbf {f} ^ {(l)}, \mathbf {f} ^ {(0)}\right) = \left(1 - c _ {\min }\right) \tilde {\mathbf {P}} \mathbf {f} ^ {(l)} + \alpha \mathbf {f} ^ {(l)} + \beta \mathbf {f} ^ {(0)}, \tag {3} +$$ + +where $c_{min} = \alpha +\beta$ , and $\alpha, \beta$ are learnt scalars. While the methods above achieve impressive accuracy, they are still limited in their spatial expressiveness due to their dependence on $\tilde{\mathbf{P}}$ , which may lead to sub-optimal performance. + +On the other hand, there are methods that allow the freedom of learning a rich spatial operator. For example, ChebNet (Defferrard et al., 2016) learns dense convolutions through polynomial parameterization of the graph Laplacian. While from a conceptual perspective, ChebNet should be able to learn diverse operators and prevent over-smoothing, it still exhibits a degradation in performance when adding more layers, as discussed in (Levie et al., 2018) and according to our experiments as presented in Fig. 3. In addition, GDC (Gasteiger et al., 2019) propose to impose constraints on the filters of ChebNet to obtain diffusion kernels. Another network to consider is MoNet (Monti et al., 2017), which learns local patch operators by a mixture of Gaussian. While the Gaussian parameterization can yield more expressive kernels and favourable results compared to GCN (Kipf & Welling, 2016), it is more computationally demanding and challenging to train as more layers are stacked. + +# 2.2. Random walk on graphs + +The concept of random walk is useful in many applications and domains, from graph node classification (Perozzi et al., 2014; Nikolentzos & Vazirgiannis, 2020) to RNA disease association (Lei & Bian, 2020) and mesh denoising (Sun et al., 2008). In the context of graphs in machine and deep learning, multiple methods utilized random walks for different purposes. DeepWalk (Perozzi et al., 2014) is a two-step algorithm for node embedding learning, based on random walks and the SkipGram (Mikolov et al., 2013) method. RWGNN (Nikolentzos & Vazirgiannis, 2020) learns a set of hidden graphs which are then compared with an input graph using a differentiable mutual random walk counting procedure. Our approach is different as we utilize the random walk to effectively sample paths, and employ them to learn a spatial operator by the means of a convolution kernel. Another difference is that RGWNN considers the graph classification problem, as it employs the random walk kernel which is a scalar binary function of two graphs, whose output discards the notion of the graph itself. Therefore, it is not straight-forward to use it for node classification tasks. The recent PAN (Ma et al., 2020) parameterizes the convolution kernel by a polynomial of the adjacency matrix, where the coefficients are the learnt parameters, motivated by path integral theory. However, as its formulation consists of + +learning non-negative weights, it is prone to over-smoothing and reduced expressiveness. Another related work that uses random walk strategy is GraphSAGE (Hamilton et al., 2017) where neighbourhood sampling of $k$ hops is performed. This method is based on two steps in which an aggregation from two subsequent hops is performed, followed by a $1 \times 1$ convolution. This is different than ours, as we first extract the complete path, and learn a convolution kernel based on the original information along this path, while the former iteratively aggregates from subsequent hops. + +# 3. Method + +# 3.1. Learning spatial operators + +In this section we motivate the need for learnt spatial operators. To do that, let us first consider a standard CNN where the data resides on a simple uniform mesh-grid. We note that CNNs and GCNs both represent data with geometrical features. However, while CNNs are networks that operate on a simple mesh-grid graph where pixels (nodes) are linked based on their location, and the local geometry of the graph is fixed, GCNs can be thought of as unstructured meshes where the local geometry varies. + +Given a feature tensor $\mathbf{f} \in \mathbb{R}^{n \times c}$ , the convolution in CNNs denoted by $\mathbf{Kf}$ , is a linear operation where each input channel and each output channel has its own spatial operator. Thus, each linear operator $\mathbf{K}$ consists of $c \times c$ different spatial convolutions represented by the tensor $\mathbf{K}$ . Furthermore, the convolutions can have a variable aperture (i.e., kernel size) obtaining a larger field of view, and are typically learnt per-layer, yielding a highly expressive set of operators. + +In contrast, many popular and recent GCNs (Kipf & Welling, 2016; Wu et al., 2019; Chen et al., 2020; Chamberlain et al., 2021; Zhou et al., 2021) and others employ a pre-determined spatial operator, often times guided by the graph Laplacian which is determined solely by the topology of the graph $\mathcal{G}$ , coupled with a $1 \times 1$ convolution to mix the channels. Therefore, by comparing GCNs to CNNs it is notable that the former have significantly fewer degrees of freedom with respect to their spatial operation. Indeed, 2D CNNs with a spatial kernel of size $k$ and $c$ channels optimize $c \times c \times k \times k$ parameters, while GCNs typically only optimize the $1 \times 1$ convolution, yielding $c \times c$ parameters. In addition to the possible expressiveness issue, the frequent of the graph Laplacian can lead to undesired phenomena such as oversmoothing (Wu et al., 2019; Zhao & Akoglu, 2020; Chen et al., 2020). Some attempts to overcome the expressiveness limitation consider using polynomials of the graph Laplacian, stabilizing them by constructing a Chebyshev basis (Defferrard et al., 2016). However, it imposes high computational cost due to the frequent computations of the Chebyshev polynomial and fully-connected convolution fil + +ters. Furthermore, it is difficult to train such a network due to its eigenvalues distribution, as demonstrated in (Levie et al., 2018). With respect to the over-smoothing phenomenon, various techniques were proposed (Zhao & Akoglu, 2020; Chen et al., 2020; Rong et al., 2020). While those methods indeed aid the over-smoothing issue, they do not inherently change the smoothing behaviour of GCNs, but rather ease the smoothing process. + +In what follows, we present a methodology that allows the construction of a graph convolution that is similar to the standard convolution on a regular mesh grid which allows greater expressiveness and inherently does not over-smooth. + +# 3.2. From fixed to variable spatial operator + +The non-constant topology of the graph is the major obstacle in generating a meaningful spatial convolution in GCNs. We now show that this can be addressed by using random walks. + +To this end, we consider a path on the graph, on which the weights that parameterize the spatial operator are learnt. Therefore, a transition function that dictates some traversal strategy on the graph is required in order to obtain a path like input to our network. Specifically, we adopt the graph random walk generator from node2vec (Grover & Leskovec, 2016), as implemented in PyTorch-Geometric (Fey & Lenssen, 2019), for its simplicity and efficient implementation. We note, however, that a different transition function could also be used or learnt. + +Assume first that we have a single channel feature tensor $\mathbf{f} \in \mathbb{R}^{n \times 1}$ , and a path of length $k$ is given. Let us denote the learnt spatial parameters by $\mathbf{s} \in \mathbb{R}^k$ , and let $y_j = (j_0, \dots, j_{k-1})$ be a tuple of node indices of a single random path of nodes of length $k$ , starting from node $j_0 = j$ . The convolution over a single path for the $j$ -th node is defined by the following linear operator: + +$$ +\mathbf {K} _ {y _ {j}} (\mathbf {s}) \mathbf {f} = \sum_ {i = 0} ^ {k - 1} s _ {i} f _ {j _ {i}}. \tag {4} +$$ + +That is, the features of the nodes on the path $y_{j}$ are weighted by the corresponding learnt parameter in $\mathbf{s}$ , and summed to get the feature of the $j$ -th node—the node where the path originates from. + +More generally, instead of considering a single path, let us sample $p$ different paths, and accordingly define the paths convolution as the average over all sampled paths + +$$ +\mathbf {K} _ {\mathcal {Y} _ {j}} (\mathbf {s}) \mathbf {f} = \frac {1}{p} \sum_ {y _ {j} \in \mathcal {Y} _ {j}} \mathbf {K} _ {y _ {j}} (\mathbf {s}) \mathbf {f} \tag {5} +$$ + +where $y_{j}\in \mathcal{V}_{j}$ is a path from a set of $p$ random walks starting from the $j$ -th node. + +![](images/704c92d593ea4126aa19b2e50b07c83fd6a28cac94ee300d3c14a929e9c05b7e.jpg) +Figure 2. The effective spatial operator from a walk of length 3 starting at the dashed node, ranging from 1 to 1000 random walks. + +![](images/d6e09aa41c2f5bb0c9339ce6dc2851ba7088406aa817ea27196821ecfcc844c1.jpg) + +![](images/f183f089601999a5b2356a5eaa7b8d95514ac686dd6a5cd6d40737de86d024b8.jpg) + +![](images/5cc67e1bdbbe389616a9616418b24b6e8f53b8809c77cda3309075c416787a5f.jpg) + +![](images/b9a4da272fc4e2a05f34613cc3515cea596909fa870e9083a773ee31eef35c0e.jpg) + +![](images/04c9490a2f20fa801a1c54964a9ae6704ad0a64eb85aad7f8875543bb500e0cb.jpg) + +![](images/43103508d57351b2784230fa2e4f89c488fbb7d2b669bc33bc5d5921c6b83b64.jpg) + +# 3.3. Constructing pathGCN + +So far we defined the path convolution, which operates in the spatial domain. In what follows, we omit s for brevity, and denote by $\mathbf{K}_{\mathcal{V}}$ the pathConv module described in Eq. (5) on all the nodes in $\mathcal{V}$ given their corresponding path realizations $\mathcal{V}$ . To obtain a complete network, we need to add the channel mixing convolution and the non-linear activation $\sigma$ , as follows + +$$ +\mathbf {f} ^ {(l + 1)} = \sigma \left(\mathbf {W} ^ {(l)} \mathbf {K} _ {\mathcal {Y}} ^ {(l)} \mathbf {f} ^ {(l)}\right), \tag {6} +$$ + +where in our implementation $\sigma$ is ReLU and $\mathbf{W}^{(l)}$ is a $1\times 1$ (i.e., point-wise) convolution. The simplest utilization of pathConv applies a single spatial operator parameterized by $\mathbf{s}\in \mathbb{R}^k$ , shared among all channels and all $L$ layers. While this is more flexible than using $\tilde{\mathbf{P}}$ as in Eq. (1), it can be further generalized. Scaling up, it is also possible to learn a different parameterization of the spatial operator per layer, that is, $\mathbf{s}\in \mathbb{R}^{L\times k}$ . In practice and inspired by modern CNNs (Sandler et al., 2018; Ephrath et al., 2020), we found that learning a depth-wise spatial operator (i.e., a spatial operator per channel and layer such that $\mathbf{s}\in \mathbb{R}^{L\times c\times k}$ ) followed by a $1\times 1$ convolution leads to favorable performance both accuracy- and computationally-wise across all the considered data sets in this paper, as reflected in our experiments in Sec. 4. We refer to this architecture as pathGCN. We note that it is also possible to learn different spatial operators for all pairs of channels, per layer - similarly to a standard fully-connected CNN. + +Finally, learning the spatial convolution allows for a variety of operators, from non-smoothing (e.g., edge-detection filters) to smoothing operators. Thus, as we demonstrate in the experiments section, our network achieves state-of-the-art performance, and does not suffer from over-smoothing. + +# 3.4. Convergence analysis + +The process defined in Eq. (4)-(5) represents a simple stochastic process to build a spatial operation for a single channel that depends on two quantities. First, it depends on the algorithm used to sample the set of paths $\mathcal{V}$ , and second, it depends on the learnt weights $s$ . A natural question that + +arises is - does this process converge, and to what? To answer this question we need to make a mild assumption on the random walk process. Namely, we assume that the process is Markovian, that is, at each state the walk can visit any neighbouring node of the current node at an equal probability. In the following, we show that at the sampling limit (i.e., $p \to \infty$ ), there exists a stationary distribution of the paths, which induces a spatial operator sampled by our method, as exemplified in Fig. 2. + +Let us consider the simple case of a convolution on a general path of length 2, which can be written as + +$$ +\mathbf {K} _ {y _ {j}} (\mathbf {s}) \mathbf {f} = s _ {0} f _ {j _ {0}} + s _ {1} f _ {j _ {1}} = s _ {0} f _ {j} + s _ {1} f _ {j _ {1}}. \tag {7} +$$ + +The second transition follows from the fact that the path originates from the $j$ -th node, i.e., $f_{j_0} = f_j$ . Note, that $j_1$ can represent any of the immediate neighbours of the $j$ -th node. Therefore, the expectation of (7) which corresponds to all the nodes $\mathcal{V}$ is given by + +$$ +\mathbb {E} _ {y} \left(\mathbf {K} _ {y} (\mathbf {s}) \mathbf {f}\right) = s _ {0} \mathbf {f} + s _ {1} \left(\mathbf {A D} ^ {- 1}\right) \mathbf {f} \tag {8} +$$ + +where $\mathbf{A}$ is the adjacency matrix and $\mathbf{D}$ is a diagonal matrix with the degree of each node. + +More generally, let us consider a path of an arbitrary length $k$ . In this case we have that the expectation term reads + +$$ +\mathbb {E} _ {y} \left(\mathbf {K} _ {y} (\mathbf {s}) \mathbf {f}\right) = \left(\sum_ {i = 0} ^ {k - 1} s _ {i} \left(\mathbf {A D} ^ {- 1}\right) ^ {i}\right) \mathbf {f} \tag {9} +$$ + +where $(\mathbf{AD}^{-1})^0 = \mathbf{I}$ . We note that the transition matrix $\mathbf{AD}^{-1}$ is column-stochastic, and therefore its eigenvalues are bounded between $[-1, 1]$ . Thus, this polynomial formulation is stable and does not diverge for an appropriate choice of coefficients $\mathbf{s}$ . + +Furthermore, Eq. (9) is a deterministic representation of the process given in Eq. (5). If the number of path-realizations, $p$ is large then the results from both are similar. For short paths, a direct evaluation of Eq. (9) can be computationally advantageous compared to its stochastic implementation. However, for long paths, computing the powers of the adjacency matrix times a vector can be expensive. The average + +over paths is, in this case, an economical way to approximate the process, avoiding repeated matrix multiplications. + +Lastly, as we show in our experiments, the stochastic nature of the process has additional advantages. In particular, it allows for better trainability and generalization, compared to the deterministic form. Indeed, a significant increase in the value of $p$ causes performance degradation, as reported in Fig. 5. For inference purposes, we may use both the stochastic or deterministic formulations from Eq. (5) and (9) respectively, yielding similar results for both. + +# 3.5. Computational cost and number of parameters + +We compare the cost of our pathGCN with the methods considered in Eq. (1)-(3). On the spatial side, our pathGCN involves $n \times k \times p$ operations rather than $n \times d$ for the considered methods, where $d$ is the mean node degree of the graph. Therefore, if $k \times p$ is larger than $d$ , our method requires more computations. Nonetheless, our pathGCN has a wider aperture as it considers paths of $k$ nodes, thus its field of view is larger. We also compare the number of trainable parameters, which further highlights the difference of our approach. Recall that our pathGCN learns the spatial operator in addition to a $1 \times 1$ convolution, which is also present in other methods. That is, per pathGCN layer, the spatial weights that parameterize $\mathbf{K}_y$ require $c \times k$ parameters, while the $1 \times 1$ convolution $\mathbf{W}$ requires $c \times c$ parameters, where typically $k$ is significantly smaller than $c$ . In our experiments, different values of $k$ and $p$ were examined, and we found that setting $k$ between 3 to 7 and $p$ between 5 to 10 achieves better or on par with state-of-the-art models while keeping the computational cost reasonable. + +We also consider the stochastic implementation of a random walk over an arbitrary graph. Sampling a single path of length $k$ for all nodes in $\mathcal{V}$ requires $n \times k$ operations1. Therefore, if the number of paths $p$ is smaller than the average node degree $d$ of the graph, then the cost of random walk sampling is smaller than the cost of applying the adjacency matrix as in (9). Furthermore, in the deterministic case, a spatial operation on a path of length 2 requires $n \times d$ computations. Extending it to a path of length $k$ requires $n \times d \times (k - 1)$ operations, realized by polynomials of degree $k - 1$ of the adjacency matrix. We note that Eq. (9), which is the deterministic form of our method, can also be used for inference purposes. + +# 4. Experiments + +We demonstrate our pathGCN on node classification and protein-protein interaction (Hamilton et al., 2017), followed by an ablation study in order to gain a profound understand- + +Table 1. Node classification datasets statistics. + +
DatasetClassesNodesEdgesFeatures
Cora72,7085,4291,433
CiteSeer63,3274,7323,703
Pubmed319,71744,338500
Chameleon52,27736,1012,325
Cornell51832951,703
Texas51833091,703
Wisconsin52514991,703
PPI12156,944818,71650
Wiki-CS1011,701216,123300
Actor57,60033,544932
Ogbn-arxiv40169,3431,166,243128
+ +Table 2. Summary of semi-supervised node classification accuracy (%) + +
MethodCoraCiteseerPubmed
ChebNet81.269.874.4
GCN81.170.879.0
GAT83.170.878.5
APPNP83.371.880.1
JKNET81.169.878.1
GCNII85.573.480.3
GRAND84.773.681.0
PDE-GCN84.375.680.6
EGNN85.7-80.1
pathGCN (Ours)85.875.882.7
+ +ing of our method. In all experiments, we employ a network that is comprised of an embedding layer ( $1 \times 1$ convolution), followed by a sequence of pathGCN layers, whose final output is fed to a $1 \times 1$ convolution layer which acts as a classifier. A detailed description of the network architecture is given in Appendix A. We use the Adam (Kingma & Ba, 2014) optimizer in all experiments, and perform grid search over the hyper-parameters of our network. The selected hyper-parameters are reported in Appendix B. The objective function in all experiments is the cross-entropy loss, besides inductive learning on PPI where we use the binary cross-entropy loss. Our code is implemented using PyTorch (Paszke et al., 2019) and PyTorch-Geometric (Fey & Lenssen, 2019) and trained on an Nvidia Titan RTX GPU. + +We show that for all the considered tasks and datasets, whose statistics are provided in Tab. 1, our method is either better or on par with other state-of-the-art models. + +![](images/d4af74e0a34c82ac54d8580ab342c1e0f847cddddf4e8e6b647cf0320ff4ed3a.jpg) +Figure 3. ChebNet vs pathGCN on semi-supervised node classification. + +# 4.1. Semi-supervised node classification + +Here, we use three datasets - Cora, Citeseer and Pubmed (Sen et al., 2008). For all datasets we use the standard training/validation/testing split as in (Yang et al., 2016), with 20 nodes per class for training, 500 validation nodes and 1,000 testing nodes and follow the training scheme of (Chen et al., 2020). For comparison, we consider various models like ChebNet (Defferrard et al., 2016), GCN (Kipf & Welling, 2016), GAT(Veličković et al., 2018), Inception (Szegedy et al., 2017), APPNP (Klicpera et al., 2019), JKNet (Xuet al., 2018), DropEdge (Rong et al., 2020), GCNII(Chenet al., 2020), GRAND (Chamberlain et al., 2021), PDE-GCN (Eliasof et al., 2021) and EGNN (Zhou et al., 2021). + +As discussed in Sec. 3, our pathGCN is constructed such that wider spatial operators are obtained, allowing for improved expressiveness, namely, compared to methods that are based on the graph Laplacian or its proxies. As objectively portrayed by Tab. 2 and 3, our pathGCN is capable of obtaining higher accuracy on all three datasets. A bold improvement is obtained on Pubmed, where an accuracy of $82.7\%$ is achieved, compared to previously state-of-the-art $\mathrm{GRAND}_{\mathrm{nl - rw}}$ with $81.0\%$ . Our approach also benefits from the inherent absence of over-smoothing, as the spatial operator is fully learnt. This is also validated by inspecting the learnt kernels of different layers of the network. Indeed, as shown in Fig. 4, some layers perform smoothing by averaging, while others act as edge-detection filters by considering the difference of neighbouring nodes along the path. + +# 4.2. Fully-supervised node classification + +To further validate our method, we employ a total of 10 datasets. First, we follow (Pei et al., 2020) and examine our pathGCN on Cora, Citeseer, Pubmed, Chameleon (Rozemberczki et al., 2021), Cornell, Texas and Wisconsin. We also use the same train/validation/test splits of $60\%$ , $20\%$ , $20\%$ , + +Table 3. Semi-supervised node classification accuracy $(\%)$ . - indicates not available results. + +
DatasetMethodLayers
248163264
CoraGCN81.180.469.564.960.328.7
GCN (Drop)82.882.075.875.762.549.5
JKNet-80.280.780.281.171.5
JKNet (Drop)-83.382.683.082.583.2
Incep-77.676.581.781.780.0
Incep (Drop)-82.982.583.183.183.5
GCNII82.282.684.284.685.485.5
GCNII*80.282.382.883.584.985.3
PDE-GCND82.083.684.084.284.384.3
EGNN83.2--85.4-85.7
pathGCN (Ours)84.284.584.685.185.485.8
CiteSeerGCN70.867.630.218.325.020.0
GCN (Drop)72.370.661.457.241.634.4
JKNet-68.767.769.868.263.4
JKNet (Drop)-72.671.872.670.872.2
Incep-69.368.470.268.067.5
Incep (Drop)-72.771.472.572.671.0
GCNII68.268.870.672.973.473.4
GCNII*66.166.770.672.073.273.1
PDE-GCND74.675.075.275.575.675.5
pathGCN (Ours)74.374.875.475.375.675.8
PubmedGCN79.076.561.240.922.435.3
GCN (Drop)79.679.478.178.577.061.5
JKNet-78.078.172.672.474.5
JKNet (Drop)-78.778.779.779.278.9
Incep-77.777.974.9--
Incep (Drop)-79.578.679.0--
GCNII78.278.879.380.279.879.7
GCNII*77.778.278.880.379.880.1
PDE-GCND79.380.680.180.480.280.3
EGNN79.2--80.0-80.1
pathGCN (Ours)81.881.882.482.582.482.7
+ +respectively, and report the average performance over 10 random splits from (Pei et al., 2020). We fix the number of channels to 64 and perform grid search to determine the hyper-parameters. We compare our network with GCN, GAT, Geom-GCN (Pei et al., 2020), APPNP, JKNet, Inception, GCNII and PDE-GCN in Tab. 4. Our experiments read improvement across all data-sets compared to all the considered methods. For instance, we obtain $90.02\%$ accuracy on Cora with our pathGCN, compared to $88.49\%$ of GCNII* and $88.60\%$ of PDE-GCN. In addition, we examine our pathGCN on larger datasets using the standard train/validation/test splits of Actor (Pei et al., 2020), Ogbn-axiv (Hu et al., 2020) and Wiki-CS (20 random splits) (Mernyei & Cangea, 2020) in Tab. 5 and 6 – where again we see accuracy improvement across all considered datasets. + +![](images/7246d47e626ffc29528d6e83962ef558c5ecab9c5171f8ceeb1069e290ece7bf.jpg) +Figure 4. A visualization of the learnt spatial operator $\mathbf{K}_{\mathcal{V}}$ from a 8-layer pathGCN trained on Cora, applied on the dashed node in the graph (top), and its corresponding learnt weights (bottom). + +Table 4. Fully-supervised node classification accuracy $(\%)$ . (L) denotes the number of layers. + +
MethodCoraCite.Pubm.Cham.Corn.TexasWisc.
GCN (Kipf & Welling, 2016)85.7773.6888.1328.1852.7052.1645.88
GAT (Veličković et al., 2018)86.3774.3287.6242.9354.3258.3849.41
Geom-GCN-I (Pei et al., 2020)85.1977.9990.0560.3156.7657.5858.24
Geom-GCN-P (Pei et al., 2020)84.9375.1488.0960.9060.8167.5764.12
Geom-GCN-S (Pei et al., 2020)85.2774.7184.7559.9655.6859.7356.67
APPNP (Klicpera et al., 2019)87.8776.5389.4054.3073.5165.4169.02
JKNet (Xu et al., 2018)85.25 (16)75.85 (8)88.94 (64)60.07 (32)57.30 (4)56.49 (32)48.82 (8)
JKNet (Drop) (Rong et al., 2020)87.46 (16)75.96 (8)89.45 (64)62.08 (32)61.08 (4)57.30 (32)50.59 (8)
Incep (Drop) (Rong et al., 2020)86.86 (8)76.83 (8)89.18 (4)61.71 (8)61.62 (16)57.84 (8)50.20 (8)
GCNII (Chen et al., 2020)88.49 (64)77.08 (64)89.57 (64)60.61 (8)74.86 (16)69.46 (32)74.12 (16)
GCNII* (Chen et al., 2020)88.01 (64)77.13 (64)90.30 (64)62.48 (8)76.49 (16)77.84 (32)81.57 (16)
PDE-GCN(M(Eliasof et al., 2021)88.60 (16)78.48 (32)89.93 (16)66.01 (16)89.73 (64)93.24 (32)91.76 (16)
pathGCN (Ours)90.02 (64)78.95 (32)90.42 (64)66.79 (16)91.35 (8)95.14 (16)93.53 (16)
+ +Table 5. Fully-supervised node classification accuracy $(\%)$ + +
MethodActorOgbn-arxiv
GCN (Kipf & Welling, 2016)26.8671.74
GAT (Veličković et al., 2018)28.4571.89
APPNP (Klicpera et al., 2019)31.2671.82
Geom-GCN-P (Pei et al., 2020)31.63-
JKNet (Xu et al., 2018)29.8172.19
SGC (Wu et al., 2019)30.9869.20
GCNII (Chen et al., 2020)32.8772.74
EGNN (Zhou et al., 2021)-72.70
GRAND (Chamberlain et al., 2021)-72.23
pathGCN (Ours)37.5472.83
+ +# 4.3. Inductive learning + +We employ the PPI dataset (Hamilton et al., 2017) for the inductive learning task. We use a 8 layer pathGCN, without weight-decay, dropout of 0.2 and a learning rate of 0.001. We compare our results with various methods like GraphSAGE, GAT, JKNet, GeniePath, Cluster-GCN, GCNII and others, and present the micro-averaged F1 score in in Tab. + +Table 6. Node classification on Wiki-CS. + +
MethodAccuracy (%)
GCN (Kipf & Welling, 2016)77.19
GAT (Veličković et al., 2018)77.65
SuperGAT (Kim & Oh, 2020)77.90
APPNP (Klicpera et al., 2019)79.84
pathGCN (Ours)80.02
+ +7. We note that our pathGCN achieves a score of 99.61, superior to methods like GAT, JKNet, GeniePath, PDE-GCN, and slightly above GCNII* with a score of 99.58. + +# 4.4. Graph classification + +Our previous experiments considered various datasets and settings of the node classification task. To further demonstrate the efficacy of our pathGCN we experiment with graph classification on the popular TUDatasets (Morris et al., 2020). We follow the same experimental settings from (Xu et al., 2019) and report the 10 fold cross-validation performance on MUTAG, PTC, PROTEINS and NCI1 datasets. The hyper-parameters are determined by grid search, as + +Table 7. Inductive learning on PPI dataset. Results are reported in micro-averaged F1 score. + +
MethodMicro-averaged F1
GraphSAGE (Hamilton et al., 2017)61.20
VR-GCN (Chen et al., 2018)97.80
GaAN (Zhang et al., 2018a)98.71
GAT (Veličković et al., 2018)97.30
JKNet (Xu et al., 2018)97.60
GeniePath (Liu et al., 2018)98.50
Cluster-GCN (Chiang et al., 2019)99.36
GCNII (Chen et al., 2020)99.54
GCNII* (Chen et al., 2020)99.58
PDE-GCNM (Eliasof et al., 2021)99.18
pathGCN (ours)99.61
+ +Table 8. TUDatasets graph classification accuracy $(\%)$ + +
ModelMUTAGPTCPROTEINSNCI1
DGCNN85.8±1.858.6±2.575.5±0.974.4±0.5
IGN83.9±13.058.5±6.976.6±5.574.3±2.7
GIN89.4±5.664.6±7.076.2±2.882.7±1.7
CIN92.7±6.168.2±5.677.0±4.383.6±1.4
GSN92.7±7.568.2±7.276.6±5.083.5±2.0
pathGCN (ours)94.7±4.775.2±5.380.4±4.283.3±1.3
+ +in (Xu et al., 2019) and are reported in Appendix B. We compare our pathGCN with recent methods like DGCNN (Zhang et al., 2018b), IGN (Maron et al., 2018),GIN (Xu et al., 2019), CIN (Bodnar et al., 2021) and GSN (Bouritsas et al., 2022). The results are summarized in Tab. 8, where our pathGCN shows better or similar results compared to the considered methods, further highlighting the efficacy of our approach. + +# 4.5. Inference and runtimes + +In this section we compare the inference accuracy of our stochastic approach with its deterministic form. Later, we report the runtimes of our method. + +As discussed in Sec. 3.4, both the stochastic and deterministic forms of our pathGCN can be used during inference. In Tab. 9, we show that after training our stochastic pathGCN, it is possible to obtain similar results (with up to $0.1\%$ accuracy difference) by its deterministic form as in Eq. (9). The stochastic results are averaged over 10 inference runs, and we also present their standard deviation. + +Next, we present the training and inferences times, as well as path sampling time of our pathGCN and compare it with + +Table 9. Deterministic vs stochastic pathGCN inference accuracy $(\%)$ + +
InferenceCoraCite.Pub.ogbn-arxivWisc.PPI
Determin.85.875.882.772.8493.5199.61
Stochastic85.875.882.772.8393.5399.61
±0.29±0.34±0.34±0.13±0.21±0.02
+ +Table 10. Computation times (in ms) on Cora. + +
ModelPath samp.TrainingInferenceAcc (%)
GCN (2 layers)-4.071.9781.1
GCNII (2 layers)-4.241.9582.2
GCNII (8 layers)-13.056.8784.2
GAT (2 layers)-5.271.9683.1
pathGCNk=2,p=5 (2 layers)0.3783.481.6781.3
pathGCNk=5,p=5 (2 layers)0.3845.352.1784.2
+ +GCN, GCNII and GAT, in Tab. 10. For reference, we also report the node classification accuracy of the different methods. We see that the sampling time is relatively small, and that our pathGCN has a similar runtime to GCN, GCNII and GAT, while obtaining similar or better accuracy. For example, our pathGCN with $k = 5$ , $p = 5$ obtains an accuracy of $84.2\%$ on Cora and requires 5.35 milliseconds (ms) for a training iteration, while GCNII requires 8 layers and 13.05 ms to achieve the same accuracy. + +# 4.6. Ablation study + +In this section we consider the different possible variants of our pathGCN, and the influence of our its hyper-parameters the path length $k$ and the number of paths $p$ . + +As discussed in Sec. 3, our method can be formulated in various manners. That is, it is possible to learn a global spatial operator, which is most similar to GCN (Kipf & Welling, 2016), only there it is fixed and not learnt. We denote this variant by pathGCN $_G$ . In addition, we can learn a spatial operator per layer that is shared among the channels, denoted by pathGCN $_{PL}$ . The next step is our pathGCN from Sec. 3.3, which is more similar to CNNs, by utilizing a depth-wise spatial operator (i.e., per channel and layer). As depicted in Tab. 11, the global variant, pathGCN $_G$ yields the least attractive performance among the three considered variants. This is not surprising, as a global operator is learnt, which is less expressive than pathGCN $_{PL}$ and pathGCN. Still, it is interesting to see that no over-smoothing is evident. As discussed in (Wu et al., 2019), a recurrent application of a fixed operator leads to over-smoothing. However, the learnt spatial operator of pathGCN $_G$ is variable. Following that, the per layer variant, pathGCN $_{PL}$ prevents over-smoothing and also further improves accuracy. This is obtainable as the network has the freedom to learn a variety of kernels, which may function as smoothing kernels or edge detectors. + +![](images/5275f2b660d59887b3f73702244eac0cc343bac749fb7d83f4a5caff73ea1339.jpg) +Figure 5. Semi-supervised node classification accuracy $(\%)$ , as a function of number of paths $p$ and path length $k$ . + +![](images/7e9dcc05fd08ce173e132cccb3bade500c974a769c3ff5a3ed52788491fb5232.jpg) + +Table 11. Variants of pathGCN on semi-supervised classification. Results are reported in accuracy $(\%)$ + +
DatasetMethodLayers
248163264
CorapathGCNG83.081.981.581.281.482.0
pathGCNPL82.983.383.583.884.184.7
pathGCN84.284.584.685.185.485.8
CiteSeerpathGCNG73.171.972.071.972.671.7
pathGCNPL73.473.674.074.374.575.0
pathGCN74.374.875.475.375.675.8
PubmedpathGCNG80.980.481.181.080.480.8
pathGCNPL81.181.281.582.082.282.1
pathGCN81.881.882.482.582.482.7
+ +Finally, we see that the additional degrees of freedom in the depth-wise operator in pathGCN lead to overall better performance, also as depicted in our other experiments. + +As for the hyper-parameters of our method, we report in Fig. 5 the influence of the number of paths $p$ and path length $k$ on the performance of our pathGCN on semi-supervised node classification using Cora, CiteSeer and Pubmed. In all the experiments we use a 2 layer pathGCN, fix one hyperparameter, and vary the other. Specifically, for the evaluation of the influence of number of paths $p$ , we fix the path length to $k = 5$ , and the results in Fig. 5 suggest that indeed the stochastic nature of our method is beneficial to obtain higher accuracy, since we see a consistent accuracy degradation trend as $k$ is increased past 20. In addition, we present in Fig. 5, that by fixing $p = 10$ and examining a variable path length $k$ from 1 to 11, accuracy improves and stagnates at $k = 7$ . We can see that when $k = 1$ , our pathGCN behaves similarly to an MLP (Qi et al., 2017) (as it considers only the self node), and that in some cases, increasing the kernel size caused a slight performance degradation. + +# 5. Conclusion + +In this paper we propose a new approach for learning the spatial operators for GCNs. Our motivation stems from the + +need for deep GCNs that have expressive spatial kernels, similar to standard CNNs that do not over-smooth. Our approach leverages on paths defined on the graph, to enable the learning of such operators, further bridging the gap between GCNs and CNNs. + +Just as the Laplacian is not the sole spatial operator used on images in CNNs, it may also not necessarily be optimal in the case of graphs and GCNs. To this end we propose pathGCN which replaces the Laplacian based operator by a fully learnt kernel. Indeed, our experiments reveal that more expressive kernels can be learnt based on the data and task at hand, leading to consistently better accuracy on numerous applications and datasets and without over-smoothing. + +# Acknowledgements + +The research reported in this paper was supported by the Israel Innovation Authority through Avatar consortium. In addition, this work was supported in part by the Israeli Council for Higher Education (CHE) via the Data Science Research Center, Ben-Gurion University of the Negev, Israel. ME is supported by Kreitman High-tech scholarship. + +# References + +Bodnar, C., Frasca, F., Otter, N., Wang, Y., Lio, P., Montu-far, G. F., and Bronstein, M. Weisfeiler and lehman go cellular: Cw networks. Advances in Neural Information Processing Systems, 34:2625-2640, 2021. +Boscaini, D., Masci, J., Rodolà, E., and Bronstein, M. Learning shape correspondence with anisotropic convolutional neural networks. 05 2016. +Bouritsas, G., Frasca, F., Zafeiriou, S. P., and Bronstein, M. Improving graph neural network expressivity via subgraph isomorphism counting. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2022. +Bronstein, M. M., Bruna, J., LeCun, Y., Szlam, A., and Vandergheynst, P. Geometric deep learning: going beyond euclidean data. IEEE Signal Processing Magazine, 34(4): 18-42, 2017. + +Bruna, J., Zaremba, W., Szlam, A., and LeCun, Y. Spectral networks and locally connected networks on graphs. arXiv preprint arXiv:1312.6203, 2013. +Chamberlain, B. P., Rowbottom, J., Gorinova, M., Webb, S., Rossi, E., and Bronstein, M. M. Grand: Graph neural diffusion. arXiv preprint arXiv:2106.10934, 2021. +Chen, J., Zhu, J., and Song, L. Stochastic training of graph convolutional networks with variance reduction. In Dy, J. and Krause, A. (eds.), Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pp. 942-950. PMLR, 10-15 Jul 2018. URL http://proceedings.mlr.press/v80/chen18p.html. +Chen, M., Wei, Z., Huang, Z., Ding, B., and Li, Y. Simple and deep graph convolutional networks. In III, H. D. and Singh, A. (eds.), Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pp. 1725-1735. PMLR, 13-18 Jul 2020. URL http://proceedings.mlr.press/v119/chen20v.html. +Chiang, W.-L., Liu, X., Si, S., Li, Y., Bengio, S., and Hsieh, C.-J. Cluster-gcn: An efficient algorithm for training deep and large graph convolutional networks. In ACM SIGKDD Conference on Knowledge Discovery and Data Mining (KDD), 2019. URL https://arxiv.org/pdf/1905.07953.pdf. +Defferrard, M., Bresson, X., and Vandergheynst, P. Convolutional neural networks on graphs with fast localized spectral filtering. In Advances in neural information processing systems, pp. 3844-3852, 2016. +Eliasof, M. and Treister, E. Diffgen: Graph convolutional networks via differential operators and algebraic multigrid pooling. 34th Conference on Neural Information Processing Systems (NeurIPS 2020), Vancouver, Canada., 2020. +Eliasof, M., Haber, E., and Treister, E. Pde-gcn: Novel architectures for graph neural networks motivated by partial differential equations. Advances in Neural Information Processing Systems, 34, 2021. +Ephrath, J., Eliasof, M., Ruthotto, L., Haber, E., and Treister, E. Leanconvnets: Low-cost yet effective convolutional neural networks. IEEE Journal of Selected Topics in Signal Processing, 2020. +Fey, M. and Lenssen, J. E. Fast graph representation learning with PyTorch Geometric. In ICLR Workshop on Representation Learning on Graphs and Manifolds, 2019. + +Gasteiger, J., Weißenberger, S., and Gunnemann, S. Diffusion improves graph learning. In Conference on Neural Information Processing Systems (NeurIPS), 2019. +Grover, A. and Leskovec, J. 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. +Hamilton, W. L., Ying, R., and Leskovec, J. Inductive representation learning on large graphs. In NIPS, 2017. +He, K., Zhang, X., Ren, S., and Sun, J. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 770-778, 2016. +Howard, A. G., Zhu, M., Chen, B., Kalenichenko, D., Wang, W., Weyand, T., Andreetto, M., and Adam, H. MobileNets: Efficient convolutional neural networks for mobile vision applications. arXiv preprint arXiv:1704.04861, 2017. +Hu, W., Fey, M., Zitnik, M., Dong, Y., Ren, H., Liu, B., Catasta, M., and Leskovec, J. Open graph benchmark: Datasets for machine learning on graphs. arXiv preprint arXiv:2005.00687, 2020. +Jumper, J., Evans, R., Pritzel, A., Green, T., Figurnov, M., Ronneberger, O., Tunyasuvunakool, K., Bates, R., Žídek, A., Potapenko, A., et al. Highly accurate protein structure prediction with alphafold. Nature, 596(7873):583-589, 2021. +Kim, D. and Oh, A. How to find your friendly neighborhood: Graph attention design with self-supervision. In International Conference on Learning Representations, 2020. +Kingma, D. P. and Ba, J. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. +Kipf, T. N. and Welling, M. Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907, 2016. +Klicpera, J., Bojchevski, A., and Gunnemann, S. Combining neural networks with personalized pagerank for classification on graphs. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id=H1gL-2A9Ym. +Krizhevsky, A., Sutskever, I., and Hinton, G. Imagenet classification with deep convolutional neural networks. Adv Neural Inf Process Syst, 61:1097-1105, 2012. +Lei, X. and Bian, C. Integrating random walk with restart and k-nearest neighbor to identify novel circrna-disease association. Scientific reports, 10(1):1-9, 2020. + +Levie, R., Monti, F., Bresson, X., and Bronstein, M. M. Cayleynets: Graph convolutional neural networks with complex rational spectral filters. IEEE Transactions on Signal Processing, 67(1):97-109, 2018. +Liu, Z., Chen, C., Li, L., Zhou, J., Li, X., and Song, L. Geniepath: Graph neural networks with adaptive receptive paths. Proceedings of the AAAI Conference on Artificial Intelligence, 33, 02 2018. doi: 10.1609/aaai.v33i01.33014424. +Ma, Z., Xuan, J., Wang, Y. G., Li, M., and Liò, P. Path integral based convolution and pooling for graph neural networks. arXiv preprint arXiv:2006.16811, 2020. +Maron, H., Ben-Hamu, H., Shamir, N., and Lipman, Y. Invariant and equivariant graph networks. *ICLR*, 2018. +Mernyei, P. and Cangea, C. Wiki-cs: A wikipedia-based benchmark for graph neural networks. arXiv preprint arXiv:2007.02901, 2020. +Mikolov, T., Sutskever, I., Chen, K., Corrado, G. S., and Dean, J. Distributed representations of words and phrases and their compositionality. In Advances in neural information processing systems, pp. 3111-3119, 2013. +Monti, F., Boscaini, D., Masci, J., Rodola, E., Svoboda, J., and Bronstein, M. M. Geometric deep learning on graphs and manifolds using mixture model cnns. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5115-5124, 2017. +Morris, C., Kriege, N. M., Bause, F., Kersting, K., Mutzel, P., and Neumann, M. Tudataset: A collection of benchmark datasets for learning with graphs. In ICML 2020 Workshop on Graph Representation Learning and Beyond (GRL+ 2020), 2020. URL www.graphlearning.io. +Nikolentzos, G. and Vazirgiannis, M. Random walk graph neural networks. Advances in Neural Information Processing Systems, 33:16211-16222, 2020. +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., and Chintala, S. Pytorch: An imperative style, high-performance deep learning library. In Wallach, H., Larochelle, H., Beygelzimer, A., d'Alché-Buc, F., Fox, E., and Garnett, R. (eds.), Advances in Neural Information Processing Systems 32, pp. 8024-8035. Curran Associates, Inc., 2019. +Pei, H., Wei, B., Chang, K. C.-C., Lei, Y., and Yang, B. Geom-gcn: Geometric graph convolutional networks. In International Conference on Learning Representations, + +2020. URL https://openreview.net/forum? id=S1e2agrFvS. +Perozzi, B., Al-Rfou, R., and Skiena, S. Deepwalk: Online learning of social representations. In Proceedings of the 20th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 701-710, 2014. +Qi, C. R., Su, H., Mo, K., and Guibas, L. J. Pointnet: Deep learning on point sets for 3d classification and segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 652-660, 2017. +Rong, Y., Huang, W., Xu, T., and Huang, J. Droppededge: Towards deep graph convolutional networks on node classification. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id=Hkx1qkrKPr. +Rozemberczki, B., Allen, C., and Sarkar, R. Multi-Scale Attributed Node Embedding. Journal of Complex Networks, 9(2), 2021. +Sandler, M., Howard, A., Zhu, M., Zhmoginov, A., and Chen, L.-C. MobileNetV2: Inverted residuals and linear bottlenecks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4510-4520, 2018. +Sen, P., Namata, G., Bilgic, M., Getoor, L., Galligher, B., and Eliassi-Rad, T. Collective classification in network data. AI magazine, 29(3):93-93, 2008. +Strokach, A., Becerra, D., Corbi-Verge, C., Perez-Riba, A., and Kim, P. M. Fast and flexible protein design using deep graph neural networks. Cell Systems, 11(4):402 - 411.e4, 2020. ISSN 2405-4712. doi: https://doi.org/10.1016/j.cels.2020.08.016. URL http://www.sciencedirect.com/science/article/pii/S2405471220303276. +Sun, X., Rosin, P. L., Martin, R. R., and Langbein, F. C. Random walks for feature-preserving mesh denoising. Computer Aided Geometric Design, 25(7):437-456, 2008. +Szegedy, C., Ioffe, S., Vanhoucke, V., and Alemi, A. A. Inception-v4, inception-resnet and the impact of residual connections on learning. In Thirty-First AAAI Conference on Artificial Intelligence, 2017. +Veličković, P., Cucurull, G., Casanova, A., Romero, A., Lio, P., and Bengio, Y. Graph Attention Networks. International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id=rJXMpikCZ. + +Wang, Y., Sun, Y., Liu, Z., Sarma, S. E., Bronstein, M. M., and Solomon, J. M. Dynamic graph cnn for learning on point clouds. arXiv preprint arXiv:1801.07829, 2018. +Wu, F., Souza, A., Zhang, T., Fifty, C., Yu, T., and Weinberger, K. Simplifying graph convolutional networks. In International conference on machine learning, pp. 6861-6871. PMLR, 2019. +Xu, K., Li, C., Tian, Y., Sonobe, T., Kawarabayashi, K., and Jegelka, S. Representation learning on graphs with jumping knowledge networks. In Dy, J. and Krause, A. (eds.), Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pp. 5453-5462. PMLR, 10-15 Jul 2018. URL http://proceedings.mlr.org/press/v80/xu18c.html. +Xu, K., Hu, W., Leskovec, J., and Jegelka, S. How powerful are graph neural networks? In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id=ryGs6iA5Km. +Yang, Z., Cohen, W., and Salakhudinov, R. Revisiting semi-supervised learning with graph embeddings. In International conference on machine learning, pp. 40-48. PMLR, 2016. +Zhang, J., Shi, X., Xie, J., Ma, H., King, I., and Yeung, D. Gaan: Gated attention networks for learning on large and spatiotemporal graphs. In Proceedings of the Thirty-Fourth Conference on Uncertainty in Artificial Intelligence, pp. 339-349, 2018a. +Zhang, M., Cui, Z., Neumann, M., and Chen, Y. An end-to-end deep learning architecture for graph classification. In Thirty-second AAAI conference on artificial intelligence, 2018b. +Zhao, L. and Akoglu, L. Pairnorm: Tackling oversmoothing in gnns. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id=rkecl1rtwB. +Zhou, K., Huang, X., Zha, D., Chen, R., Li, L., Choi, S.-H., and Hu, X. Dirichlet energy constrained learning for deep graph neural networks. Advances in Neural Information Processing Systems, 34, 2021. + +# A. Architecture in details + +We elaborate on the architecture that was used in our experiments. As discussed in Sec. 4, our network is comprised of an embedding layer ( $1 \times 1$ convolution), a sequence of pathGCN layers, and a closing (projection) layer ( $1 \times 1$ convolution). Throughout this section, $c_{in}$ and $c_{out}$ denote the input and output channels, respectively, and $c$ denotes the number of features in hidden layers (which is a hyperparameter, as given in Appendix B). We denote the number of pathGCN blocks by $L$ , and the dropout probability by $p_{drop}$ . Our architecture for node classification tasks is described in Tab. 12, which is similar to the architecture found in GCNII (Chen et al., 2020), only with our pathGCN instead. In Tab. 13 we present our network for graph classification tasks, which is based on the one in GIN (Xu et al., 2019). + +Table 12. pathGCN architecture for node classification. + +
Input sizeLayerOutput size
n × cin1 × 1 Dropout(pdrop)n × cin
n × cin1 × 1 Convolutionn × c
n × cReLUn × c
n × cL× pathGCN blockn × c
n × c1 × 1 Dropout(pdrop)n × c
n × c1 × 1 Convolutionn × cout
+ +Table 13. pathGCN architecture for graph classification. + +
Input sizeLayerOutput size
n × cin1 × 1 Convolutionn × c
n × cReLUn × c
n × cL × [ pathGCN, BNn × c
, 1 × 1 Convolution, ReLU ]
n × c1 × 1 Add-pool1 × c
1 × c1 × 1 Convolution1 × c
1 × c1 × 1 Dropout(pdrop)1 × c
1 × c1 × 1 Convolution1 × cout
+ +# B. Hyper-parameters details + +We provide the selected hyper-parameters in our experiments. We denote the learning rate of our pathGCN layers by $LR_{GCN}$ , and the learning rate of the $1 \times 1$ opening (embedding) and closing (classifier) layers by $LR_{oc}$ . Also, the weight decay for the opening and closing layers is denoted by $WD_{oc}$ , and for the pathGCN layers by $WD_{GCN}$ . + +Table 14. Semi-supervised node classification hyper-parameters + +
DatasetLRGCNWDGCNLRocWDoccpdropkp
Cora1·10-32·10-51·10-21·10-5640.655
Citeseer1·10-31·10-57·10-35·10-52560.755
Pubmed5·10-301·10-21·10-52560.5710
+ +Table 15. Fully-supervised node classification hyper-parameters + +
DatasetLRGCNWDGCNLRocWDoccpdropkp
Cora1·10-41·10-47·10-21·10-4640.5510
CiteSeer3·10-45·10-58·10-31·10-4640.5510
Pubmed1·10-42·10-41·10-21·10-6640.5710
Chameleon5·10-41·10-55·10-33·10-5640.5310
Cornell4·10-41·10-55·10-25·10-4640.5510
Texas3·10-45·10-44·10-21·10-4640.5710
Wisconsin3·10-42·10-41·10-25·10-5640.5710
Actor2·10-41·10-48·10-25·10-4640.5710
Wiki-CS3·10-21·10-47·10-31·10-5640.375
Ogbn-arxiv1·10-301·10-302560.1510
+ +# B.1. Semi-supervised node classification + +The hyper-parameters for this experiment are summarized in Tab. 14. + +# B.2. Fully-supervised node classification + +The hyper-parameters for this experiment are summarized in Tab. 15. + +# B.3. Inductive learning on PPI + +For this experiment we used $LR_{oc} = LR_{GCN} = 0.001$ , with dropout probability $p_{drop} = 0.2$ , $k = 5$ and $p = 10$ , and no weight decay was used. + +# B.4. Graph classification + +The hyper-parameters in this experiment were chosen according to the protocol described in (Xu et al., 2019). We present the chosen hyper-parameters in Tab. 16. Throughout all the experiments in this section, no weight decay was used. + +# B.5. Ablation study + +In this experiment we used the same hyper-parameters as reported in Tab. 14, for the results in Tab. 11. For the results in Fig. 5, we use the same learning rate and weight decay, but $k$ and $p$ are as described in the main paper. + +Table 16. Graph classification hyper-parameters. BS denotes batch size. + +
DatasetLRGCNLRoccpdropBSpk
MUTAG0.010.013203255
PTC0.010.013203255
PROTEINS0.010.01320128510
NCI10.010.01320.532510
\ No newline at end of file diff --git a/pathgcnlearninggeneralgraphspatialoperatorsfrompaths/images.zip b/pathgcnlearninggeneralgraphspatialoperatorsfrompaths/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..5db89cdf46a2d8e0ed3f1f0b24168c30f4af759d --- /dev/null +++ b/pathgcnlearninggeneralgraphspatialoperatorsfrompaths/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a70c520e4fa05a1b49321d1b398ba42d323ff45398b8b953742ac965e2ae208f +size 895759 diff --git a/pathgcnlearninggeneralgraphspatialoperatorsfrompaths/layout.json b/pathgcnlearninggeneralgraphspatialoperatorsfrompaths/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..eca140b9298c903d4ff9746c3721c0a4c7a3e77c --- /dev/null +++ b/pathgcnlearninggeneralgraphspatialoperatorsfrompaths/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8c376e15017d75e23cfd1daf581264274609f5578e989440a1c81f0285dd4e44 +size 540833 diff --git a/variationalnearestneighborgaussianprocess/f90ca846-47da-4f30-9f84-d03638b4b457_content_list.json b/variationalnearestneighborgaussianprocess/f90ca846-47da-4f30-9f84-d03638b4b457_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..1739e9c6f0a236789e4adaf05c0e69839cc170f5 --- /dev/null +++ b/variationalnearestneighborgaussianprocess/f90ca846-47da-4f30-9f84-d03638b4b457_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0e1a36adb075df8e75f0aeb62754cd28f72a24a74168c29bca5f96b0927bf9f0 +size 128044 diff --git a/variationalnearestneighborgaussianprocess/f90ca846-47da-4f30-9f84-d03638b4b457_model.json b/variationalnearestneighborgaussianprocess/f90ca846-47da-4f30-9f84-d03638b4b457_model.json new file mode 100644 index 0000000000000000000000000000000000000000..7beb8c00a7376bbf85b104a1d64a6504d5597b21 --- /dev/null +++ b/variationalnearestneighborgaussianprocess/f90ca846-47da-4f30-9f84-d03638b4b457_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75b4f885113c4e1890d16710aed7764f57c1383c796415d41a4c869919825fcd +size 147892 diff --git a/variationalnearestneighborgaussianprocess/f90ca846-47da-4f30-9f84-d03638b4b457_origin.pdf b/variationalnearestneighborgaussianprocess/f90ca846-47da-4f30-9f84-d03638b4b457_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..9ff0813e761fe38bfb942ddb8fd9bb3b4989b641 --- /dev/null +++ b/variationalnearestneighborgaussianprocess/f90ca846-47da-4f30-9f84-d03638b4b457_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a86710457bb8375a2a396b021900f60214261ed7bacb4607a853151a5b871655 +size 655749 diff --git a/variationalnearestneighborgaussianprocess/full.md b/variationalnearestneighborgaussianprocess/full.md new file mode 100644 index 0000000000000000000000000000000000000000..b006d1b1f3fd41d2259584329be28b220447720b --- /dev/null +++ b/variationalnearestneighborgaussianprocess/full.md @@ -0,0 +1,580 @@ +# Variational Nearest Neighbor Gaussian Process + +Luhuan Wu1 Geoff Pleiss2 John Cunningham1,2 + +# Abstract + +Variational approximations to Gaussian processes (GPs) typically use a small set of inducing points to form a low-rank approximation to the covariance matrix. In this work, we instead exploit a sparse approximation of the precision matrix. We propose variational nearest neighbor Gaussian process (VNNGP), which introduces a prior that only retains correlations within $K$ nearest- neighboring observations, thereby inducing sparse precision structure. Using the variational framework, VNNGP's objective can be factorized over both observations and inducing points, enabling stochastic optimization with a time complexity of $O(K^3)$ . Hence, we can arbitrarily scale the inducing point size, even to the point of putting inducing points at every observed location. We compare VNNGP to other scalable GPs through various experiments, and demonstrate that VNNGP (1) can dramatically outperform low-rank methods, and (2) is less prone to overfitting than other nearest neighbor methods. + +# 1. Introduction + +Gaussian processes (GPs) provide rich priors over functions (Rasmussen & Williams, 2006). While the GP posterior can be computed in closed form for regression models, variational posterior approximations (Titsias, 2009; Hensman et al., 2013; van der Wilk et al., 2020) have become increasingly popular as they offer numerous advantages. First, variational methods can utilize stochastic minibatching (Hensman et al., 2013), enabling inference for large-scale datasets. Second, variational methods are compatible with non-conjugate likelihoods (Hensman et al., 2015) and simplify inference for interdomain observation models (Lázaro-Gredilla & Figueiras-Vidal, 2009; Álvarez et al., 2010; van der Wilk et al., 2020; Wu et al., 2021). Finally, + +$^{1}$ Department of Statistics, Columbia University $^{2}$ Zuckerman Institute, Columbia University. Correspondence to: Luhuan Wu . + +Proceedings of the $39^{th}$ International Conference on Machine Learning, Baltimore, Maryland, USA, PMLR 162, 2022. Copyright 2022 by the author(s). + +black box variational methods (Ranganath et al., 2014) make it possible to use GP as components of larger models, such as Deep Gaussian Processes (Damianou & Lawrence, 2013). + +To apply variational methods to large-scale GP, it is often necessary to make additional approximations (Titsias, 2009; Hensman et al., 2017). This is because making GP inference with $N$ observations incurs a $\mathcal{O}(N^3)$ computation. A popular variational approach that aids this issue is the Stochastic Variational Gaussian Process method (SVGP) (Hensman et al., 2013), which essentially forms a low-rank approximation to the prior covariance. These approximations offer well understood predictive properties (Bauer et al., 2016), probable performance guarantees (Burt et al., 2019), and competitive performance on numerous datasets. However, there are also many instances when low-rank approximations are ill suited. For example, spatiotemporal datasets often have intrinsically low lengthscale, meaning that the data can vary rapidly with small changes in space and time. In these settings, low-rank approximations cannot capture fast variations, often resulting in low fidelity or "blurry" predictions (e.g. Datta et al., 2016a; Pleiss et al., 2020; Wu et al., 2021). + +In this paper, we are interested in making variational GP methods more amenable to spatiotemporal data and other domains with intrinsically low lengthscale, while retaining (and even improving) scalability. To do so, we replace SVGP's low-rank approximation of the prior covariance matrix with a sparse approximation of the prior precision matrix. Whereas a low-rank approximation assumes that observations are explained through a small number of global latent variables, a sparse precision approximation instead assumes that observations are conditionally independent given their nearest neighboring observations. Mathematically, the joint GP prior is approximated by the product of one-dimensional conditionals, each of which only depends on a small subset of preceding observations based on some predetermined ordering. This assumption is quite reasonable in the context of spatiotemporal modeling. For example, it is reasonable to assume that the weather in Los Angeles and Maine are conditionally independent, given neighboring cities in California. + +Sparse precision approximations are common in spatiotemporal modeling throughout the geostatistics literature (e.g. + +Vecchia, 1988; Stein et al., 2004; Datta et al., 2016a; Guinness, 2018; Finley et al., 2019; Katzfuss et al., 2021), where they often achieve higher predictive fidelity than low-rank approximations. However, most existing approaches target exact or MCMC inference and are not compatible with variational methods. As a result, it is not straightforward to use sparse precision methods with non-conjugate or interdomain likelihoods, or as part of larger probabilistic models without resorting to sampling. Recently, Tran et al. (2021) made a first key step in this direction. They introduce Sparse Within Sparse Gaussian Processes (SWSGP), which combines a similar nearest neighbor approximation with SVGP. Instead of exploiting the sparse precision structure, SWSGP introduces sparsity by constructing a hierarchical prior. While successful, we will show an important technical opportunity remains, which we offer here. + +In this work, we propose a novel sparse precision approximation that is compatible with stochastic variational inference. Similar to SVGP, our proposed method—the Variational Nearest Neighbor Gaussian Process (VNNGP) ${}^{1}$ —formulates the variational objective and predictive distribution through a set of $M$ inducing points. Unlike SVGP, our method applies 1) a sparse precision approximation to the inducing point distribution and 2) a sparse dependency approximation between observations and inducing points. These approximations enable the VNNGP objective to factorize over data and inducing points. Consequently, we can minibatch over data and inducing points when evaluating the variational objective, resulting in constant time computational complexity with respect to both $N$ and $M$ . This significant reduction makes it possible to scale $M$ well beyond the limits of SVGP, even to the point of placing inducing points at every observed location. Moreover, unlike SWSGP and other sparse approximations (Vecchia, 1988; Katzfuss et al., 2021), the VNNGP prior and variational distribution both constitute valid GPs, enabling it to more faithfully retain the features of the true GP prior. We compare VNNGP to SVGP, SWSGP, and other scalable methods on numerous toy experiments and benchmark datasets. Our results demonstrate that VNNGP can offer higher fidelity predictions than SVGP and is less prone to overfitting than SWSGP. These advantages are most pronounced on spatiotemporal datasets (including those with non-conjugate observational models), but hold for high dimensional datasets as well. + +$^{1}$ VNNGP is implemented in the GPyTorch library. See the example in https://docs.gpytorch.ai/en/stable/ examples/04_Variational_and_Approximate_GPs/VNNGP.html + +# 2. Background + +# 2.1. Gaussian Processes + +Consider any finite dimensional realization $\mathbf{f} = \{f_i\}_{i=1}^N$ of a Gaussian process at locations $\mathbf{x}_1, \mathbf{x}_2, \dots, \mathbf{x}_N \in \mathbb{R}^D$ : + +$$ +f (\cdot) \sim \mathcal {G P} (0, k (\cdot , \cdot)) \tag {1} +$$ + +$$ +f _ {i} \equiv f (\mathbf {x} _ {i}) \quad \text {f o r} i = 1: N +$$ + +where $k(\cdot, \cdot)$ is a kernel function that encodes the properties of the prior. We can always factorize the joint probability of a GP realization into a chain of conditional probabilities subject to some ordering, for example + +$$ +p (\mathbf {f}) = p \left(f _ {1}\right) \prod_ {i = 2} ^ {N} p \left(f _ {i} \mid \mathbf {f} _ {1: i - 1}\right), \tag {2} +$$ + +where $p(f_1) = \mathcal{N}(f_1|0,k_{1,1})$ + +$$ +p \left(f _ {i} \mid \mathbf {f} _ {1: i - 1}\right) = \mathcal {N} \left(f _ {i} \mid \mathbf {k} _ {1: i - 1, i} ^ {\top} \mathbf {K} _ {1: i - 1, 1: i - 1} ^ {- 1} \mathbf {f} _ {1: i - 1}, \right. \tag {3} +$$ + +$$ +k _ {i, i} - \mathbf {k} _ {1: i - 1, i} ^ {\top} \mathbf {K} _ {1: i - 1, 1: i - 1} ^ {- 1} \mathbf {k} _ {1: i - 1, i}) +$$ + +and we define $k_{i,i} \equiv k(\mathbf{x}_i, \mathbf{x}_i)$ , $\mathbf{k}_{1:i-1,i} \equiv k(\mathbf{x}_{1:i-1}, \mathbf{x}_i)$ , and $\mathbf{K}_{1:i-1,1:i-1} \equiv k(\mathbf{x}_{1:i-1,i}, \mathbf{x}_{1:i-1})$ . The following notations will apply this convention accordingly. + +# 2.2. Sparse Precision Approximations + +GP approximations based on sparse precision matrices remain popular for years, largely in the geostatistics community (Vecchia, 1988; Datta et al., 2016a; Finley et al., 2019; Katzfuss et al., 2021). They consider the following approximation to Eq 2 + +$$ +p (\mathbf {f}) \approx p \left(f _ {1}\right) \prod_ {i = 2} ^ {N} p \left(f _ {i} \mid \mathbf {f} _ {n (i)}\right), \tag {4} +$$ + +where $p(f_1) = \mathcal{N}(f_1|0,k_{1,1})$ + +$$ +p \left(f _ {i} \mid \mathbf {f} _ {n (i)}\right) = \mathcal {N} \left(f _ {i} \mid \mathbf {k} _ {n (i), i} ^ {\top} \mathbf {K} _ {n (i), n (i)} ^ {- 1} \mathbf {f} _ {n (i)}, \right. \tag {5} +$$ + +$$ +k _ {i, i} - \mathbf {k} _ {n (i), i} ^ {\top} \mathbf {K} _ {n (i), n (i)} ^ {- 1} \mathbf {k} _ {n (i), i}) +$$ + +and $n(i)$ denotes the indices of $K$ nearest neighbors of $\mathbf{x}_i$ in $\{\mathbf{x}_k\}_{k=1}^{i-1}$ . Typically $K$ is set to be much smaller than $N$ , and when $K = N$ Eq 4 recovers the original GP. This approximation results in a sparse Cholesky factor of the precision matrix (Datta, 2021b). As a consequence, the model complexity scales $O(NK^3)$ . It has seen many successful applications in spatiotemporal problems, e.g. predicting PM pollutant levels arocss Europe (Datta et al., 2016b), predicting forest canopy height (Finley et al., 2017), estimating forest biomass (Taylor-Rodriguez et al., 2019), etc. + +# 2.3. Stochastic Variational Gaussian Processes + +Stochastic variational Gaussian process (SVGP) (Hensman et al., 2013) defines a small set of $M$ inducing points $\mathbf{u} = \{u_j\}_{j=1}^M$ which are GP latent variables at locations $\{\mathbf{z}_j\}_{j=1}^M$ . It considers the joint latent generative process: + +$$ +p (\mathbf {u}, \mathbf {f}) = \mathcal {N} \left(\left( \begin{array}{l} \mathbf {u} \\ \mathbf {f} \end{array} \right) | 0, \left( \begin{array}{c c} \mathbf {K} _ {\mathbf {z}, \mathbf {z}} & \mathbf {K} _ {\mathbf {z}, \mathbf {x}} \\ \mathbf {K} _ {\mathbf {x}, \mathbf {z}} & \mathbf {K} _ {\mathbf {x}, \mathbf {x}} \end{array} \right)\right) \tag {6} +$$ + +and an independent observation model + +$$ +p (\mathbf {y} \mid \mathbf {f}) = \prod_ {i = 1} ^ {N} p \left(y _ {i} \mid f _ {i}\right) \tag {7} +$$ + +where $p(y_{i}|f_{i})$ is an arbitrary likelihood function. SVGP is optimized by maximizing the evidence lower bound (ELBO) given below: + +$$ +\mathcal {L} _ {\mathrm {S V G P}} = \sum_ {i = 1} ^ {N} \underset {q \left(f _ {i}\right)} {\mathbb {E}} \left[ \log p \left(y _ {i} \mid f _ {i}\right) \right] - \operatorname {K L} \left[ q (\mathbf {u}) \| p (\mathbf {u}) \right], \tag {8} +$$ + +where $q(\mathbf{u})$ is the variational posterior for $\mathbf{u}$ and $q(f_i) = \int p(f_i|\mathbf{u})q(\mathbf{u})\mathrm{d}\mathbf{u}$ is the variational posterior for $f_i$ . The SVGP approximation relies on the low-rank matrix $\mathbf{K}_{\mathbf{x},\mathbf{z}}\mathbf{K}_{\mathbf{z},\mathbf{z}}^{-1}\mathbf{K}_{\mathbf{z},\mathbf{x}}$ instead of the full-rank matrix $\mathbf{K}_{\mathbf{x},\mathbf{x}}$ to reduce the size of any matrix inversion to $M$ . Therefore, we refer to it as a low-rank approximation. + +SVGP has several advantages compared to exact GP and other scalable methods. First, as is shown in Eq 8, the ELBO is factorized over data points. Therefore, it is amenable to stochastic optimization and the computational complexity reduces to $O(M^3)$ . Moreover, due to its variational inference nature, SVGP can be applied to problems with non-conjugate likelihoods, inter-domain observations or latent variable models based on GPs. However, since SVGP assumes $M \ll N$ , it may struggle to obtain accurate predictions for large-scale data that are not inherently low-rank structured (Wu et al., 2021; Tran et al., 2021). + +# 2.4. Other Related Works + +Variational GP inference was first pursued by Csato et al. (2000) and Gibbs & MacKay (2000). More recent works connect variational inference with scalable methods. Titsias (2009) ties inducing point approximations and variational inference, and Hensman et al. (2013) extends this approach to be compatible with minibatched optimization. Recent extensions focus on inducing points in linearly transformed domains (Lázaro-Gredilla & Figueiras-Vidal, 2009; van der Wilk et al., 2020), inducing points with exploitable algebraic kernel structures (Wilson & Nickisch, 2015; Wu et al., 2021), and inducing points with separable structure (Cheng & Boots, 2017; Salimbeni et al., 2018; Shi et al., 2020). Beyond inducing point approximations, Hensman et al. (2017) and John & Hensman (2018) combine variational inference with finite basis approximations. + +Nearest neighbor approximations. In addition to the sparse precision approximations pursued by the geostatistics community (see introduction), the machine learning community has proposed nearest neighbor GP approximations (Kim et al., 2005; Nguyen-Tuong et al., 2008; Gramacy & Apley, 2015; Park & Apley, 2018; Jankowiak & Pleiss, 2021). Besides SWSGP which is introduced before, we review three methods that are most related to our method. Bui & Turner (2014) proposes a sparse prior by imposing a tree or chain structure over inducing points and calibrating the posterior approximation with a KL divergence minimization. This approach uses a message-passing inference algorithm and learns the hyperparameters by maximizing the marginal likelihood over inducing points. Stochastic gradient descent GP (sgGP) forms a (biased) stochastic GP objective that optimizes $K$ -nearest- neighboring data points per iteration (Chen et al., 2020). This method is an approximation to exact GP inference, and therefore is limited to Gaussian likelihood. Liu & Liu (2019) use amortized variational inference for data points within a small neighborhood, where the variational covariance is constructed to have a sparse Cholesky factor. The latter two methods have computational complexity cubic in the number of nearest neighbors. + +# 3. Variational Nearest Neighbor GP + +In this section, we develop VNNGP, a highly scalable variational GP method. VNNGP considers the same observation model in Eq 7 and makes the following nearest neighbor approximations to the latent generative process + +$$ +p (\mathbf {u}) \approx \prod_ {j = 1} ^ {M} p \left(u _ {i} \mid \mathbf {u} _ {n (j)}\right), \quad p (\mathbf {f} \mid \mathbf {u}) \approx \prod_ {i = 1} ^ {N} p \left(f _ {i} \mid \mathbf {u} _ {n (i)}\right) \tag {9} +$$ + +where each conditional denotes a standard GP predictive distribution, $n(j)$ denotes the inducing point indices corresponding to $\mathbf{z}_j$ 's (at most) $K$ nearest neighbors selected from $\{\mathbf{z}_1, \dots, \mathbf{z}_{j-1}\}$ (with a special case of $n(1) = \emptyset$ ), and we overload the notation $n(i)$ to denote the inducing point indices of $\mathbf{x}_i$ 's $K$ nearest neighbors in all $\{\mathbf{z}_j\}_{j=1}^M$ . + +Because of this construction, VNNGP forms a sparse approximation to the prior precision matrix $\mathbf{K}_{\mathbf{z},\mathbf{z}}^{-1}$ (Datta, 2021b). Its Cholesky factor has at most $K + 1$ non-zero elements per row, corresponding to the $K$ -nearest-neighbor dependency structure. Figure 1 plots the Cholesky factor of $\mathbf{K}_{\mathbf{z},\mathbf{z}}^{-1}$ for $M = 20$ inducing points with varying number of nearest neighbors $K$ . We further see that, as $K$ increases, the Cholesky factor becomes denser and approaches the exact one. In this case, $K = 10$ yields a quality approximation. Note that the sparsity pattern of the Cholesky factor depends on the ordering of inducing points and the nearest neighbor sets. In Figure 1 we use the coordinate ordering of 1-dimensional inducing points, thereby rendering a banded sparsity pattern. + +![](images/47d2d9f1ac9aea09dea6827b6ddf7b5b9825b9d08ba0a983134307950d35e5ea.jpg) +Figure 1. The Cholesky factor of prior precision matrix for $M = 20$ inducing points (with even spacing of 1) by VNNGP with different number of nearest neighbors $K$ . We use a squared exponential kernel with outputscale 1 and lengthscale 1. For each row of the Cholesky factor, at most $K + 1$ elements are non-zero, and when $K = 10$ the approximation is qualitatively close to the exact one. + +Ordering of inducing points. The nearest neighbor approximation in Eq 9 is subject to a particular ordering of inducing points. In all following experiments, we apply random ordering and we find that different orderings do not lead substantial differences on VNNGP's performance. + +Variational family. We consider a special choice of the variational distribution $q(\mathbf{f}, \mathbf{u})$ that will greatly simplify the computation without sacrificing much prediction accuracy. Specifically, we use a mean-field variational approximation for $\mathbf{u}$ and approximate the posterior for $\mathbf{f}$ with the nearest neighbor prior: + +$$ +q (\mathbf {u}) = \prod_ {j = 1} ^ {M} q (u _ {j}) = \prod_ {j = 1} ^ {M} \mathcal {N} (u _ {j} | m _ {j}, s _ {j}), \tag {10} +$$ + +$$ +q (\mathbf {f}) = \prod_ {i = 1} ^ {N} q \left(f _ {i}\right) = \prod_ {i = 1} ^ {N} \int p \left(f _ {i} \mid \mathbf {u} _ {n (i)}\right) q \left(\mathbf {u} _ {n (i)}\right) \mathrm {d} \mathbf {u} _ {n (i)}. \tag {11} +$$ + +The choice of mean-field or sparse variational approximations are common for large-scale GP when full-rank approximations are impractical (Liu & Liu, 2019; Wu et al., 2021; Tran et al., 2021). Empirically, we found that VN-NGP with a mean-field variational distribution outperforms SVGP with a full-rank one for most cases. However, we also discuss the extension to a more expressive variational family in appendix B. + +Optimization objective is to maximize the VNNGP's ELBO as follows + +$$ +\mathcal {L} _ {\mathrm {V N N G P}} = \underbrace {\sum_ {i = 1} ^ {N} \underset {q (f _ {i})} {\mathbb {E}} [ \log p \left(y _ {i} \mid f _ {i}\right) ]} _ {\text {d a t a l i k e h o o d}} - \underbrace {\operatorname {K L} [ q (\mathbf {u}) \| p (\mathbf {u}) ]} _ {\text {K L d i v e r g e n c e}}, \tag {12} +$$ + +Note that the ELBO breaks into a data likelihood term and a KL divergence term. In the following, we first discuss the computation of these two terms. After that, we present the advantages of VNNGP. Finally, we compare VNNGP to other related works based on nearest neighbor approximations. + +# 3.1. Computing the Data Likelihood Term + +Similar to SVGP, the data likelihood term for VNNGP factorizes over data points. Unlike SVGP that considers all $M$ inducing points in making the prediction for one data point, VNNGP makes use of the sparse prior in Eq 9 such that the prediction is based on only $K$ nearest inducing points. As a result, VNNGP's data likelihood term is reduced to + +$$ +\sum_ {i = 1} ^ {N} \int p \left(f _ {i} \mid \mathbf {u} _ {n (i)}\right) q \left(\mathbf {u} _ {n (i)}\right) \log p \left(y _ {i} \mid f _ {i}\right) d f _ {i} d \mathbf {u} _ {n (i)} \tag {13} +$$ + +where only $K$ nearest inducing points are involved in computing the expected log likelihood for each data point. + +# 3.2. Computing the KL Divergence + +We now show how we can write KL divergence as a summation over inducing points. Note that it is not possible for the standard SVGP: SVGP's KL requires accessing parameters for all inducing points at the same time. + +We first break the prior into a chain of conditionals using the nearest neighbor assumption in Eq 9 and utilize the mean-field assumption in Eq 10: + +$$ +\begin{array}{l} \operatorname {K L} \left[ q (\mathbf {u}) \| p (\mathbf {u}) \right] = \operatorname {K L} \left[ \prod_ {j = 1} ^ {M} q (u _ {j}) \| \prod_ {j = 1} ^ {M} p (u _ {j} | \mathbf {u} _ {n (j)}) \right] \\ = \underset {q (\mathbf {u})} {\mathbb {E}} \left[ \sum_ {j = 1} ^ {M} \log \frac {q \left(u _ {j}\right)}{p \left(u _ {j} \mid \mathbf {u} _ {n (j)}\right)} \right] \tag {14} \\ \end{array} +$$ + +exchanging the order of summation and expectation and integrating out irrelevant variables + +$$ +\begin{array}{l} = \sum_ {j = 1} ^ {M} \underset {q \left(\mathbf {u} _ {n (j)}\right)} {\mathbb {E}} \left[ \mathbb {E} _ {q \left(u _ {j}\right)} \left[ \log \frac {q \left(u _ {j}\right)}{p \left(u _ {j} \mid \mathbf {u} _ {n (j)}\right)} \right] \right] (15) \\ = \sum_ {j = 1} ^ {M} \mathbb {E} _ {q \left(\mathbf {u} _ {n (j)}\right)} \left[ \mathrm {K L} \left[ q \left(u _ {j}\right) \| p \left(u _ {j} \mid \mathbf {u} _ {n (j)}\right) \right] \right] (16) \\ \end{array} +$$ + +where + +$$ +\begin{array}{l} p \left(u _ {j} \mid \mathbf {u} _ {n (j)}\right) = \mathcal {N} \left(u _ {j} \mid \mathbf {k} _ {n (j), j} ^ {\top} \mathbf {K} _ {n (j), n (j)} ^ {- 1} \mathbf {u} _ {n (j)}, \right. (17) \\ k _ {j, j} - \mathbf {k} _ {n (j), j} ^ {\top} \mathbf {K} _ {n (j), n (j)} ^ {- 1} \mathbf {k} _ {n (j), j}). (18) \\ \end{array} +$$ + +# 3.3.Advantages + +Having factorized the data likelihood term and KL divergence over data points and inducing points, we are now ready to present VNNGP's key advantages as follows. + +Stochastic optimization. The summation structure of VN-NGP's ELBO, as detailed in Eq 13 and 16, makes it immediately available for stochastic optimization: in every training + +iteration, we randomly sample a mini-batch of training data indices $\mathcal{I} = \{i_k\}_{k=1}^{N_b}$ and a mini-batch of inducing point indices $\mathcal{J} = \{j_l\}_{l=1}^{M_b}$ ; we then optimize the unbiased estimate of the ELBO as follows + +$$ +\begin{array}{l} \mathcal {L} _ {\text {V N N G P}} \approx \frac {N}{N _ {b}} \sum_ {i \in \mathcal {I}} \underset {q \left(f _ {i}\right)} {\mathbb {E}} [ \log p \left(y _ {i} \mid f _ {i}\right) ] \tag {19} \\ - \frac {M}{M _ {b}} \sum_ {j \in \mathcal {J}} \underset {q (\mathbf {u} _ {n (j)})} {\mathbb {E}} \left[ \mathrm {K L} \left[ q (u _ {j}) \| p (u _ {j} | \mathbf {u} _ {n (j)}) \right] \right]. \\ \end{array} +$$ + +We include the exact computation of ELBO in Appendix A. Note that the sampling distributions for data points and inducing points can be arbitrary as long as both remain marginally a uniform distribution. We emphasize that this is a key advantage over SVGP: we are not able to perform stochastic optimization for inducing points with SVGP. + +Computational complexity. Once the nearest neighbor structure is computed, optimizing the objective in Eq 19 requires $O((N_b + M_b)K^3)$ computations for inverting $K \times K$ kernel matrices induced by nearest neighbor mini-batches. See Appendix A for mathematical details. + +The computational overhead comes from determining nearest neighbor structures for observations and inducing points. The brute-force complexity of finding any point's $K$ nearest neighbors within $M$ points is $O(KM)$ . With the help of modern similarity search packages such as Johnson et al. (2017), we are able to dramatically speed up billion-scale similarity search with gpus. For example, for medium-sized datasets, e.g. Protein ( $N = 25.6\mathrm{K}$ , $D = 9$ ), it takes no more than 30 seconds to build up nearest neighbor structures with $K = 256$ and $M = N$ on an NVIDIA RTX2080 gpu; for the largest dataset we experiment with (Covtype: $N = 372\mathrm{K}$ and $D = 54$ ), it takes approximately 12 minutes with $K = 256$ and $M = N$ . + +More inducing points. Since the training complexity is free of $N$ and $M$ , we are able to place inducing points at every observed location and scale $M$ to $N$ . We enjoy several benefits by doing so. First, we greatly boost the model capacity, as opposed to a low-rank approximation where several observations "share" one inducing point. Moreover, we avoid optimizing inducing point locations as the standard SVGP training procedure requires. This is a huge advantage since it saves training cost and the optimization of inducing locations is in general non-convex and more difficult. Finally, we only need to compute the nearest neighbor structure once before training, or otherwise we need to recompute it frequently since inducing locations are being updated. + +# 3.4. Comparison to Related Methods + +The method most related to VNNGP is the Sparse Within Sparse Gaussian Process (SWSGP) method of Tran et al. + +(2021). SWSGP also builds upon SVGP and further imposes sparsity over $M$ inducing points $\mathbf{u}$ by defining a hierarchical prior. Essentially, in each training iteration, SWSGP randomly samples a minibatch of data point indices $\mathcal{I} = \{i_k\}_{k=1}^{N_b}$ and optimizes the following ELBO + +$$ +\begin{array}{l} \mathcal {L} _ {\mathrm {S W S G P}} = \frac {N}{N _ {b}} \sum_ {i \in \mathcal {I}} \mathbb {E} _ {q (f _ {i})} [ \log p (y _ {i} | f _ {i}) ] \\ - \frac {1}{N _ {b}} \sum_ {i \in \mathcal {I}} \operatorname {K L} \left[ q \left(\mathbf {u} _ {n (i)}\right) \| p \left(\mathbf {u} _ {n (i)}\right) \right], \tag {20} \\ \end{array} +$$ + +where $n(i)$ are indices of inducing point locations from $\{\mathbf{z}_j\}_{j=1}^M$ that are top- $K$ nearest to $\mathbf{x}_i$ . Similar to VNNGP, evaluating Eq. 20 requires $O(N_b K^3)$ computation. + +There are two key differences between VNNGP and SWSGP. First, the two methods introduce sparsity through a different generative process. SWSGP applies a hierarchical prior; Consequently, the marginal prior for either $p(\mathbf{f})$ or $p(\mathbf{u})$ is no longer Gaussian. VNNGP, on the other hand, considers a sparse approximation to the prior precision matrix. The resulting process is still a GP but under an approximated kernel. While it is not immediately clear how these differing marginal distribution impact downstream performance, in this sense the VNNGP generative process more faithfully replicates the exact GP prior. + +The second difference is the training objective. As can be seen, the first term of Eq. 20 (data likelihood) is identical to that of VNNGP (Eq. 19). However, the KL divergence term is where two objectives differ. SWSGP optimizes a "local" KL divergence that only involves inducing points within a local neighborhood around current batch of training data. In fact, we prove (see appendix C) that SWSGP's KL divergence always underestimates the SVGP KL divergence: + +$$ +\operatorname {K L} \left[ q \left(\mathbf {u} _ {n (i)}\right) \| p \left(\mathbf {u} _ {n (i)}\right) \right]) \leq \operatorname {K L} \left[ q (\mathbf {u}) \| p (\mathbf {u}) \right], \tag {21} +$$ + +for any subset $n(i)$ . Additionally, the amount of underestimation depends on size of $n(i)$ . + +We hypothesize that SWSGP's KL, due to its "local" characteristic, may not sufficiently regularize the variational distribution—especially when $K \ll M$ —which may make the model more prone to overfitting. Conversely, though VNNGP's KL does not equal the exact KL, it does (in expectation) consider the joint distribution over all inducing points. Optimizing this term will regularize the variational distribution towards the GP prior at all input locations. We investigate our hypotheses in the experiments section. + +Another method that also combines nearest neighbor approximations with variational inference is Amortized Inference GP (Liu & Liu, 2019). However, their method avoids computing certain terms of the KL divergence, and in doing so makes it impossible to simultaneously optimize kernel + +![](images/a1dfe56cafd0b777b7ea2a191991eff833482a640f6c8e23a6ee4dce643bbb0e.jpg) +Figure 2. Test set RMSE and NLL as a function of number of nearest neighbors $K$ for VNNGP (green) on Elevators (left column) and UKHousing datasets (right column). Results for SVGP (blue dashed) and exact GP (purple dotted) are included as baselines. + +hyperparameters using the ELBO. By contrast, the VNNGP objective enables gradient-based kernel learning. + +# 4. Experiments + +We first demonstrate how sensitive our model is to the number of nearest neighbors $K$ . Recognizing that our method is similar to SWSGP, our next task is to characterize the differences between two methods and investigate our hypotheses in Sec 3.4. Finally, we evaluate VNNGP and other methods on a wide range of real regression and classification datasets. Unless stated otherwise, for all experiments, VNNGP applies a random ordering of inducing points, VNNGP and SWSGP set inducing points at observed locations and use a mean-field variational approximation, and SVGP uses 1024 inducing points and a full-rank variational approximation. + +# 4.1. Sensitivity to number of nearest neighbors $K$ + +Our first goal is to see how the number of nearest neighbors $K$ impact VNNGP's performance. We choose two datasets, Elevators with dimension $D = 16$ (Asuncion & Newman, 2007), and UKHousing (https://landregistry.data.gov.uk/), a spatial dataset with $D = 2$ , as we expect low-rank approximations to work better in high dimensional settings while nearest neighbor methods are more suitable for spatial problems that are sparse in nature. We fit VNNGP with $K \in [32, 64, 128, 256]$ . Since these two datasets are modeled with Gaussian likelihood, we are able to fit exact GP (Wang et al., 2019) as a baseline. We also include SVGP as a low-rank variational alternative. We present their test set predictive performance, the root mean squared error (RMSE) and negative log likelihood (NLL), in Figure 2. From the figure, we see that as $K$ increases, both test RMSE and NLL for VNNGP decrease, suggesting a better performance. By comparing the three methods, we note that exact GP does not always yield the best RMSE or NLL. This result could + +be due to model misspecification, as observed in previous literature (Wang et al., 2019; Potapczynski et al., 2021). Moreover, SVGP performs better on the high-dimensional Elevators dataset, whereas VNNGP with $K = 32$ already outperforms SVGP and is less sensitive to $K$ on the spatial UKHousing dataset. + +# 4.2. Comparison to SWSGP + +Building on the analysis in Section 3.4, we now aim to compare VNNGP to the related SWSGP method. Recall that the primary difference between these methods is the training objective (the KL divergence term in particular). We first empirically demonstrate how these two objectives differ, and then study its surprisingly significant impact on model fitting and selection. + +KL divergence comparison. We first investigate the difference between the VNNGP and SWSGP KL divergence terms. Specifically, we are interested in how their KL terms change as we vary $K$ . We initialize VNNGP and SWSGP with the same configuration: the inducing points are placed on a 1-dimensional grid with even spacing of 1, the variational means $\{m_i\}$ are obtained by sampling a GP under a squared exponential kernel with lengthscale 5 and outputscale 1, and the variational variances $\{s_i\}$ are set to 1. For both methods, we compute their KL terms by varying the kernel lengthscale parameter and # of nearest neighbors $K$ . A special note is that when $K = M$ , KL by either method should be equal to the KL by SVGP in Eq. 8. + +We plot the SWSGP and VNNGP KL terms as a function of $K$ under different kernel lengthscales in Figure 3. From this figure, we first confirm that VNNGP and SWSGP recover the SVGP KL divergence (dotted blue line) at $K = M$ . Moreover, both methods tend to underestimate KL (recall from Section 3.4 that SWSGP provably underestimates this term). Notably, VNNGP converges rapidly to the true KL divergence, especially for small lengthscale settings. For example, when the lengthscale is 5, the VNNGP KL divergence is indistinguishable from the true KL divergence for all $K \geq 5$ . We include results under different settings in appendix D.1 and observe similar patterns. + +Fitting models in high observational noise setting. We now study the impact of KL divergence on the inferred posterior distribution. Recall that the KL term of the ELBO regularizes the variational distribution towards the GP prior. If the regularization is not sufficient, the ELBO will be dominated by the data likelihood term, which could overfit the predictive distribution to the observed data. + +Hence, we conduct a simulation experiment in the presence of high observational noise: We draw $N = 50$ observations from a GP under a squared exponential kernel with length- + +![](images/36ac73a7ff94029472543ee8e4736080373bf01de6e0e3eda9fd4f24d8502d57.jpg) +Figure 3. KL divergence computed by VNNGP (green) and SWSGP (orange) as a function of $K$ for different prior kernel lengthscales. Both methods tend to underestimate the KL (SWSGP provably), and converges to the exact value computed by SVGP (blue dotted) as $K \to M$ . Moreover, VNNGP's KL is closer to the exact one compared to SWSGP for the same $K$ across all cases. + +![](images/2f8bfc01d33f1efc6c13f66719a500c0d021c8b8fcced4c93a9832d8b05f6d3d.jpg) + +![](images/c212f56a2f28775ae027857544f416fc693b995f479165fd56284d41960e33a2.jpg) + +![](images/9d1bd5429381c77288d972d43bcf3a444c1d6858f9eb57bb9282d20042ba2262.jpg) + +![](images/5cac50ca69c733f96caeafadcbcc0b4a01172aa9494e7ec525516c43e6b4329b.jpg) + +![](images/bac3e0d2e8897442539017a8bf9edadd33c20cb74e0c9d642601c61e0779cbb6.jpg) + +![](images/044f317266301aab5a78e61d3401fff0d89d6baa0015f1375d4279f4e0fc52d6.jpg) + +![](images/11c536dac247f26d8f0046bb5ddbc269d2402ae43fd6457db28d8130a05ceebc.jpg) +Figure 4. Posterior by Exact GP (purple), SVGP (blue), VNNGP (green) and SWSGP (orange), with $95\%$ uncertainty interval. The grey line is to the true data generating process, and scattering black dots are highly noisy observations. + +![](images/73da0afea7aa3975272e66864fd78dba95b1af64d53cbad3ee64e13e91e41e0c.jpg) + +scale 5 and outputscale 5, and add iid noise from $\mathcal{N}(0,5)$ . There are two dense clusters of observations around $x = 0$ and $x = 50$ , and scarcely scattered observations in between. We fit four models—exact GP, SVGP, VNNGP and SWSGP—to the observed data. We fix all hyperparameters corresponding to the true data generating process, and only optimize variational parameters. For the three variational methods, inducing points are set to the locations of observed data $(M = N)$ . All variational models use mean-field variational approximations. Both VNNGP and SWSGP use $K = 5$ nearest neighbors. + +In Fig 4, we display the true data generating process, noisy observations and posteriors of all four models. The SVGP and VNNGP posteriors are qualitatively close to that of exact GP, whereas SWSGP's posterior deviates from the underlying GP function in the data-sparse region. We suspect SWSGP's behavior to be due to its underestimating local KL divergence. As we discuss in Section 3.4, the "local" KL divergence of SWSGP will not regularize the variational distribution towards a globally smooth distribution. In particular, the SWSGP KL divergence concentrates on the data-dense regions, leading to a lack of regularization in the data-sparse region. By contrast, the VNNGP model is effectively regularized towards the GP prior throughout the input space. + +Model selection. Finally, we turn to model selection by maximizing the ELBO. Our goal is to see whether VNNGP or SWSGP is sensitive to different settings of hyperparameters, in particular, the likelihood noise. + +We first fit exact GP to the UKHousing dataset under a Matern 5/2 kernel and a Gaussian likelihood. We copy and fix the exact GP kernel hyperparameters to SVGP, VNNGP, and SWSGP models. However, we vary the value of likelihood noise from 0.001 to 1.0. We then optimize only the variational parameters of these three methods for 300 epochs. In Figure 5, we plot the negative training ELBO and test NLL as a function of likelihood noise for each method. We denote the noise parameters that maximize each method's training objective, as well as the noise parameter selected by the exact GP. In agreement with prior work (Bauer et al., 2016), we find that SVGP tends to overestimate the noise parameter. Both nearest neighbor methods tend to underestimate the likelihood noise. However, the ELBO of SWSGP monotonically decreases as likelihood noise decreases, whereas the VNNGP ELBO achieves an optimum as a noise of 0.1. If we use the ELBO as a model selection criterion (as is often the case for variational methods), the resulting SWSGP model will have very low likelihood noise which results in poor test NLL. Conversely, the VNNGP training ELBO is highly predictive of the test NLL, as both are roughly optimized as the same likelihood noise value. We note that SWSGP's behavior in this setting is likely due to having $M = N$ . We repeat this experiment for SWSGP models that use $M \ll N$ inducing points in Appendix D.2, and find that these models favor more reasonable likelihood noise values. These observations suggest that the ELBO is a good model selection criteria for VNNGP; however, ELBO optimization may result in extreme hyperparameters for SWSGP with large $M$ . + +# 4.3. Predictive performance on real datasets + +We conduct an extensive evaluation of our method on real datasets. We consider a wide range of high dimensional and spatiotemporal datasets from the UCI repository (Asuncion & Newman, 2007). In addition we include three spatial datasdets, UKHousing as mentioned in Section 4.1, Precipi + +
DatasetNDExactGPsgGPNLL
SVGPSWSGP-MSWSGP-NVNNGP
PoleTele9.6K26-.509 ± .005-.558 ± .016-.708 ± .003-.898 ± .029-.962 ± .023-1.160 ± .014
Elevators10.6K16.464 ± .011.432 ± .013.417 ± .017.691 ± .049.767 ± .026.463 ± .020
Bike11.1K17-.744 ± .00753.364 ± 27.690-1.849 ± .016-1.684 ± .024-1.405 ± .096-1.690 ± .057
Kin40K25.6K8-.149 ± .001.701 ± .139-.399 ± .003-.747 ± .016-1.010 ± .005-1.016 ± .004
Protein25.6K91.044 ± .003.914 ± .004.967 ± .005.909 ± .0061.505 ± .080.671 ± .009
KEGG31.2K20-.713 ± .004-1.013 ± .035-1.000 ± .011-1.039 ± .01014.925 ± .838-1.039 ± .018
KEGGU40.7K26-.471 ± .003-.673 ± .005-.680 ± .002-.719 ± .00441.675 ± .427-.715 ± .004
Precipitation64.8K3——.818 ± .004.396 ± .0011.809 ± .224.145 ± .002
UKHousing116K2.703 ± .003.598 ± .001.879 ± .004.455 ± .0031.050 ± .013.367 ± .003
3DRoad278K3.993 ± .000.712 ± .001.325 ± .005.584 ± .003-1.476 ± .079-.048 ± .406
Covtype372K54——.234 ± .001.172 ± .001.069 ± .000.132 ± .000
+ +Table 1. Test set NLL (mean ± 1 standard error over 3 random seeds) on high-dimensional datasets (top 7 ones) and spatial datasets (bottom 4 ones). VNNGP achieves lowest NLL for most datasets. The result for RMSE is included in Table 2 in appendix. + +![](images/1d36696d377139ffa8406bc0c6c92b6be0a2b60aba2297656598a38b3585b04a.jpg) +Figure 5. Negative training ELBO (solid line) and test NLL (dotted line) as a function of the likelihood noise by SVGP (blue), VNNGP (green) and SWSGP (orange) on UKHousing dataset. All ELBO and NLL values are scaled to [0,1]. The x-axis is in log-scale. The noise value picked by maximizing ELBO for each method is indicated by the vertical dashed line with corresponding color. The vertical purple line indicates the value (0.28) learned by exact GP. + +tation (a monthly precipitation dataset with $D = 3$ ) (Lyon, 2004; Lyon & Barnston, 2005) and Covtype (a tree cover dataset with $D = 54$ ) $^{2}$ (Blackard & Dean, 1999). Our goal is primarily to compare VNNGP to other variational methods; however, we include the additional baselines of Exact GP—utilizing the methodology of Wang et al. (2019)—and sgGP (Chen et al., 2020)—which is a non-variational nearest neighbor benchmark. We do not compare to the Amortized Inference GP since it is not amenable to kernel learning. For VNNGP and SWSGP, we tune the number of nearest neighbors $K$ in {32, 256}. Additionally, we include two variants of the SWSGP method: with SWSGP- $N$ we set all inducing points at observed locations, and with SWSGP- $M$ we allow using $M < N$ inducing points – the latter is what Tran et al. (2021) originally experimented with. In particular for SWSGP- $M$ , we recompute nearest neighbors every epoch and we tune $M$ in {1024, 2048, 4096, 8192}. For sgGP, the subsampled datasets are constructed by selecting a random point $x$ , $y$ and its 15 nearest neighbors as in + +Chen et al. (2020). Each dataset is randomly split to $64\%$ training, $16\%$ validation and $20\%$ testing sets. Precipitation dataset uses a student-t likelihood and Covtype dataset uses a bernoulli likelihood, otherwise a Gaussian likelihood is used. All kernels are Matern 5/2 with a separate lengthscale per dimension. We run each model with three random seeds. For each random seed, VNNGP applies different random ordering of inducing points. See appendix D.3.1 for more details. + +We report test NLL in Table 1, and the result for test RMSE is included in Table 2 of appendix. From the tables, we make three key comparisons. (i) Exact GP and sgGP cannot run on problems with non-Gaussian likelihoods (Precipitation and Covtype) while variational methods are still viable. (ii) VNNGP substantially outperforms other nearest neighbor methods. Specifically, we note that sgGP and SWSGP- $N$ sometimes obtain a very high NLL, while SWSGP- $M$ does not suffer from this issue. We suspect this result is attributed to that sgGP and SWSGP- $N$ tend to learn a very small likelihood noise on certain datasets (we report the learned noise in Table 3 of appendix); Also recall from Section 4.2 that maximizing the ELBO of SWSGP- $N$ leads to extremely small noise values. (iii) While there are a few datasets (Elevators and Bike) where SVGP excels, VNNGP outperforms SVGP especially on large-scale, spatial datasets. SVGP's performance is limited by using $M = 1024 \ll N$ inducing points, which is detrimental on these problems, while VNNGP has the ability to scale $M$ to $N$ with a sparse approximation. + +Finally, we note that both VNNGP and SWSGP- $N$ use much more parameters than SVGP. It is natural to ask whether this fact will impede their convergence speeds. In Figure 6, we plot the training loss versus number of training iterations for SVGP, VNNGP and SWSGP- $N$ on Bike and UKHousing. We observe that all three methods reach convergence by the end of training. Moreover, VNNGP's convergence speed is comparable to SVGP. This result demonstrates that the larger number of model parameters does not hurt VNNGP's optimization process, making + +![](images/f833a1292c350f3b683da26c9c4a72939317a3371650fd48f46faa05614b58b1.jpg) +Figure 6. Training loss versus iterations on Bike and UKhousing. The training loss is averaged over every 100 iterations and all loss values are standardized. Despite VNNGP has more parameters, its convergence speed is comparable to SVGP. + +![](images/c8dd9a284f63d57083c56709ae2893c364addd903f0094dfee73614d0b92e218.jpg) + +it a practical model to use. + +# 5. Discussion + +In this work, we propose VNNGP, a scalable GP method that combines a sparse precision approximation with variational inference. This sparse approximation allows VNNGP to use orders of magnitude more inducing points than other variational methods. We perform an extensive empirical evaluation and show that VNNGP obtains strong performance compared to other baselines. + +We consider two extensions for future works. Similar to Liu & Liu (2019) and Jafrasteh et al. (2021), we can apply amortized learning to variational parameters. This could greatly reduce the number of parameters and potentially accelerate optimization. Another extension is to select nearest neighbors using metrics other than Euclidean distance. For example, Kang & Katzfuss (2021) suggest that the prior covariance function can be a metric to select the nearest neighbor set. This could enhance VNNGP's accuracy on problems with anisotropic or periodic covariance structure. + +# References + +Álvarez, M., Luengo, D., Titsias, M., and Lawrence, N. D. Efficient multioutput Gaussian processes through variational inducing kernels. In Artificial Intelligence and Statistics, pp. 25-32, 2010. +Asuncion, A. and Newman, D. Uci machine learning repository, 2007. +Bauer, M., van der Wilk, M., and Rasmussen, C. E. Understanding probabilistic sparse gaussian process approximations. In Advances in Neural Information Processing Systems, 2016. +Blackard, J. A. and Dean, D. J. Comparative accuracies of artificial neural networks and discriminant analysis in predicting forest cover types from cartographic variables. Computers and electronics in agriculture, 24(3):131-151, 1999. + +Bui, T. D. and Turner, R. E. Tree-structured gaussian process approximations. Advances in Neural Information Processing Systems, 27, 2014. +Burt, D., Rasmussen, C. E., and Van Der Wilk, M. Rates of convergence for sparse variational gaussian process regression. In International Conference on Machine Learning, pp. 862-871, 2019. +Chen, H., Zheng, L., Al Kontar, R., and Raskutti, G. Stochastic gradient descent in correlated settings: A study on gaussian processes. Advances in Neural Information Processing Systems, 33, 2020. +Cheng, C.-A. and Boots, B. Variational inference for Gaussian process models with linear complexity. Advances in Neural Information Processing Systems, 2017. +Csato, L., Fokoué, E., Opper, M., Schottky, B., and Winther, O. Efficient approaches to gaussian process classification. In Advances in neural information processing systems, pp. 251-257. CiteSeer, 2000. +Damianou, A. and Lawrence, N. D. Deep gaussian processes. In Artificial intelligence and statistics, pp. 207-215. PMLR, 2013. +Datta, A. Nearest-neighbor sparse cholesky matrices in spatial statistics. Wiley Interdisciplinary Reviews: Computational Statistics, pp. e1574, 2021a. +Datta, A. Sparse cholesky matrices in spatial statistics. arXiv preprint arXiv:2102.13299, 2021b. +Datta, A., Banerjee, S., Finley, A. O., and Gelfand, A. E. Hierarchical nearest-neighbor gaussian process models for large geostatistical datasets. Journal of the American Statistical Association, 111(514):800-812, 2016a. +Datta, A., Banerjee, S., Finley, A. O., Hamm, N. A., and Schaap, M. Nonseparable dynamic nearest neighbor gaussian process models for large spatio-temporal data with an application to particulate matter analysis. The annals of applied statistics, 10(3):1286, 2016b. +Finley, A. O., Datta, A., Cook, B. C., Morton, D. C., Andersen, H. E., and Banerjee, S. Applying nearest neighbor gaussian processes to massive spatial data sets: Forest canopy height prediction across tanana valley alaska. arXiv preprint arXiv:1702.00434, 535, 2017. +Finley, A. O., Datta, A., Cook, B. D., Morton, D. C., Andersen, H. E., and Banerjee, S. Efficient algorithms for bayesian nearest neighbor gaussian processes. Journal of Computational and Graphical Statistics, 28(2):401-414, 2019. + +Gibbs, M. N. and MacKay, D. J. Variational gaussian process classifiers. IEEE Transactions on Neural Networks, 11(6):1458-1464, 2000. +Gramacy, R. B. and Apley, D. W. Local gaussian process approximation for large computer experiments. Journal of Computational and Graphical Statistics, 24(2):561-578, 2015. +Guinness, J. Permutation and grouping methods for sharpening gaussian process approximations. Technometrics, 60(4):415-429, 2018. +Hensman, J., Fusi, N., and Lawrence, N. D. Gaussian processes for big data. In Uncertainty in Artificial Intelligence, 2013. +Hensman, J., Matthews, A. G. d. G., Filippone, M., and Ghahramani, Z. Mcmc for variationally sparse gaussian processes. arXiv preprint arXiv:1506.04000, 2015. +Hensman, J., Durrande, N., Solin, A., et al. Variational fourier features for gaussian processes. *J. Mach. Learn.* Res., 18(1):5537-5588, 2017. +Jafrasteh, B., Villacampa-Calvo, C., and Hernández-Lobato, D. Input dependent sparse gaussian processes. arXiv preprint arXiv:2107.07281, 2021. +Jankowiak, M. and Pleiss, G. Scalable cross validation losses for gaussian process models. arXiv preprint arXiv:2105.11535, 2021. +John, S. and Hensman, J. Large-scale cox process inference using variational fourier features. In International Conference on Machine Learning, pp. 2362-2370, 2018. +Johnson, J., Douze, M., and Jégou, H. Billion-scale similarity search with gpus. arXiv preprint arXiv:1702.08734, 2017. +Kang, M. and Katzfuss, M. Correlation-based sparse inverse cholesky factorization for fast gaussian-process inference. arXiv preprint arXiv:2112.14591, 2021. +Katzfuss, M., Guinness, J., et al. A general framework for vecchia approximations of gaussian processes. Statistical Science, 36(1):124-141, 2021. +Kim, H.-M., Mallick, B. K., and Holmes, C. C. Analyzing nonstationary spatial data using piecewise gaussian processes. Journal of the American Statistical Association, 100(470):653-668, 2005. +Lázaro-Gredilla, M. and Figueiras-Vidal, A. R. Interdomain gaussian processes for sparse inference using inducing features. In NIPS, volume 22, pp. 1087-1095. CiteSeer, 2009. + +Liu, L. and Liu, L. Amortized variational inference with graph convolutional networks for gaussian processes. In The 22nd International Conference on Artificial Intelligence and Statistics, pp. 2291-2300. PMLR, 2019. +Lyon, B. The strength of el niño and the spatial extent of tropical drought. Geophysical Research Letters, 31(21), 2004. +Lyon, B. and Barnston, A. G. Enso and the spatial extent of interannual precipitation extremes in tropical land areas. Journal of Climate, 18(23):5095-5109, 2005. +Nguyen-Tuong, D., Peters, J., and Seeger, M. Local gaussian process regression for real time online model learning and control. In Proceedings of the 21st International Conference on Neural Information Processing Systems, pp. 1193-1200, 2008. +Park, C. and Apley, D. Patchwork kriging for large-scale gaussian process regression. The Journal of Machine Learning Research, 19(1):269-311, 2018. +Pleiss, G., Jankowiak, M., Eriksson, D., Damle, A., and Gardner, J. Fast matrix square roots with applications to gaussian processes and bayesian optimization. Advances in Neural Information Processing Systems, 2020. +Potapczynski, A., Wu, L., Biderman, D., Pleiss, G., and Cunningham, J. P. Bias-free scalable gaussian processes via randomized truncations. arXiv preprint arXiv:2102.06695, 2021. +Ranganath, R., Gerrish, S., and Blei, D. Black box variational inference. In Artificial intelligence and statistics, pp. 814-822. PMLR, 2014. +Rasmussen, C. E. and Williams, C. K. Gaussian processes for machine learning, volume 2. MIT press Cambridge, MA, 2006. +Salimbeni, H., Eleftheriadis, S., and Hensman, J. Natural gradients in practice: Non-conjugate variational inference in gaussian process models. In International Conference on Artificial Intelligence and Statistics, pp. 689-697. PMLR, 2018. +Shi, J., Titsias, M., and Mnih, A. Sparse orthogonal variational inference for Gaussian processes. In International Conference on Artificial Intelligence and Statistics, pp. 1932-1942, 2020. +Stein, M. L., Chi, Z., and Welty, L. J. Approximating likelihoods for large spatial data sets. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 66 (2):275-296, 2004. + +Taylor-Rodriguez, D., Finley, A. O., Datta, A., Babcock, C., Andersen, H.-E., Cook, B. D., Morton, D. C., and Banerjee, S. Spatial factor models for high-dimensional and large spatial data: An application in forest variable mapping. Statistica Sinica, 29:1155, 2019. +Titsias, M. K. Variational learning of inducing variables in sparse Gaussian processes. In International Conference on Artificial Intelligence and Statistics, pp. 567-574, 2009. +Tran, G.-L., Milios, D., Michiardi, P., and Filippone, M. Sparse within sparse gaussian processes using neighbor information. In International Conference on Machine Learning, pp. 10369-10378. PMLR, 2021. +van der Wilk, M., Dutordoir, V., John, S., Artemev, A., Adam, V., and Hensman, J. A framework for interdomain and multioutput gaussian processes. arXiv preprint arXiv:2003.01115, 2020. +Vecchia, A. V. Estimation and model identification for continuous spatial processes. Journal of the Royal Statistical Society: Series B (Methodological), 50(2):297-312, 1988. +Wang, K., Pleiss, G., Gardner, J., Tyree, S., Weinberger, K. Q., and Wilson, A. G. Exact gaussian processes on a million data points. In Advances in Neural Information Processing Systems, pp. 14648-14659, 2019. +Wilson, A. and Nickisch, H. Kernel interpolation for scalable structured gaussian processes (kiss-gp). In International Conference on Machine Learning, pp. 1775-1784, 2015. +Wu, L., Miller, A., Anderson, L., Pleiss, G., Blei, D., and Cunningham, J. Hierarchical inducing point gaussian process for inter-domain observations. In International Conference on Artificial Intelligence and Statistics, pp. 2926-2934. PMLR, 2021. + +# A. Computing the ELBO for VNNGP + +In this section, we derive the exact computation of the ELBO for VNNGP and analyze the computational complexity. + +Following Eq 12, and using the derivations from Eq 13 and Eq 16, we have + +$$ +\begin{array}{l} \mathcal {L} _ {\mathrm {V N N G P}} = \underbrace {\sum_ {i = 1} ^ {N} \mathbb {E} _ {q (\mathbf {f} , \mathbf {u})} \left[ \log p \left(y _ {i} \mid f _ {i}\right) \right]} _ {\text {d a t a l i k e h o o d}} - \underbrace {\operatorname {K L} \left[ q (\mathbf {u}) \| p (\mathbf {u}) \right]} _ {\text {K L d i v e r g e n c e}}, (22) \\ = \underbrace {\sum_ {i = 1} ^ {N} \int q \left(f _ {i}\right) \log p \left(y _ {i} \mid f _ {i}\right) d f _ {i}} _ {\text {d a t a l i k e l i h o o d}} - \underbrace {\sum_ {j = 1} ^ {M} \mathbb {E} _ {q \left(\mathbf {u} _ {n (j)}\right)} \left[ \mathrm {K L} \left[ q \left(u _ {j}\right) \| p \left(u _ {j} \mid \mathbf {u} _ {n (j)}\right) \right] \right]} _ {\text {k l d i v e r g e n c e}}. (23) \\ \end{array} +$$ + +where + +$$ +\begin{array}{l} q \left(f _ {i}\right) = \mathbb {E} _ {q (\mathbf {u})} \left[ p \left(f _ {i} \mid \mathbf {u} _ {n (i)}\right) \right] (24) \\ = \mathcal {N} \left(f _ {i} \mid \mathbf {k} _ {n (i), i} ^ {\top} \mathbf {K} _ {n (i), n (i)} ^ {- 1} \mathbf {m} _ {n (i)}, k _ {i, i} - \mathbf {k} _ {n (i), i} ^ {\top} \mathbf {K} _ {n (i), n (i)} ^ {- 1} \mathbf {k} _ {n (i), i} + \mathbf {k} _ {n (i), i} ^ {\top} \mathbf {S} _ {n (i)} \mathbf {k} _ {n (i), i}\right), (25) \\ \end{array} +$$ + +and $\mathbf{S}_{n(i)}$ is a diagonal matrix with diagonal elements being $\mathbf{s}_{n(i)}$ . + +- The data likelihood term is tractable for Gaussian likelihood; otherwise, techniques such as MCMC sampling are required. The major complexity in evaluating each expected likelihood term comes from computing $q(f_{i})$ , which essentially resides at inverting the $K \times K$ matrix $\mathbf{K}_{n(i),n(i)}$ which takes $O(K^3)$ time. +- To compute the KL divergence term, we first compute each conditional KL term. Given fixed $\mathbf{u}_{n(j)}$ , + +$$ +\begin{array}{l} \operatorname {K L} \left[ q \left(u _ {j}\right) \| p \left(u _ {j} \mid \mathbf {u} _ {j}\right) \right] = \operatorname {K L} \left[ \mathcal {N} \left(u _ {j} \mid m _ {j}, s _ {j}\right) \| \mathcal {N} \left(u _ {j} \mid \mathbf {b} _ {j} ^ {\top} \mathbf {u} _ {n (j)}, f _ {j}\right) \right] (26) \\ = \frac {1}{2} \left[ \log f _ {j} - \log s _ {j} - 1 + f _ {j} ^ {- 1} s _ {j} + f _ {j} ^ {- 1} \left(m _ {j} - \mathbf {b} _ {j} ^ {\top} \mathbf {u} _ {n (j)}\right) ^ {2} \right], (27) \\ \end{array} +$$ + +where $f_{j} = k_{j,j} - \mathbf{k}_{n(j),j}^{\top}\mathbf{K}_{n(j),n(j)}^{-1}\mathbf{k}_{n(j),j}$ and $\mathbf{b}_j = \mathbf{K}_{n(j),n(j)}^{-1}\mathbf{k}_{n(j),j}$ . Integrating over $q(\mathbf{u}_{n(j)})$ and summing over inducing points we obtain, + +$$ +\operatorname {k l} \text {d i v e r g e n c e} = \frac {1}{2} \sum_ {j = 1} ^ {M} \log f _ {j} - \log s _ {j} - 1 + f _ {j} ^ {- 1} \left[ s _ {j} + \left(\mathbf {b} _ {j} ^ {2}\right) ^ {\top} \mathbf {s} _ {n (j)} + \left(m _ {j} - \mathbf {b} _ {j} ^ {\top} \mathbf {m} _ {n (j)}\right) ^ {2} \right], \tag {28} +$$ + +where $\mathbf{b}_j^2$ denotes the element-wise squared of vector $\mathbf{b}_j$ . Computing each summation term in the KL divergence requires inverting an $K\times K$ matrix, i.e. $\mathbf{K}_{n(j),n(j)}$ , which is $O(K^3)$ complexity. + +Therefore, the overall complexity of estimating the ELBO using a mini-batch of $N_{b}$ data points and a mini-batch of $M_{b}$ inducing points is $O(N_{b}K^{3} + M_{b}K^{3})$ . + +# B. Extension to more expressive variational family + +We now consider more expressive variational approximations and discuss how to mini-batch the VNNGP's ELBO computation. We assume the following variational family: + +$$ +q (\mathbf {u}) = \mathcal {N} (\mathbf {u} | \mathbf {m}, \tilde {\mathbf {L}} \tilde {\mathbf {L}} ^ {\top}) \tag {29} +$$ + +$$ +q (\mathbf {f} | \mathbf {u}) = \prod_ {i = 1} ^ {N} p \left(f _ {i} \mid \mathbf {u} _ {n (i)}\right) \tag {30} +$$ + +where $\tilde{\mathbf{L}}$ is the lower-triangular Cholesky factor for variational posterior covariance (potentially full-rank). The mean-field case discussed in appendix A is a special case where we make $\tilde{L}$ diagonal. + +Similarly, the ELBO under this variational family decomposes into the data likelihood term and the KL divergence term as in Eq 23 with the modification that + +$$ +\begin{array}{l} q \left(f _ {i}\right) = \mathbb {E} _ {q (\mathbf {u})} \left[ p \left(f _ {i} \mid \mathbf {u} _ {n (i)}\right) \right] (31) \\ = \mathcal {N} \left(f _ {i} \mid \mathbf {k} _ {n (i), i} ^ {\top} \mathbf {K} _ {n (i), n (i)} ^ {- 1} \mathbf {m} _ {n (i)}, k _ {i, i} - \mathbf {k} _ {n (i), i} ^ {\top} \mathbf {K} _ {n (i), n (i)} ^ {- 1} \mathbf {k} _ {n (i), i} + \mathbf {k} _ {n (i), i} ^ {\top} \tilde {\mathbf {L}} _ {n (i)} \tilde {\mathbf {L}} _ {n (i)} ^ {\top} \mathbf {k} _ {n (i), i}\right). (32) \\ \end{array} +$$ + +- The likelihood computation is similar to the mean-field case in appendix A, except that we are now integrating over $q(f_i)$ in Eq 32 instead of $q(f_i)$ in Eq 25. The former involves a potentially full-rank $K \times K$ variational covariance $\tilde{\mathbf{L}}_{n(i)}\tilde{\mathbf{L}}_{n(i)}^{\top}$ while the latter involves a diagonal one. +- KL divergence. + +For mathematical convenience, we consider the Cholesky composition of prior precision for inducing points $\mathbf{K}_{\mathbf{z},\mathbf{z}}^{-1} = \mathbf{L}^{\top}\mathbf{L}$ where $\mathbf{L}$ is a lower triangular matrix. Each row of $\mathbf{L}$ could be separately computed at $O(K^{3})$ cost (see Datta (2021a) for details). The KL divergence can be computed as follows: + +$$ +\begin{array}{l} \operatorname {K L} [ q (\mathbf {u}) \| p (\mathbf {u}) ] = \operatorname {K L} \left[ \mathcal {N} (\mathbf {m}, \tilde {\mathbf {L}} \tilde {\mathbf {L}} ^ {\top}) \| \mathcal {N} (0, (\mathbf {L} ^ {\top} \mathbf {L}) ^ {- 1}) \right] (33) \\ = \frac {1}{2} \left[ - 2 \log | \mathbf {L} | - 2 \log | \tilde {\mathbf {L}} | - M + \operatorname {t r} \left(\mathbf {L} ^ {\top} \mathbf {L} \tilde {\mathbf {L}} \tilde {\mathbf {L}} ^ {\top}\right) + \mathbf {m} ^ {\top} \mathbf {L} ^ {\top} \mathbf {L} \mathbf {m} \right] (34) \\ \end{array} +$$ + +Here we take a special treatment of the trace term: + +$$ +\begin{array}{l} \operatorname {t r} \left(\mathbf {L} ^ {\top} \mathbf {L} \tilde {\mathbf {L}} \tilde {\mathbf {L}} ^ {\top}\right) = \operatorname {t r} \left(\mathbf {L} \tilde {\mathbf {L}} \left(\mathbf {L} \tilde {\mathbf {L}}\right) ^ {\top}\right) (\text {b y}) \\ = \sum_ {i = 1} ^ {M} \sum_ {j = 1} ^ {M} \left(\mathbf {L} \tilde {\mathbf {L}}\right) _ {i j} ^ {2} (\text {b y d e f i n i t i o n o f t r a c e}) (36) \\ = \sum_ {i = 1} ^ {M} \sum_ {j = 1} ^ {M} \sum_ {k = 1} ^ {M} L _ {i j} ^ {2} \tilde {L} _ {j k} ^ {2} (\text {e x p a n d i n g t h e (L} \tilde {\mathbf {L}} _ {i j}) \text {t e r m s}) (37) \\ = \sum_ {i = 1} ^ {M} \sum_ {j = 1} ^ {M} \sum_ {k \in n (i) \cup \{i \}} \mathbf {L} _ {i k} ^ {2} \tilde {\mathbf {L}} _ {k j} ^ {2} (\text {u s i n g r o w - s p a r s i t y o f L}) (38) \\ \end{array} +$$ + +Now we re-write the KL by decomposing each term: + +$$ +\begin{array}{l} \operatorname {K L} [ q (\mathbf {u}) \parallel p (\mathbf {u}) ] = \frac {1}{2} \left[ - 2 \sum_ {i = 1} ^ {M} \log L _ {i i} - 2 \sum_ {i = 1} ^ {M} \tilde {L} _ {i i} - M + \sum_ {i = 1} ^ {M} \sum_ {j = 1} ^ {M} \sum_ {k \in n (i) \cup \{i \}} \mathbf {L} _ {i k} ^ {2} \tilde {\mathbf {L}} _ {k j} ^ {2} + \sum_ {i = 1} ^ {M} \left(\sum_ {k \in n (i) \cup \{i \}} L _ {i k} m _ {k}\right) ^ {2} \right] (39) \\ = \frac {1}{2} \sum_ {i = 1} ^ {M} \left[ - 2 \log L _ {i i} - 2 \tilde {L} _ {i i} - 1 + \sum_ {k \in n (i) \cup \{i \}} \mathbf {L} _ {i k} ^ {2} \sum_ {j = 1} ^ {M} \tilde {\mathbf {L}} _ {k j} ^ {2} + \left(\sum_ {k \in n (i) \cup \{i \}} L _ {i k} m _ {k}\right) ^ {2} \right], (40) \\ \end{array} +$$ + +which again factorizes over inducing points $i = 1:M$ . However, one should note that computing each KL term now scales $O(MK^3)$ due to the complexity in trace term $\sum_{k\in n(i)\cup \{i\}}\sum_{j = 1}^{M}\mathbf{L}_{ik}^{2}\tilde{\mathbf{L}}_{kj}^{2}$ . One can alleviate this issue by (i) obtaining a stochastic estimate for the trace term (i.e. sub-sample $j$ ) (ii) introduce sparsity structure in $\tilde{\mathbf{L}}$ / variational posterior. + +In summary, we explore the possibility of extending VNNGP to more expressive variational family. We show that under the full-rank variational family, the VNNGP's ELBO still factorizes over data points and inducing points. Computing each term now takes more computations and but techniques can be applied to improve the scalability. + +# C. KL divergence for SWSGP + +Here we re-state and prove the two claims about KL divergence for SWSGP in Section 3.4. + +Consider a fixed prior $p(\mathbf{u})$ and a fixed variational posterior $q(\mathbf{u})$ over $M$ inducing points $\mathbf{u}$ . Then we claim that + +1. SWSGP's KL divergence is always underestimating, if not equal to, SVGP's KL divergence. That is, for any subset $S \in \{1, 2, \dots, M\}$ . + +$$ +\operatorname {K L} [ q (\mathbf {u} _ {\mathcal {S}}) \| p (\mathbf {u} _ {\mathcal {S}}) ] \leq \operatorname {K L} [ q (\mathbf {u}) \| p (\mathbf {u}) ], \tag {41} +$$ + +2. The amount of underestimation depends on the size of the nearest neighbor set. More precisely, for any two subsets $S_1$ and $S_2$ such that $S_1 \subset S_2 \subset \{1, \dots, M\}$ , + +$$ +\operatorname {K L} \left[ q \left(\mathbf {u} _ {\mathcal {S} _ {1}}\right) \| p \left(\mathbf {u} _ {\mathcal {S} _ {1}}\right) \right] \leq \operatorname {K L} \left[ q \left(\mathbf {u} _ {\mathcal {S} _ {1}}\right) \| p \left(\mathbf {u} _ {\mathcal {S} _ {2}}\right) \right]. \tag {42} +$$ + +The proof for the above claims will immediately follow once we prove the following proposition. + +Proposition C.1. Let $p(\mathbf{u})$ and $q(\mathbf{u})$ be two distributions for an $M$ -dimensional random variable $\mathbf{u}$ , and let $\mathbf{u}_1$ be any sub-vector of $\mathbf{u}$ , then + +$$ +\operatorname {K L} \left[ q \left(\mathbf {u} _ {1}\right) \| p \left(\mathbf {u} _ {1}\right) \right] \leq \operatorname {K L} \left[ q (\mathbf {u}) \| p (\mathbf {u}) \right]. \tag {43} +$$ + +Proof. The proof relies on the chain rule of probability distribution, and the fact that the KL divergence is non-negative. + +Denote $\mathbf{u}_2$ as the remaining sub-vector by taking $\mathbf{u}_1$ out of $\mathbf{u}$ . It follows that + +$$ +\begin{array}{l} \operatorname {K L} [ q (\mathbf {u}) \| p (\mathbf {u}) ] (44) \\ = \int q (\mathbf {u}) \log \frac {q (\mathbf {u})}{p (\mathbf {u})} d \mathbf {u} (45) \\ = \iint q \left(\mathbf {u} _ {1}\right) q \left(\mathbf {u} _ {2} \mid \mathbf {u} _ {1}\right) \log \frac {q \left(\mathbf {u} _ {1}\right) q \left(\mathbf {u} _ {2} \mid \mathbf {u} _ {1}\right)}{p \left(\mathbf {u} _ {1}\right) p \left(\mathbf {u} _ {2} \mid \mathbf {u} _ {1}\right)} d \mathbf {u} _ {1} d \mathbf {u} _ {2} (46) \\ = I + I I, (47) \\ \end{array} +$$ + +where + +$$ +I \equiv \int q \left(\mathbf {u} _ {1}\right) \log \frac {q \left(\mathbf {u} _ {1}\right)}{p \left(\mathbf {u} _ {1}\right)} \left(\int q \left(\mathbf {u} _ {2} \mid \mathbf {u} _ {1}\right) d \mathbf {u} _ {2}\right) d \mathbf {u} _ {1} = \mathrm {K L} \left[ q \left(\mathbf {u} _ {1}\right) \| p \left(\mathbf {u} _ {1}\right) \right], \tag {48} +$$ + +$$ +I I \equiv \int q \left(\mathbf {u} _ {1}\right) \left(\int q \left(\mathbf {u} _ {2} \mid \mathbf {u} _ {1}\right) \log \frac {q \left(\mathbf {u} _ {2} \mid \mathbf {u} _ {1}\right)}{p \left(\mathbf {u} _ {2} \mid \mathbf {u} _ {1}\right)}\right) d \mathbf {u} _ {1} = \int q \left(\mathbf {u} _ {1}\right) \mathrm {K L} \left[ q \left(\mathbf {u} _ {2} \mid \mathbf {u} _ {1}\right) \| p \left(\mathbf {u} _ {2} \mid \mathbf {u} _ {1}\right) \right] d \mathbf {u} _ {1}. \tag {49} +$$ + +Note that for each $\mathbf{u}_1$ fixed, KL $[q(\mathbf{u}_2|\mathbf{u}_1)\parallel p(\mathbf{u}_2|\mathbf{u}_1)]$ defines a (conditional) KL divergence and is non-negative. Therefore, KL $[q(\mathbf{u})\parallel p(\mathbf{u})] = I + II\geq I$ , i.e. Eq 43 holds. + +# D. Experiment details and additional results + +# D.1. KL divergence comparison + +In Figure 7, we vary the setting in Section 4.2: different orderings of inducing points, different kernel functions, and real data v.s. synthetic data. From this figure, we observe similar patterns as from Figure 3. + +# D.2. Model selection + +We include additional results for the model selection experiment in Section 4.2. We refer the models in Section 4.2 by VNNGP- $N$ and SWSGP- $N$ that set inducing points on observed locations. Here, we consider the alternative versions, VNNGP- $M$ and SWSGP- $M$ , which use $M \ll N$ inducing points for $M \in \{1024, 8192\}$ , and the inducing point locations are learned during optimization. Correspondingly, the nearest neighbors are updated every training epoch for VNNGP and SWSGP. The other configurations are the same as Section 4.2 (especially, SVGP uses 1024 inducing points for all times). All inducing point locations are initialized by k-means clustering of observed locations. + +Comparing Figure 8 to Figure 5, we can see that (1) VNNGP- $M$ and VNNGP- $N$ have consistent behaviors in model selection. (2) While maximizing the ELBO of SwSGP- $N$ tends to favor a model with small likelihood noise, this is not the case for SwSGP- $M$ . As the noise parameter becomes extremely small, the training ELBO of SwSGP- $M$ decreases. As a result, optimizing SwSGP- $M$ leads to a model that has a "medium" likelihood noise and a low test NLL. These observations suggest that maximizing the ELBO for SwSGP- $N$ (and potentially for SwSGP- $M$ with $M$ close to $N$ ) can lead to undesired model selection outcome, while this does not hold for SwSGP- $M$ with a medium size of inducing points. + +![](images/f0a66fc5be1477730b39d60660466e769767dc3ce542a9d553e51c4d26f6615d.jpg) + +![](images/add643e8edcdf02eeca7310a870df9c030ac0522a076c0d597c632607d86d9c9.jpg) + +![](images/315e25b89debd9d891a8545875365adfb022daddfe931f34a485246cdc031e92.jpg) + +![](images/a16ac438d9c7ab3d05c819d2c93b69b30970dc5b93360600d1073809ae3f14c7.jpg) + +![](images/3dcd5aa7e6a1eea7ed4d4d2f656765559da389003379952cf4ba9ff9c592668c.jpg) + +![](images/102c0766ddc4e41a415a53df0f2acbdb59480a2841b548e0e03bd6fd30f436d1.jpg) + +![](images/d632d873425dd0878346e5684b6fa0e9c440c5c8449c65b7904eb71faabd5539.jpg) + +![](images/485c5bd2432344e457ecd5ea3c8c53b2107b6428a8462b5407dedf1fb4ccf237.jpg) + +![](images/d3f327f0d0bd70e2897beefc5dbf04d5520004704720d95fb6623d60d1b28c5e.jpg) + +![](images/adfa471b3e2a1844aa6c95069df79a85aaf47db76791bbac79c1439c1998076a.jpg) + +![](images/c4cd1be6d4a1e7dd13e9daae2fe678f0665b795c419a0eaf4e39b6e4a37516be.jpg) + +![](images/98961659767c20e14ee7c1287269edcbe81af9e4098a731f53e12aa6a1160966.jpg) + +![](images/06cc1a8febb7ae9051a5e3748b492261412343194182f898ff7b09ae8551424f.jpg) + +![](images/fcca8ca97a791a2587d71782e1e8fd10f9dd6d0c2dfc0490603602acd45167be.jpg) + +![](images/4a1a402b84ad647d7a2a27dc10404b26423c6bebd85a9018726d8ce2236303b1.jpg) + +![](images/f68b0577c0fa7d132f3ae0c69ebc9484241c5cc7d41915c864cff28e5aab2ec8.jpg) +Figure 7. KL comparison under different settings than the setting of Figure 3. Row 1: A different random ordering of inducing points. Row 2: Coordinate ordering of inducing points. Row 3: Matern (2.5) kernel. Row 4: Real dataset (3DRoad). + +![](images/61f743b8a5a743ec79af88a37bc25fb4a455db9fc5180a4b91a3c98366060e89.jpg) + +![](images/71fb1b4d400e0f9ba4ed4e58338bffda6d5c36a79313ed081028b377b8050a10.jpg) +Figure 8. Negative ELBO in the last training iteration (solid line) and test set NLL (dotted line) as a function of the likelihood noise parameter by SVGP (blue), VNNGP (green) and SWSGP (orange) on UKHousing dataset. All ELBO and NLL values are scaled to [0, 1]. The x-axis (Noise) is in log-scale. The best noise parameter picked by maximizing ELBO for each method is indicated by the vertical dashed line with corresponding color. The vertical purple line indicates the noise parameter $(= 0.28)$ learned by exact GP. Left: both VNNGP and SWSGP use $M = 1024$ inducing points. Right: both VNNGP and SWSGP use $M = 8192$ inducing point. For all cases, SVGP use 1024 inducing points. + +# D.3. Predictive performance on real dataset + +Here we provide training details and additional results for Section 4.3. + +# D.3.1. TRAINING DETAILS + +For all methods, we use an Adam optimizer and a MultiStepLR scheduler dropping the learning rate by a factor of 10 at the $75\%$ and $90\%$ of the optimization iterations; all kernels are Matern 5/2 kernel with separate lengthscale per dimension; the kernel lengthscales, outputscale and likelihood noise parameter (if any) are all initialized as 0.6931, except that exact GP is initialized with lengthscale $= 0.01$ on 3DRoad dataset. All hyperparameters are picked by the best validation NLL. + +All methods are trained with $\{300, 500\}$ iterations and learning rate of $\{0.005, 0.01\}$ for datasets of size below $50K$ , and with $\{100, 300\}$ iterations and learning rate of $\{0.005, 0.001\}$ for above $50K$ . + +For sgGP, we train using minibatches of 16 data points. As suggested by Chen et al. (2020), the minibatches are constructed by sampling one training data point and selecting its 15 nearest neighbors. To accelerate optimization, we accumulate the gradients of 1,024 minibatches before performing an optimization step (these 1,024 minibatch updates can be performed in parallel, enabling GPU acceleration). + +For SVGP, we use $M = 1024$ inducing points and a full-rank variational approximation. The inducing point locations are initialized by k-means clustering of observed locations + +VNNGP, SWSGP- $M$ and SWSGP- $N$ use a mean-field variational approximation. SWSGP- $M$ chooses $M \in \{1024, 2048, 4096, 8192\}$ , and the inducing point locations are initialized by k-means clustering of observed locations. All three methods tune $K$ in $\{32, 256\}$ . + +# D.3.2. PREDICTIVE RMSE TABLE + +The test set RMSE results for reported in Table 2. From the table, we observe that VNNGP obtains comparable RMSE values to other state-of-the-arts and excels at some datasets. + +
DatasetNDExactGPsgGPRMSE
SVGPSWSGP-MSWSGP-NVNNGP
PoleTele9.6K26.095 ± .000.092 ± .002.113 ± .000.101 ± .002.098 ± .003.091 ± .002
Elevators10.6K16.360 ± .006.358 ± .006.366 ± .006.399 ± .008.456 ± .001.373 ± .004
Bike11.1K17.054 ± .003.400 ± .153.028 ± .001.037 ± .002.042 ± .006.043 ± .003
Kin40K25.6K8.099 ± .001.458 ± .076.145 ± .001.118 ± .002.097 ± .001.096 ± .001
Protein25.6K9.533 ± .002.534 ± .006.633 ± .003.600 ± .004.592 ± .005.565 ± .003
KEGG31.2K20.085 ± .002.087 ± .003.089 ± .001.086 ± .001.085 ± .002.085 ± .001
KEGGU40.7K26.117 ± .000.122 ± .001.122 ± .000.118 ± .001.116 ± .001.118 ± .000
Precipitation64.8K3——.635 ± .004.485 ± .001.506 ± .001.432 ± .002
UKHousing116K2.402 ± .001.359 ± .001.582 ± .003.382 ± .001.498 ± .000.346 ± .002
3DRoad278K3.165 ± .000.187 ± .001.329 ± .001.432 ± .001.097 ± .017.298 ± .064
Covtype372K54——.671 ± .001.657 ± .001.670 ± .001.671 ± .001
+ +# D.3.3. LEARNED LIKELIHOOD NOISE TABLE + +We report the learned value of likelihood noise for all models in Table 3. Note that Covtype dataset uses Bernoulli likelihood which does not have noise parameter, therefore it is not included. + +We observe in Table 1 that sgGP and SWSGP- $N$ can sometimes obtain a very high NLL values. We suspect that is due to they learn a particularly small likelihood noise on corresponding datasets. For example, sgGP's NLL is approximately 53 on Bike, and its learned noise is around 0; SWSGP- $N$ 's NLL is approximately 41 on KEGGU, and its learned noise is around 0. + +Table 2. Test set RMSE (mean ± 1 standard error over 3 random seeds) on high-dimensional datasets (top 8 ones) and spatial datasets (bottom 4 ones). + +
DatasetNDExactGPsgGPnoise
SVGPSWSGP-MSWSGP-NVNNGP
PoleTele9.6K26.020 ± .000.002 ± .000.015 ± .000.005 ± .000.000 ± .000.002 ± .000
Elevators10.6K16.166 ± .001.102 ± .001.132 ± .001.062 ± .000.000 ± .000.067 ± .000
Bike11.1K17.016 ± .000.000 ± .000.002 ± .000.002 ± .000.000 ± .000.001 ± .000
Kin40K25.6K8.020 ± .000.000 ± .000.031 ± .000.009 ± .000.000 ± .000.001 ± .000
Protein25.6K9.182 ± .003.022 ± .002.417 ± .001.339 ± .001.000 ± .000.018 ± .000
KEGG31.2K20.019 ± .000.006 ± .000.008 ± .000.007 ± .000.000 ± .000.005 ± .000
KEGGU40.7K26.023 ± .000.013 ± .000.015 ± .000.014 ± .000.000 ± .000.013 ± .000
Precipitation64.8K3——.182 ± .001.030 ± .000.000 ± .000.005 ± .000
UKHousing116K2.280 ± .001.112 ± .000.345 ± .002.144 ± .000.015 ± .000.070 ± .003
3DRoad278K3.584 ± .000.001 ± .000.126 ± .000.203 ± .001.000 ± .000.001 ± .000
Covtype372K54——.000 ± .000.000 ± .000.000 ± .000.000 ± .000
+ +Table 3. The learned likelihood noise (mean ± 1 standard error over 3 random seeds) on high-dimensional datasets (top 8 ones) and spatial datasets (bottom 3 ones). \ No newline at end of file diff --git a/variationalnearestneighborgaussianprocess/images.zip b/variationalnearestneighborgaussianprocess/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..a21eaedcbfdd0c86eb61a5d4fb159121cde9ab4e --- /dev/null +++ b/variationalnearestneighborgaussianprocess/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e378b837f37aeec49dd4d0fecac2aadf8ae3e6a6219168f43fd61073590baacf +size 955936 diff --git a/variationalnearestneighborgaussianprocess/layout.json b/variationalnearestneighborgaussianprocess/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..7cffec0cfb07ece5ef540e1ddb1f49374590e58c --- /dev/null +++ b/variationalnearestneighborgaussianprocess/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:82a1f47f1ab0808ca31a5a0724a211f5f324bfb1e4f834e77bee86a6bf1eaf58 +size 682096 diff --git a/variationalontheflypersonalization/7f41f704-2aa9-4a9a-bb66-fd587844c2bf_content_list.json b/variationalontheflypersonalization/7f41f704-2aa9-4a9a-bb66-fd587844c2bf_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..30035201c209ecd3228591324a510cbf619fffcc --- /dev/null +++ b/variationalontheflypersonalization/7f41f704-2aa9-4a9a-bb66-fd587844c2bf_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8244b8cfab676f91310c26810747673c069eb468962092a9ede01c80dd5d0cb7 +size 102121 diff --git a/variationalontheflypersonalization/7f41f704-2aa9-4a9a-bb66-fd587844c2bf_model.json b/variationalontheflypersonalization/7f41f704-2aa9-4a9a-bb66-fd587844c2bf_model.json new file mode 100644 index 0000000000000000000000000000000000000000..a5d2ba2633227a17aecbc8cd374faba4f0a860e2 --- /dev/null +++ b/variationalontheflypersonalization/7f41f704-2aa9-4a9a-bb66-fd587844c2bf_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4f9a41bfbcce08749d199bdf0ab92cc662789746425708dfbd647fc92835fa34 +size 125809 diff --git a/variationalontheflypersonalization/7f41f704-2aa9-4a9a-bb66-fd587844c2bf_origin.pdf b/variationalontheflypersonalization/7f41f704-2aa9-4a9a-bb66-fd587844c2bf_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..3024e67366d8b52795e5baace5a87b4758676b54 --- /dev/null +++ b/variationalontheflypersonalization/7f41f704-2aa9-4a9a-bb66-fd587844c2bf_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4d862637127b3294569c07cbf7b1cfa88129165fe1c411d8a55fb4e53457c76c +size 1207663 diff --git a/variationalontheflypersonalization/full.md b/variationalontheflypersonalization/full.md new file mode 100644 index 0000000000000000000000000000000000000000..b5a0bce0fc23c9429caa6d78957004a178611d12 --- /dev/null +++ b/variationalontheflypersonalization/full.md @@ -0,0 +1,408 @@ +Jangho Kim\*12 Jun-Tae Lee\*1 Simyung Chang 1 Nojun Kwak 2 + +# Abstract + +With the development of deep learning (DL) technologies, the demand for DL-based services on personal devices, such as mobile phones, also increases rapidly. In this paper, we propose a novel personalization method, Variational On-the-Fly Personalization. Compared to the conventional personalization methods that require additional fine-tuning with personal data, the proposed method only requires forwarding a handful of personal data on-the-fly. Assuming even a single personal data can convey the characteristics of a target person, we develop the variational hyper-personalizer to capture the weight distribution of layers that fits the target person. In the testing phase, the hyper-personalizer estimates the model's weights on-the-fly based on personality by forwarding only a small amount of (even a single) personal enrollment data. Hence, the proposed method can perform the personalization without any training software platform and additional cost in the edge device. In experiments, we show our approach can effectively generate reliable personalized models via forwarding (not back-propagating) a handful of samples. + +# 1. Introduction + +In recent years, most of the deep learning researches have paid attention to developing universal models with sophisticated architectures using a large-scale dataset covering an entire target domain. However, in edge devices, such as mobile phones and IoT sensors, deep models are required to process (learn or infer) a personal domain where data + +*Equal contribution 1Qualcomm AI Research, an initiative of Qualcomm Technologies, Inc. Jangho Kim completed the research in part during an internship at Qualcomm Technologies, Inc. 2Seoul National University, South Korea. Correspondence to: Jangho Kim , Jun-Tae Lee , Simyung Chang , Nojun Kwak . + +Proceedings of the $39^{th}$ International Conference on Machine Learning, Baltimore, Maryland, USA, PMLR 162, 2022. Copyright 2022 by the author(s). + +![](images/2abe5abea2584c6f12a896aa465e7c40af5d55d62a2d74ed407bc479fd34f1e3.jpg) +Figure 1: Our personalization scenario on edge devices with practically crucial constraints (few-shot target, unsupervised, source-free, and training-free). + +are generated in a specific environment (Wang et al., 2019b; Chen & Ran, 2019). For example, data could be always collected by a specific user, then the device may never confront other personal domains. In this case, using a universal model is inefficient, and also its performance may degrade in some personal domains. Hence, to successfully deploy deep learning algorithms in edge devices, it is significant to specialize a model to the data distribution of the personal domain, i.e., personality, in question. + +Despite the importance of personalization, there has been little progress due to the following practical constraints of edge devices, which are depicted in Fig. 1. First, it is hard to access the source data (generic data) used for training (source-free). Second, only a few user-specific target data (personal data) can be available (few-shot). Third, for usability, personal data are preferable to be unlabeled since a service requiring user's annotation drastically reduces usability (unsupervised). Also, on-device training with user's data suffers from some non-algorithmic constraints (training-free). For example, collecting personal data to train the models may cause privacy concerns. And model training requires an on-device training platform and much more hardware resources (memory and computational units) than inference. + +Various existing works have tried to qualify a model to specified domains. Nevertheless, they do not completely meet the aforementioned constraints, and are not directly applicable to our personalization task. Fallah et al. (2020) localized multiple models to different personal domains, federating to + +produce a universal one. However, in the localized learning, a plenty of annotated personal data are required. Although Motiian et al. (2017) and Luo et al. (2017) adapted a model to a target domain with a few data, they need source domain data as well as the labels of the few target data. While unsupervised domain adaptation was devised by Long et al. (2016), enough target and source domain data are required. Recent source-free domain adaptation techniques (Yang et al., 2021; Kundu et al., 2020) adapted a model without any source domain data and label of target domain data, but they still use abundant target domain data. Commonly, those existing methods are not training-free. Therefore, it is still challenging to flexibly personalize a model to a given personal domain using only a small-sized personal data. + +To attain the personalization satisfying the constraints shown in Fig. 1, we introduce a novel on-the-fly personalization paradigm. Specifically, given a personal data, we compute the weights of layers specialized to its personality on-the-fly via forwarding only a few personal data. To this end, we propose a variational on-the-fly personalization (VoP) method. The key of our method lies in a small detachable module, the variational hyper-personalizer which is trained to produce an approximated posterior distribution of weights of a layer based on the personality. Assuming the data in a personal domain share the same personality, we set the target prior distribution as the averaged distribution, called prototype, of the personal data in the variational inference of the hyper-personalizer. In the testing phase, by forwarding a small amount of testing data with the same personality, called enrollment data, the hyper-personalizer estimates the posterior distribution of weights in the layer according to the personality represented by the enrollment data. Then, a personalized layer is generated from the estimated posterior distribution. Since the hyper-personalizer is detached from the model after generating the personalized weights of the layer, we can obtain a personalized model without increasing computational cost. + +To show the effectiveness of the proposed variational on-the-fly personalization, we first apply it to two tasks strongly relevant to personalization: keyword spotting and open-set speaker verification. Then, we extend our VoP to few-shot classification task, as well. For each task, we show that our VoP successfully increases the performance of a baseline method on the considered public benchmark dataset. + +The contribution of our work is summarized as follows: + +- To the best of our knowledge, we propose the first on-the-fly personalization method to specialize a model to a given personality. +- We formulate the personalization via forwarding as a variational inference problem, and solve it by considering the prototype distribution as the target posterior distribution of the personal layer's weights. + +- By forwarding a few personal data, the variational hyperpersonalizer captures the weight distribution of layers, and produces the personalized layer weights. +- We analyze the effectiveness of the proposed method on various tasks such as keyword spotting, open-set speech verification, and few-shot classification tasks. + +# 2. Related work + +Neural networks for edge devices Many on-device deep learning services have been introduced, then personalization of deep learning algorithms gets important. + +Keyword spotting (KWS) recognizes a specific keyword to wake up a device. As KWS models are frequently deployed and used in edge devices, diverse methods have been developed for efficient KWS in the devices, such as lightening model sizes (Tang & Lin, 2017; Zhang et al., 2017; Tang & Lin, 2018), or reducing computation (Choi et al., 2019; Li et al., 2020). Although KSW deals with an enrolled user's voice rather than anonymous ones, research on personalization has not been actively studied. + +Speaker verification (SV) also requires personalization for accurate verification for a target user. To obtain robust target speaker's embedding, metric learning-based methods are widely addressed (Wang et al., 2019a; Chung et al., 2020; Ko et al., 2020). However, while they aim to make a better embedder in the training phase, our VoP can personalize the model by forwarding a handful of personal data on-the-fly. + +Recently, to address the degeneration issue of federated learning for non-IID local data, personalized federated learning was devised. In this line of research, several works decentralized the model-agnostic meta-learning (Jiang et al., 2019; Fallah et al., 2020; Deng et al., 2020). Other approaches mixed the global and personal (local) models (Deng et al., 2020; Hanzely & Richtárik, 2020). While these methods are akin to our VoP in that the global and local layers are used separately, unlike ours, they inevitably require training models on personal data. + +Existing personalization methods are mostly tailored to specific tasks, and also require task-specific training for target personality. Whereas, as a versatile algorithm for diverse tasks, the proposed VoP uses no extra training on devices. This enables a lightweight personalized neural network platform for edge devices that may not support training. + +Few-shot embedding adaptation To overcome the need for massive training data and generalize the model with a few limited examples, lots of approaches have been attempted in many research fields. In the field of few-shot domain adaptation (Tzeng et al., 2015; Motiian et al., 2017; Luo et al., 2017), a model trained on a source domain is adopted to a heterogeneous target domain with a few labeled target data. However, those methods highly rely on prior information from a large-scale source data. + +In few-shot classification (Snell et al., 2017; Iakovleva et al., 2020; Ye et al., 2020; Gordon et al., 2018; Das et al., 2022), a model meta-learns how to build embedding with a few examples in source classes with sufficient labeled data, and then the model is applied to tasks sampled from unseen target classes, where each task consists of a few labeled support set and a query set. Recently, Gordon et al. (2018) exploited a Bayesian framework to relieve the model uncertainty by insufficient support examples, where the weight of the classification layer is generated for each task in the testing phase. To further tailor the Bayesian framework to this task, Iakovleva et al. (2020) regularized the classifier generator based on the relationship between support and query sets. While these Bayesian approaches have relevance with our VoP, they only focus on the weight generation of the final linear layer based on query set for the few-shot classification task. Contrarily, we supposed that the inherent personality can be conveyed by even a single personal sample for generic use in various personalization tasks with scarce personal data. Also, we designed VoP to personalize both convolutional and linear layers in various depths. + +# 3. Method + +In this section, we first introduce the framework of the proposed VoP. Note that VoP is generally applicable to personalize deep networks, via only forwarding a small amount of samples on-the-fly. Next, we describe the variational inference process of the hyper-personalizer which produces the personalized weight for a corresponding layer. Hypermodules (Ha et al., 2017; Ballé et al., 2018; Minnen et al., 2018) have been widely adopted in diverse tasks, but our variational hyper-personalizer is specially designed for personalization. Lastly, we analyze the convergence of VoP. + +# 3.1. Overall Framework + +Fig. 2 depicts the framework of the proposed VoP. Our network consists of an encoding module $f_{\psi}$ and a detachable hyper-personalizer $q_{\theta}$ . Then, the network is learned to solve a classification problem considering different personalities of input samples. To this end, we suppose a dataset $D = \{(s_i, y_i, r_i)\}_{i=1}^N$ with multiple personalities. A sample $s_i$ is annotated by a class label $y_i$ and a personality label $r_i$ where $y_i \in [C]$ , $r_i \in [R]$ ([n] is a positive integer set $\{1, \dots, n\}^1$ . + +In the training stage, the encoding module, which is shared across the personalities of inputs, first extracts features of input samples. Then, the encoded features are forwarded to the hyper-personalizer. For each personality, the hyper-personalizer performs the variational inference where the true posterior of the sample-specific weights of the corresponding layer is approximated. Then, the sample-specific + +# Algorithm 1 Variational On-the-Fly Personalization (VoP) + +1: $P \gets$ The number of iterations +2: Given $D = \{(s_i, y_i, r_i)\}_{i=1}^N$ where $y_i \in [C], r_i \in [R]$ +3: $\psi, \theta \gets$ Initialization +4: [Training] +5: for $\operatorname{Iter} = 1, \dots, P$ do +6: $D^{M} = \{(s_{i},y_{i},r_{i})\}_{i = 1}^{M}\gets$ Minibatch of $M$ samples (drawn from $D$ ), where $y_{i}\in \mathcal{C}^{M}\subset [C],r_{i}\in \mathcal{R}^{M}\subset [R]$ +7: $\{x_{i}\}_{i = 1}^{M}\gets$ Extract features from $\{s_i\}_{i = 1}^M$ , using the encoding module $f_{\psi}$ +8: $\{\mu_i,\Sigma_i\}_{i = 1}^M\gets$ Outputs from $q_{\theta}$ +9: $\{\bar{\mu}_k\}_{k = 1}^{|R^M|},\{\bar{\Sigma}_k\}_{k = 1}^{|R^M|}\gets$ Obtain proto-means and protovariances using (9) +10: $\{\omega_{i}\}_{i = 1}^{M}\gets$ Sample sample-specific weights using $p(\epsilon)$ based on $\{\mu_i,\Sigma_i\}_{i = 1}^M$ +11: Update $\psi, \theta$ by minimizing $\widehat{\mathcal{L}}_{VoP}$ in (12) +12: end for +13: [Testing] to generate the $k$ -th personality model +14: $D^{E} = \{(s_{i},y_{i},r_{i} = k)\}_{i = 1}^{E}$ : Few enrollment samples for the $k$ -th personality +15: Obtain $\{\bar{\mu}_k\}$ using $f_{\psi}, q_{\theta}$ and $D^{E}$ +16: $\{\bar{\omega}_k\} \gets$ Set $\bar{\mu}_k$ as the personal weights, which maximize the likelihood for the personal samples +17: Abolish $q_{\theta}$ + +layer is generated from the approximated posterior. Finally, the sample-specific layer yields the personalized feature (or prediction if it is the last layer). + +Note that, in the testing phase, the hyper-personalizer is used only once for a few enrollment samples, in order to generate the weights of the personalized layer for the personality corresponding to the enrollment samples on-the-fly without any back-propagation. + +# 3.2. Variational On-the-Fly Personalization + +The goal of the hyper-personalizer is to find a proper weight distribution shared across the samples with the same personality. For this purpose, for a personality $k$ , we estimate the sample-specific true posterior from the encoded sample feature $x_{i}^{k}$ ( $= f_{\psi}(s_{i})$ where $r_{i} = k$ ), because it is difficult to directly find the true posterior from raw input samples. However, in general, the true posterior of the weight $\omega$ , $p(\omega | x_{i}^{k}, y_{i}^{k})$ , is intractable (Gal, 2016). + +Accordingly, in order to approximate the true posterior $p(\omega |x_i^k,y_i^k)$ , we design a variational distribution $q_{\theta}(\omega |x_i^k)$ parameterized by $\theta$ . Then, we minimize the Kullback-Leibler (KL) divergence between the two distributions: + +$$ +\begin{array}{l} K L \left(q _ {\theta} \left(\omega \mid x _ {i} ^ {k}\right) | | p \left(\omega \mid x _ {i} ^ {k}, y _ {i} ^ {k}\right)\right) = \int q _ {\theta} \left(\omega \mid x _ {i} ^ {k}\right) \ln \frac {q _ {\theta} \left(\omega \mid x _ {i} ^ {k}\right)}{p \left(\omega \mid x _ {i} ^ {k} , y _ {i} ^ {k}\right)} d \omega \\ = \int q _ {\theta} \left(\omega \mid x _ {i} ^ {k}\right) \ln \left(\frac {q _ {\theta} \left(\omega \mid x _ {i} ^ {k}\right)}{p \left(\omega \mid x _ {i} ^ {k}\right)} \frac {p \left(y _ {i} ^ {k} \mid x _ {i} ^ {k}\right)}{p \left(y _ {i} ^ {k} \mid x _ {i} ^ {k} , \omega\right)}\right) d \omega \\ = K L \left(q _ {\theta} \left(\omega \left| x _ {i} ^ {k}\right) \right| | p (\omega \left| x _ {i} ^ {k}\right)\right) \\ - \mathbb {E} _ {\omega \sim q _ {\theta} (\omega | x _ {i} ^ {k})} [ \ln p \left(y _ {i} ^ {k} \mid x _ {i} ^ {k}, \omega\right) ] + \ln p \left(y _ {i} ^ {k} \mid x _ {i} ^ {k}\right). \tag {1} \\ \end{array} +$$ + +![](images/ba6b7f4737ffeb6d5bc0e2e91c6315b97df3b8af6d6b6b5f5476b0c57a18aa69.jpg) +Figure 2: The overall process of the proposed VoP. Colors in input samples represent personalities for each input sample. In the training phase, VoP trains the encoding module and hyper-personalizer to estimate sample-specific weights via black dashed and blue bold arrows. At testing phase, for each personality, VoP generates personal weights by forwarding a few enrollment samples via black and red dashed arrows, once. After generating the personal weights (model), VoP abolishes the hyper-personalizer, and then only utilizes the encoding module and the personal weights. More details are in Sec. 3. + +In (1), the minimization of the KL divergence is equivalent to maximizing the evidence lower bound (ELBO): + +$$ +\begin{array}{l} \mathbb {E} _ {\omega \sim q _ {\theta} \left(\omega \mid x _ {i} ^ {k}\right)} \left[ \ln p \left(y _ {i} ^ {k} \mid x _ {i} ^ {k}, \omega\right) \right] - K L \left(q _ {\theta} \left(\omega \mid x _ {i} ^ {k}\right) \mid \mid p \left(\omega \mid x _ {i} ^ {k}\right)\right) \\ \leq \ln p \left(y _ {i} ^ {k} \mid x _ {i} ^ {k}\right). \tag {2} \\ \end{array} +$$ + +This approximation process is known as variational inference (VI) (Hoffman et al., 2013). In other words, we approximate the true posterior distribution by minimizing the following objective function (negative ELBO): + +$$ +\begin{array}{l} \mathcal {L} _ {V I} (\theta , (x _ {i}, y _ {i}, k)) = - \mathbb {E} _ {\omega \sim q _ {\theta} \left(\omega \mid x _ {i} ^ {k}\right)} [ \ln p \left(y _ {i} ^ {k} \mid x _ {i} ^ {k}, \omega\right) ] \tag {3} \\ + K L \left(q _ {\theta} \left(\omega \mid x _ {i} ^ {k}\right) | | p (\omega \mid x _ {i} ^ {k})\right). \\ \end{array} +$$ + +In the minimization of the objective function, the first term induces $q_{\theta}(\omega |x_i^k)$ to predict the correct output and the second KL term encourages the variational distribution to resemble the sample-specific prior $p(\omega |x_i^k)$ . + +Note that the first RHS term requires estimation by sampling $\omega$ from the variational distribution $q_{\theta}(\omega |x_i^k)$ . For the sampling, we assume the true posterior $p(\omega |x_i^k,y_i^k)$ and the sample-specific prior $p(\omega |x_i^k)$ to be uncorrelated multivariate Gaussian. Then, the hyper-personalizer calculates parameters for the variational distribution $q_{\theta}(\omega |x_i^k)$ following the multivariate Gaussian, $q_{\theta}(\omega |x_i^k) = \mathcal{N}(\omega |\mu_i,\Sigma_i)$ , with $\Sigma_{i} = \mathrm{diag}(\sigma_{i}^{2})$ . Here, $\mu_{i}$ and $\sigma_{i}^{2}$ are outputs of the hyper-personalizer which is a multi-layer perceptron (MLP) with a single hidden layer ( $\mu_{i},\sigma_{i}^{2}\in \mathbb{R}^{Z}$ where $Z$ is the dimension of $\omega$ ). + +After calculating $\mu_{i},\sigma_{i}^{2}$ , we apply the reparameterization trick for a pathwise derivative estimator (Kingma & Welling, 2013; Gal, 2016). To reparameterize a random variable $\omega$ following $q_{\theta}(\omega |x_i^k)$ , we exploit a noise variable $\epsilon$ following $p(\epsilon)$ . Then, $\omega$ can be represented by a non-random differen + +tiable function $g(\epsilon ,x_i^k;\theta)$ + +$$ +\omega = g \left(\epsilon , x _ {i} ^ {k}; \theta\right) = \mu_ {i} + \sigma_ {i} \odot \epsilon \quad \text {w i t h} \quad \epsilon \sim \mathcal {N} (0, I), \tag {4} +$$ + +where $\odot$ denotes elementwise multiplication. From this, we can rewrite (3) w.r.t. $p(\epsilon)$ (for convenience, $KL(q_{\theta}(\omega |x_i^k))||p(\omega |x_i^k))$ is referred to as $KL$ ): + +$$ +\begin{array}{l} \mathcal {L} _ {V I} (\theta , \left(x _ {i}, y _ {i}, k\right)) = - \int q _ {\theta} \left(\omega \mid x _ {i} ^ {k}\right) \ln p \left(y _ {i} ^ {k} \mid x _ {i} ^ {k}, \omega\right) d \omega + K L \\ = - \int p (\epsilon) \ln p \left(y _ {i} ^ {k} \mid x _ {i} ^ {k}, g \left(\epsilon , x _ {i} ^ {k}; \theta\right)\right) d \epsilon + K L \tag {5} \\ \end{array} +$$ + +whose first term can be approximated with Monte Carlo (MC) estimator as follows: + +$$ +\begin{array}{l} - \int p (\epsilon) \ln p \left(y _ {i} ^ {k} \mid x _ {i} ^ {k}, g \left(\epsilon , x _ {i} ^ {k}; \theta\right)\right) d \epsilon \\ \simeq - \frac {1}{L} \sum_ {l = 1} ^ {L} \ln p \left(y _ {i} ^ {k} \mid x _ {i} ^ {k}, g \left(\epsilon_ {l}, x _ {i} ^ {k}; \theta\right)\right), \tag {6} \\ \end{array} +$$ + +where $\epsilon_{l}$ is independently sampled from $p(\epsilon)$ . We can train $\theta$ with the MC estimator: + +$$ +\begin{array}{l} \mathcal {L} _ {M C} (\theta , (x _ {i}, y _ {i}, k)) = - \frac {1}{L} \sum_ {l = 1} ^ {L} \ln p \left(y _ {i} ^ {k} \mid x _ {i} ^ {k}, g \left(\epsilon_ {l}, x _ {i} ^ {k}; \theta\right)\right) \\ + K L \left(q _ {\theta} \left(\omega \left| x _ {i} ^ {k}\right) \right| | p \left(\omega \left| x _ {i} ^ {k}\right)\right)\right). \tag {7} \\ \end{array} +$$ + +To compute the KL divergence in (7), we assume that the sample-specific prior of $x_{i}$ follows the distribution of its personality $r_i = k$ : + +$$ +p \left(\omega \mid x _ {i} ^ {k}\right) \simeq p (\omega | k). \tag {8} +$$ + +Then, we define the prototype distribution for the personality by the mean and variance of a proto-set $S_{k}$ . This proto-set, which is pre-defined for each $k$ , contains the mean and variance for each of a few samples belonging to the $k$ th + +personality. Hence, the proto-mean $\bar{\mu}_k$ and proto-variance $\bar{\Sigma}_k$ are obtained by + +$$ +\bar {\mu} _ {k} = \frac {1}{| \mathcal {S} _ {k} |} \sum_ {\mu_ {j} \in \mathcal {S} _ {k}} \mu_ {j}, \quad \bar {\Sigma} _ {k} = \frac {1}{| \mathcal {S} _ {k} |} \sum_ {\Sigma_ {j} \in \mathcal {S} _ {k}} \Sigma_ {j} \tag {9} +$$ + +where $\mu_{j}$ and $\Sigma_{j}$ are the means and variances from the hyper-personalizer for the $j$ th sample in $\mathcal{S}_k$ , respectively. + +For brevity, we assume that $\Sigma$ and $\bar{\Sigma}$ are diagonal, i.e., $\Sigma = \mathrm{diag}(\sigma^2)$ and $\bar{\Sigma} = \mathrm{diag}(\bar{\sigma}^2)$ . Hence, the KL divergence term of (7) can be calculated analytically (See Appendix A): + +$$ +\begin{array}{l} K L (q _ {\theta} (\omega | x _ {i} ^ {k}) | | p (\omega | x _ {i} ^ {k})) \simeq \frac {1}{2} \sum_ {z = 1} ^ {Z} (\ln \bar {\sigma} _ {(k, z)} ^ {2} - \ln \sigma_ {(i, z)} ^ {2} - 1 \\ + \frac {\sigma_ {(i , z)} ^ {2}}{\bar {\sigma} _ {(k , z)} ^ {2}} + \frac {\left(\mu_ {(i , z)} - \bar {\mu} _ {(k , z)}\right) ^ {2}}{\bar {\sigma} _ {(k , z)} ^ {2}}) \tag {10} \\ \end{array} +$$ + +where we use $p(\omega |x_i^k)\simeq p(\omega |k) = \mathcal{N}(\omega |\bar{\mu}_k,\mathrm{diag}(\bar{\sigma}_k^2))$ and $z\in [Z]$ is the index of multivariate Gaussian dimension. + +Based on the sample-specific MC estimator in (7), the overall loss function for all $N$ samples is defined as follows: + +$$ +\begin{array}{l} \mathcal {L} _ {V o P} = \frac {1}{N} \sum_ {i = 1} ^ {N} \left(- \frac {1}{L} \sum_ {l = 1} ^ {L} \ln p \left(y _ {i} ^ {r _ {i}} \mid x _ {i} ^ {r _ {i}}, g \left(\epsilon_ {l}, x _ {i} ^ {r _ {i}}; \theta\right)\right) \right. \tag {11} \\ + \alpha K L \left(q _ {\theta} \left(\omega \left| x _ {i} ^ {r _ {i}}\right) \right| | p (\omega \left| x _ {i} ^ {r _ {i}}\right)\right)). \\ \end{array} +$$ + +Here, $\alpha$ is a scale hyper-parameter to balance between the negative log likelihood and the KL divergence. We can construct an unbiased stochastic estimator $\hat{\mathcal{L}}_{VoP}$ to (11) by data sub-sampling, i.e., minibatch: + +$$ +\begin{array}{l} \widehat {\mathcal {L}} _ {V o P} = \frac {1}{M} \sum_ {i = 1} ^ {M} \left(- \frac {1}{L} \sum_ {l = 1} ^ {L} \ln p \left(y _ {i} ^ {r _ {i}} \mid x _ {i} ^ {r _ {i}}, g \left(\epsilon_ {l}, x _ {i} ^ {r _ {i}}; \theta\right)\right) \right. \tag {12} \\ + \alpha K L \left(q _ {\theta} \left(\omega \left| x _ {i} ^ {r _ {i}}\right) \right| | p \left(\omega \left| x _ {i} ^ {r _ {i}}\right)\right)\right). \\ \end{array} +$$ + +where $M$ is the minibatch size. Here, we set $L$ to 1 following (Kingma & Welling, 2013). VoP can train both the encoding module $f_{\psi}$ and the hyper-personalizer $q_{\theta}$ with this VoP loss function (12). At test time, for each personality, the hyper-personalizer inferences only a few enrollment samples $D^{E}$ to generate personalized weights $(\bar{\omega})$ on the fly. During this forwarding, we generate personalized weights based on the proto-mean, which can maximize the likelihood of personal samples. Note that, after obtaining the personalized weights $(\bar{\omega})$ for every personality, the hyper-personalizer is discarded. Thus, only the encoding module and the personalized layers are left. The overall process is described in Algorithm 1. + +# 3.3. Analysis on VoP convergence + +One may wonder if the sample mean and variance diverge as the iteration goes on because the proto-mean and protovariance in (9) are not fixed during training. Fig. 3 left + +![](images/c84e53fe54f0ab0c2029c9d51f776d0af2ee8a94beef67da6ed4dba1f99016e0.jpg) +Figure 3: Convergence of VoP: Computation graph of VoP (left) and loss curve on the KWS task (right). + +![](images/26de7d61e67ba65db554752788dca6147f4a41722bcced8bf9a92fe16771a9ae.jpg) + +is the computation graph of our VoP in training where $p_i \triangleq [\mu_i, \sigma_i^2]^T$ . The weight-loss relation of a network with nonlinearity is generally nonconvex, and the convergence proof of SGD is not straightforward and is an active research area. However, when the loss function is convex w.r.t. an intermediate variable (e.g. softmax output), we expect a better convergence behavior. + +Theorem 3.1. In VoP, $\theta \rightarrow KL$ and $w \rightarrow L$ are nonconvex, but $p_i \rightarrow KL$ (see dashed box in Fig. 3 left) is convex when $\bar{\sigma}^2 \leq 2\sigma_i^2$ : + +Proof. From (10), $KL(\mu_i)$ is convex because of the last quadratic term and $\mu_{i} - \bar{\mu} = \mu_{i} - \frac{1}{N}\sum_{j}\mu_{j} = \frac{N - 1}{N}\mu_{i} - X$ where $X$ denotes other terms independent of $\mu_{i}$ . Likewise, if we take $\frac{\partial^2KL}{(\partial\sigma_i^2)^2}$ , it is nonnegative when $\bar{\sigma}^2\leq 2\sigma_i^2$ . Thus, $KL(\sigma_i^2)$ is convex in this condition. If $KL$ is convex w.r.t $p_i = [\mu_i,\sigma_i^{2}]^T$ , it can be quadratically approximated near the optimal solution $p_i = \bar{p}$ such that $KL\simeq \frac{1}{2}\sum_{i}(p_{i} - \bar{p})^{T}\Lambda (p_{i} - \bar{p})$ , where $\Lambda$ is a positive definite matrix. + +Let $p_i' = \Lambda^{\frac{1}{2}}p_i$ and taking the gradient descent step on $p_i'$ , it becomes $p_i'^+ = p_i' - \eta \nabla p_i' = (1 - \beta)p_i' + \beta \bar{p}'$ where $\beta = \eta \frac{N - 1}{N}$ . Computing $p_i'^+ - \bar{p}'$ , it becomes $p_i'^+ - \bar{p}' = (1 - \beta)(p_i' - \bar{p}')$ , which means that $p_i'$ (thus $p_i$ ) moves toward the mean $\bar{p}'(\bar{p})$ as iterations go on. By aggregating all $p_i$ 's, we can show that $\bar{p}^+ = \frac{1}{N}\sum_{i}p_{i}^{+} = \bar{p}$ and it is fixed under gradient descent. Therefore, we can prove the convergence of $p_i$ when only $KL$ term is used. + +In reality, as $w$ is updated to minimize $L$ , $\bar{p}$ is not fixed and moves according to $w$ during training. However, as $KL$ enforces contraction towards $\bar{p}$ , $p_i$ does not diverge and we can interpret $KL$ as a regularizer (See Fig. 4). We also show the converging loss curve for the KWS task in Fig. 3 right. + +# 4. Experiments + +To verify the proposed VoP, we apply it to three tasks: keyword spotting, speaker verification and few-shot classification. For each task, we apply VoP employing baseline networks where VoP and the baseline model share the same architecture except the hyper-personalizer consisting of MLPs. Note that, in testing, as we discard the hyper-personalizer after generating personalized layers, the VoP-learned baselines have the same capacity as the original ones. We provide further experiments and analysis in Appendix C, D, E. + +![](images/c3ed4faf7882f1edc60ced5d3846386c4e5431c6be917d603a2dd34994d044e0.jpg) +(a) Means from two models with two PIDs + +![](images/b650c5951f0ee05ccc898c5301f3293be5931f7f6dab84688a7d38a74f2d540b.jpg) +Figure 4: Visualizations by PCA on outputs of the hyper-personalizers of VoP and vanilla models under two identical personal identifications (PIDs), i.e., personality labels. (a) shows the means $(\mu_{i}$ 's) from hyper-personalizers of the two models in the same PCA space. To see the personalization in closer views, (b) and (c) display the means $(\mu_{i}$ 's) and the proto-means $(\bar{\mu})$ from the hyper-personalizers of the vanilla and VoP models, respectively. + +![](images/73f0d50db46c8d80a40eeae9db702872d70f89a31418444d84acc76a4c396a59.jpg) +(b) Means from the vanilla with two PIDs +(c) Means from VoP with two PIDs + +Table 1: Relative variances of the vanilla and VoP models depending on PCA axes for each PIDs from Figure 4a. + +
MethodPID1 - PC1PID1 - PC2PID2 - PC1PID2 - PC2
Vanilla148.20933.8490.011140.58
VoP1.001.531.132.05
+ +# 4.1. Keyword Spotting + +We apply the proposed VoP on Keyword spotting (KWS) which is a classification task to detect pre-defined keywords. Due to the diversity of the texture of voices, it is crucial to personalize the KWS algorithm to individual speakers. Therefore, in this task, personality refers to an individual speaker. We employ the 'cnn-one-stride1' (Tang et al., 2018) as the baseline network. Using our VoP, we personalize the last two fully connected layers (remaining layers are the encoding module). In training, following the most basic setting (the optimizer and total training epochs) of (Tang & Lin, 2017), we use a larger minibatch size (512) to compute the proto-means and the proto-variances of different personalities, together. Also, for the stable learning of VoP, we experimentally set both learning rate and $\alpha$ in (12) as 0.0005, and use no learning rate decay. In testing, we forward the enrollment set of 5 samples per each personality. + +Dataset We use Qualcomm Keyword Speech (Kim et al., 2019) dataset where wav files are recorded with $16\mathrm{kHz}$ with mono channel in 16 bits. It consists of 4,270 utterances spoken by 42-50 individuals which are annotated by six classes: four English keyword classes ('Hi Galaxy,' 'Hey Snapdragon,' 'Hi Lumina,' and 'Hey Android') and two non-keyword classes ('silence' and 'unknown.') We address both closed-set and open-set tasks. In the closed-set setting, including 42 speakers, the dataset is divided to $80\%$ training and $20\%$ testing sets. In the open-set setting, the dataset consists of 37 speakers for training and five ones for testing. Note that the five speakers cannot be seen on training. + +Analysis on Efficacy of VoP As aforementioned, our VoP loss consists of the negative log likelihood and the KL divergence. While the negative log likelihood is a cross-entropy loss for the classification task (task loss), the KL divergence helps to learn the personality. Therefore, to explore the effectiveness of the proposed VoP in personalization, we compare two models: VoP model trained with our VoP loss, and vanilla model with only task-specific cross-entropy loss. Note that both models have the same architecture including the encoding modules and hyper-personalizer. We train those two models on Qualcomm Keyword Speech dataset. + +For intuitive comparison, we visualize the means of the hyper-personalizer, using the principal component analysis (PCA). Firstly, we compare the vanilla and VoP models in terms of the means computed by their hyper-personalizer for two different PIDs (PID1 and PID2). To compare the VoP and vanilla models according to the dispersion of means, we re-scale each mean by $L1$ normalization and compute a covariance matrix from the sample-wise concatenated normalized means. In Fig. 4a, we show the means of several testing samples from the two models for each PID, regardless of the class labels. The blue and red circles represent the means from VoP model for PIDs 1 and 2, respectively. Similarly, the green and black circles are those for the vanilla models. We see that the means from our VoP model are more concentrated compared to the means from the vanilla model. In Table 1, for the PIDs, we also provide the variances of the normalized means on each PCA axes (PC1 and PC2). We set the variance of VoP on PC1 as 1 and report the relative variances for clear understanding. Compared to the vanilla model, all the variances of the VoP model are even and very small. Thus, the KL divergence in (10) pushes each output of hyper-personalizer to mimic the distribution of the sample-specific prior following the distribution of the corresponding personality. This sample-wise regulation can give representativeness of personality to each sample, which is very important in the on-the-fly personalization. + +Table 2: Keyword spotting accuracy(%) onQualcommKeyword Speech dataset. + +
MethodClosed-setOpen-set
Baseline87.46 ± 1.6874.45 ± 0.77
Baseline w/ Dropout81.77 ± 1.7577.35 ± 1.90
Baseline w/ samovar (2fc)17.25 ± 1.4224.35 ± 1.84
Baseline w/ samovar (1fc)87.47 ± 1.2781.43 ± 1.02
VoP92.80 ± 1.4083.60 ± 0.84
+ +Table 3: Ablation studies on Qualcomm Keyword Speech dataset under closed-set setting. + +
MethodNo. hidden unitsαAccuracy(%)
VoP with one hyper-personalizer325e-442.35 ± 1.34
VoP325e-492.80 ± 1.40
VoP (α = 5e-5)325e-588.10 ± 0.84
VoP (α = 0; Vanilla)32068.40 ± 2.12
VoP with 64 hidden units645e-485.71 ± 0.70
+ +Finally, we verify the effect of the VoP loss on the personalization of the hyper-perosnitzer for multiple PIDs. For this purpose, we visualize the means, outputs of hyper-perosnizers, of two different PIDs, for the VoP and vanilla models in Figs. 4b and 4c, respectively. The light red and light blue circles represent means from the hyper-perosnizer respective to PID regardless of four classes. The red and blue crosses denote the proto-mean of PID1 and PID2, respectively. In vanilla case depicted in Fig. 4b, outputs are scattered sporadically and there is little correlation among the means within the same PID. Interestingly, in Fig. 4c, which is the case of the VoP model, means are well clustered near the proto-mean according to each PID. Note that the KL divergence of the VoP loss enforce the mean of a sample to follow the distribution of the corresponding personality. Namely, the VoP loss has no explicit design, such as contrastive loss, to separate the samples with different PIDs. Nevertheless, the KL divergence successfully groups the samples depending on their personalities. + +From this analysis, the KL divergence loss considers estimating the reliable variational distribution to a sample-specific prior. By minimizing cross-entropy and KL divergence together by the VoP loss, each personalized weight distribution can be unique during optimized to both the target task and the personality. Also, sample-wise generated model can achieve representativeness corresponding to personality with sample-wise KL regularization. + +Result We compare our VoP with multiple variants of the baseline model. As in (Tang et al., 2018), we first include the dropout regularization on the baseline (Baseline w/ Dropout). Also, we applied samovar (Iakovleva et al., 2020), a Bayesian weight generation technique, to the baseline (Baseline w/ samovar). Since samovar generates layer's weights based on the set-to-set relationship between support and query sets for few-shot classification task, we apply + +Table 4: Adequacy for no. the enrollment samples. + +
No. samples54321
Accuracy(%)92.8±1.492.3±1.893.3±1.092.7±1.692.1±1.7
+ +samovar splitting a minibatch into two sets (considering $30\%$ for each personality as their support set) for weight generation. For the proposed VoP, we personalize two last fully-connected (fc) layers. + +In Table 2, we report the accuracy scores. In the open-set setting, the dropout regularization is slightly effective. But, it results in a degraded performance on the closed-set setting. Whereas, the proposed VoP significantly improves the baseline in both settings by $4.99\%$ and $9.15\%$ . As samovar is designed for the last classification layer, we first apply it on the last fc layer of the baseline. Also, for fair comparison with our VoP, we also apply samovar on the last two fc layers. In the open-set setting, samovar decently personalizes the last fc layer, but is less effective on the closed-set setting. Also, it fails to personalize more than the final classification layer, yielding severe performance drop in both settings. Note that, our VoP outperforms all the variants of the baseline at least $4.98\%$ and $2.23\%$ on closed- and open-set settings, respectively. + +This is because hyper-personalizer of VoP is well-designed for giving the representativeness to each generated model from the single sample. Namely, the hyper-personalizer is beneficial for such few enrollment samples. Hence, our VoP is effective to the KWS task which needs personalization. + +Ablation studies To analyze the efficacy of VoP, we provide ablation studies for several important factors: the number of the hyper-personalizer, the number of hidden units per hyper-personalizer, and $\alpha$ . In Table 3, we report the accuracy scores of five variants where the best performed one is bold-faced. Notice that we personalize the last fully-connected layer when using one hyper-personalizer, and the last two ones for two hyper-personalizers. When using less number of the hyper-personalizer, the accuracy score is degraded by $50.10\%$ due to weak personalization. Next, as qualitatively studied in Sec. 4.1, on using the vanilla VoP ( $\alpha = 0$ ), the personalization is unreliable compared to $\alpha = 5\mathrm{e}-4$ . Similar tendency is shown for $\alpha = 5\mathrm{e}-5$ . Furthermore, when doubling the number of hidden units, VoP suffers from performance degradation, as well. From these ablation studies, we see that those factors are important for successful personalization via forwarding in VoP. We also show the relationship between the test performance and the size of enrollment sample in Table 4. Until reducing the number of enrollment samples from 5 to 2, the performance is maintained. And, at using just one sample for enrollment, there is only $0.6\%$ performance degradation. This means that VoP gives representativeness to the independent sample by regularizing every generated model from a single sample with the KL loss on training. + +Table 5: Open set speaker verification equal error rates (lower is better) on VoxCeleb1 test set. + +
MethodObjectiveEqual error rates(%)
Fast ResNet-34VGG-M-40
Baseline VoPAngular Prototypical5.46±0.028.13±0.24
5.24±0.087.91±0.14
+ +# 4.2. Speaker Verification + +Speaker verification (SV) is a task to dichotomize whether an utterance belongs to a specific speaker based on the enrolled utterances. To apply the proposed VoP to this task, we employ the Fast ResNet-34 (Chung et al., 2020) and the VGG-M-40 (Nagrani et al., 2017) as baseline networks. Here, considering each speaker as a personality, we personalize the last fully connected layer of each baseline. Note that, in the benchmark VoxCeleb1 (Nagrani et al., 2017) dataset, all testing speakers are not pre-defined in the training set. Hence, both baselines are designed to solve metric learning problem in their literature. To apply VoP, we take the angular prototypical loss, commonly used in the baselines, as our task loss. Then, we use these two samples to calculate each proto-mean and proto-variance. For each 200-sized minibatch, we randomly select one person for generating personal weights from proto-mean. As VoP computes the metric loss in the same space, it helps to generate metric learning space for a given proto-set. $\alpha$ is set as 1e-7. + +Dataset VoxCeleb1 contains 153,516 utterances for 1,251 celebrities, which are extracted from YouTube videos. This data consists of $55\%$ of the male speakers and $45\%$ of the female speakers, which is gender balanced. The speakers cover a different accents, ethnicities and ages. + +Result Following the typical evaluation protocol (Chung et al., 2020), we sample 10 four-second temporal crops at regular interval from each test sample, and compute similarities with all possible pairs $(10 \times 10)$ . Table 5 shows the equal error rates on the VoxCeleb1 test set. VoP generates personalized weights with the 10 crops from a target speaker. We see that the proposed VoP show better performance than both baselines due to personalized metric feature space. + +# 4.3. Few-Shot Classification + +We also apply our VoP on few-shot classification task on the miniImageNet (Vinyals et al., 2016). We employ the Prototypical Net (Snell et al., 2017) (Proto-Net) as the baseline, where the embedding architecture is composed of four convolutional blocks. Each block is comprised of $64 \times 3 \times 3$ convolutions, batch normalization layer, a ReLU nonlinearity and a $2 \times 2$ max-pooling layer. When applied to the images of miniImageNet, this architecture results in a 1,600-dimensional output space. In this task, we consider the personality of each episode. Namely, the hyper-personalizer is trained to produce the weight distribution of each episode + +Table 6: Few-shot classification accuracy on miniImageNet. The baseline is re-implemented following the literature. + +
MethodBackbone5-way accuracy(%)
1-shot5-shot
Baseline VoPConvNet-6449.42 ± 0.7367.39 ± 0.62
51.43 ± 0.5468.44 ± 0.64
+ +from the support set. Specifically, we personalize the convolution filter of the last block. Since the target categories keep changed in each episode, the baseline doesn't include the classification layer. Hence, we only add the KL divergence loss on their basic loss where $\alpha$ is empirically set to 5e-4. In testing, the personalized embedding architecture can produce embedded features specialized to the personality of the given episode via forwarding the support set. Except for the loss function, we follow the experimental setting of the baseline e.g. learning rate, optimizer, episode configuration. + +Dataset The miniImagenet dataset consists of 60,000 color images of size $84 \times 84$ with 100 classes where each class includes 600 images. We followed the split introduced by (Vinyals et al., 2016): 64, 16, and 20 classes for training, validation and testing, respectively. The 16 validation classes is used for monitoring generalization performance. + +Result Following the standard setting adopted by the ProtoNet, we conducted 5 way 1-shot and 5-shot classification tasks. We train using 30-way episodes for 1-shot classification and 20-way episodes for 5-shot classification. We match train shot to test shot and each class contains 15 query points per episode. Table C shows the accuracy scores for 1-shot 5-way and 5-shot 5-way where each is averaged over 600 test episodes and are reported with $95\%$ confidence intervals. Even though using the same architecture and computational cost with the baseline, the proposed VoP yields higher accuracy scores for both tasks by $2.01\%$ and $1.05\%$ , each. Accordingly, we see that the proposed method is effective to personalize the embedding space by forwarding merely a few training examples. + +# 5. Conclusions + +We proposed Variational On-the-Fly Personalization (VoP), a novel personalization method that can produce a personalized network via forwarding a small amount of personal data on-the-fly. The proposed VoP can effectively estimate the weight distribution suitable for an individual without additional training using a large amount of personal data. Through extensive experiments on the three important tasks including the open-set problem, we showed that VoP successfully generates an accurately personalized model without increasing the computational cost. Also, as additional training is not required, it can be easily applied to various scenarios on edge devices e.g. mobile and IoT devices. + +# Acknowledgements + +Nojun Kwak was supported by the National Research Foundation of Korea (NRF) grant (2021R1A2C3006659) and IITP grant [NO.2021-0-01343, Artificial Intelligence Graduate School Program (Seoul National University)], both funded by the Korea government (MSIT). The research that is the subject of this paper, and the paper itself, was solely funded by Qualcomm Technologies, Inc. + +# References + +AntixK. https://github.com/AntixK/PyTorch-VAE, 2018. +Balle, J., Minnen, D., Singh, S., Hwang, S. J., and Johnston, N. Variational image compression with a scale hyperprior. In The 35th International Conference on Machine Learning. 2018. +Castorini. Honk: Cnns for keyword spotting. https://github.com/castorini/honk, 2017. +Chen, J. and Ran, X. Deep learning with edge computing: a review. Proceedings of the IEEE, 107(8):1655-1674, 2019. +Cheng, Z., Sun, H., Takeuchi, M., and Katto, J. Learned image compression with discretized gaussian mixture likelihoods and attention modules. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2020. +Choi, S., Seo, S., Shin, B., Byun, H., Kersner, M., Kim, B., Kim, D., and Ha, S. Temporal convolution for real-time keyword spotting on mobile devices. In Interspeech, 2019. +Chung, J. S., Huh, J., Mun, S., Lee, M., Heo, H.-S., Choe, S., Ham, C., Jung, S., Lee, B.-J., and Han, I. In defence of metric learning for speaker recognition. In Interspeech, 2020. +ClovaAI. Clova baseline system for the voxceleb speaker recognition challenge 2020. https://github.com/clovaai/voxceleb Trainer, 2020. +Das, D., Yun, S., and Porikli, F. Confess: A framework for single source cross-domain few-shot learning. In International Conference on Learning Representations, 2022. +Deng, Y., Kamani, M. M., and Mahdavi, M. Adaptive personalized federated learning, 2020. Forthcoming. +Fallah, A., Mokhtari, A., and Ozdaglar, A. Personalized federated learning with theoretical guarantees: a model-agnostic meta-learning approach. In The 34th Conference on Neural Information Processing Systems. 2020. + +Finn, C., Abbeel, P., and Levine, S. Model-agnostic meta-learning for fast adaptation of deep networks. In International Conference on Machine Learning, pp. 1126-1135. PMLR, 2017. +Gal, Y. Uncertainty in deep learning. Cambridge, 2016. +Gordon, J., Bronskill, J., Bauer, M., Nowozin, S., and Turner, R. E. Meta-learning probabilistic inference for prediction. In *The Sixth International Conference on Learning Representation*, 2018. +Ha, D., Dai, A., and Le, Q. V. Hypernetworks. In The 34th International Conference on Machine Learning. 2017. +Hanzely, F. and Richtárik, P. Federated learning of a mixture of global and local models, 2020. Forthcoming. +Hoffman, M. D., Blei, D. M., Wang, C., and Paisley, J. Stochastic variational inference. Journal of Machine Learning Research, 14(5), 2013. +Iakovleva, E., Verbeek, J., and Alahari, K. Meta-learning with shared amortized variational inference. In The 37th International Conference on Machine Learning, 2020. +Jiang, Y., Konečny, J., Rush, K., and Kannan, S. Improving federated learning personalization via model agnostic meta learning, 2019. Forthcoming. +Jin, Q., Yang, L., and Liao, Z. Adabits: Neural network quantization with adaptive bit-widths. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2020. +Kim, B., Lee, M., Lee, J., Kim, Y., and Hwang, K. Query-by-example on-device keyword spotting. https://developer等多项.com/project/keyword-speech-dataset, 2019. +Kingma, D. P. and Welling, M. Auto-encoding variational bayes, 2013. Forthcoming. +Ko, T., Chen, Y., and Li, Q. Prototypical networks for small footprint text-independent speaker verification. In International Conference on Acoustics, Speech, & Signal Processing, 2020. +Kundu, J. N., Venkat, N., Babu, R. V., et al. Universal source-free domain adaptation. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2020. +Lee, J., Cho, S., and Beach, S.-K. Context-adaptive entropy model for end-to-end optimized image compression. In The 36th International Conference on Machine Learning. 2018. +Li, X., Wei, X., and Qin, X. Small-footprint keyword spotting with multi-scale temporal convolution. In *Interspeech*, 2020. + +Long, M., Zhu, H., Wang, J., and Jordan, M. I. Unsupervised domain adaptation with residual transfer networks. In The 30th Conference on Neural Information Processing Systems. 2016. +Luo, Z., Zou, Y., Hoffman, J., and Fei-Fei, L. Label efficient learning of transferable representations across domains and tasks. In The 31th Conference on Neural Information Processing Systems. 2017. +Minnen, D., Balle, J., and Toderici, G. D. Joint autoregressive and hierarchical priors for learned image compression. Advances in Neural Information Processing Systems, 2018. +Motiian, S., Jones, Q., Iranmanesh, S. M., and Doretto, G. Few-shot adversarial domain adaptation. In The 31th Conference on Neural Information Processing Systems. 2017. +Nagrani, A., Chung, J. S., and Zisserman, A. Voxceleb: a large-scale speaker identification dataset. In Interspeech, 2017. +Ravi, S. and Larochelle, H. Optimization as a model for few-shot learning. In The 5th International Conference on Learning Representations, 2016. +Snell, J., Swersky, K., and Zemel, R. Prototypical networks for few-shot learning. In The 31th Conference on Neural Information Processing Systems. 2017. +Sung, F., Yang, Y., Zhang, L., Xiang, T., Torr, P. H., and Hospedales, T. M. Learning to compare: relation network for few-shot learning. In IEEE/CVF Conference on Computer Vision and Pattern Recognition. 2018. +Tang, R. and Lin, J. Honk: a pytorch reimplementation of convolutional neural networks for keyword spotting, 2017. Forthcoming. +Tang, R. and Lin, J. Deep residual learning for small-footprint keyword spotting. In International Conference on Acoustics, Speech, & Signal Processing, 2018. +Tang, R., Wang, W., Tu, Z., and Lin, J. An experimental analysis of the power consumption of convolutional neural networks for keyword spotting. In International Conference on Acoustics, Speech, & Signal Processing, 2018. +Tzeng, E., Hoffman, J., Darrell, T., and Saenko, K. Simultaneous deep transfer across domains and tasks. In IEEE/CVF International Conference on Computer Vision. 2015. +Vinyals, O., Blundell, C., Lillicrap, T., Wierstra, D., et al. Matching networks for one shot learning. In The 30th + +Conference on Neural Information Processing Systems. 2016. +Wang, J., Wang, K.-C., Law, M. T., Rudzicz, F., and Brudno, M. Centroid-based deep metric learning for speaker recognition. In International Conference on Acoustics, Speech, & Signal Processing, 2019a. +Wang, X., Han, Y., Wang, C., Zhao, Q., Chen, X., and Chen, M. In-edge AI: intelligentizing mobile edge computing, caching and communication by federated learning. IEEE Network, 33(5):156-165, 2019b. +Yang, S., Wang, Y., van de Weijer, J., Herranz, L., and Jui, S. Generalized source-free domain adaptation. 2021. +Ye, H.-J., Hu, H., Zhan, D.-C., and Sha, F. Few-shot learning via embedding adaptation with set-to-set functions. In IEEE/CVF Conference on Computer Vision and Pattern Recognition. 2020. +Zhang, Y., Suda, N., Lai, L., and Chandra, V. Hello edge: keyword spotting on microcontrollers. CoRR, abs/1711.07128, 2017. + +# A. Proof for $KL(q_{\theta}(\omega |x_i^k)||p(\omega |x_i^k))$ + +In eq. (10), we analytically calculated the KL divergence with two assumptions: + +- The sample-specific prior follows the distribution of the personality, i.e. $p(\omega | x_i^k) \simeq p(\omega | k)$ . +- The variational distribution and the personality distribution are an uncorrelated Gaussian distribution. + +Based on the assumptions, we prove eq. (10): + +$$ +\begin{array}{l} K L \left(q _ {\theta} \left(\omega \left| x _ {i} ^ {k}\right) \right| | p \left(\omega \left| x _ {i} ^ {k}\right)\right)\right) \simeq K L \left(\mathcal {N} \left(\omega \mid \mu_ {i}, \Sigma_ {i}\right) \right\lvert \left| \mathcal {N} \left(\omega \mid \bar {\mu} _ {k}, \bar {\Sigma} _ {k}\right)\right) \\ = \mathbb {E} _ {\omega \sim q _ {\theta}} \left[ \ln q _ {\theta} \left(\omega | x _ {i} ^ {k}\right) - \ln p (\omega | x _ {i} ^ {k}) \right] \\ = \mathbb {E} _ {\omega \sim q _ {\theta}} \left[ \frac {1}{2} \ln \frac {| \bar {\Sigma} _ {k} |}{| \Sigma_ {i} |} - \frac {1}{2} (\omega - \mu_ {i}) ^ {T} \Sigma_ {i} ^ {- 1} (\omega - \mu_ {i}) + \frac {1}{2} (\omega - \bar {\mu} _ {k}) ^ {T} \bar {\Sigma} _ {k} ^ {- 1} (\omega - \bar {\mu} _ {k})) \right] \\ = \frac {1}{2} \left(\ln \frac {\left| \bar {\Sigma} _ {k} \right|}{\left| \Sigma_ {i} \right|} - \mathbb {E} _ {\omega \sim q _ {\theta}} \left[ \operatorname {t r} \left[ (\omega - \mu_ {i}) (\omega - \mu_ {i}) ^ {T} \Sigma_ {i} ^ {- 1} \right] \right] + \mathbb {E} _ {\omega \sim q _ {\theta}} \left[ (\omega - \bar {\mu} _ {k}) ^ {T} \bar {\Sigma} _ {k} ^ {- 1} (\omega - \bar {\mu} _ {k}) \right]\right) \\ = \frac {1}{2} (\ln \frac {| \bar {\Sigma} _ {k} |}{| \Sigma_ {i} |} - \mathrm {t r} [ \Sigma_ {i} \Sigma_ {i} ^ {- 1} ] + \mathbb {E} _ {\omega \sim q _ {\theta}} [ (\omega - \bar {\mu} _ {k}) ^ {T} \bar {\Sigma} _ {k} ^ {- 1} (\omega - \bar {\mu} _ {k}) ]) \\ = \frac {1}{2} \left(\ln \frac {\left| \bar {\Sigma} _ {k} \right|}{\left| \Sigma_ {i} \right|} - Z + \operatorname {t r} \left\{\bar {\Sigma} _ {k} ^ {- 1} \Sigma_ {i} \right\} + \left(\mu_ {i} - \bar {\mu} _ {k}\right) ^ {T} \bar {\Sigma} _ {k} ^ {- 1} \left(\mu_ {i} - \bar {\mu} _ {k}\right)\right) \\ = \frac {1}{2} (\ln \prod_ {z = 1} ^ {Z} \bar {\sigma} _ {(k, z)} ^ {2} - \ln \prod_ {z = 1} ^ {Z} \sigma_ {(i, z)} ^ {2} - Z + \sum_ {z = 1} ^ {Z} \frac {\sigma_ {(i , z)} ^ {2}}{\bar {\sigma} _ {(k , z)} ^ {2}} + \sum_ {z = 1} ^ {Z} \frac {(\mu_ {(i , z)} - \bar {\mu} _ {(k , z)}) ^ {2}}{\bar {\sigma} _ {(k , z)} ^ {2}}) \\ = \frac {1}{2} \sum_ {z = 1} ^ {Z} (\ln \bar {\sigma} _ {(k, z)} ^ {2} - \ln \sigma_ {(i, z)} ^ {2} - 1 + \frac {\sigma_ {(i , z)} ^ {2}}{\bar {\sigma} _ {(k , z)} ^ {2}} + \frac {(\mu_ {(i , z)} - \bar {\mu} _ {(k , z)}) ^ {2}}{\bar {\sigma} _ {(k , z)} ^ {2}}) \\ \end{array} +$$ + +where $z \in [Z]$ is the index of multivariate Gaussian dimension. + +# B. Architecture of Hyper-Personalizer + +![](images/822a05072706b625ed82199ed3aad87b1e01888303c4739bd80f5f0e26f43c9b.jpg) +Figure 5: The overall architecture of the hyper-personalizer. +Fig. 5 depicts the detailed architecture of the hyper-personalizer in the proposed VoP. Similar to the encoder of VAE (AntixK, 2018), our hyper-personalizer is designed by a multi-layer perceptron with a hidden layer which is shared to two output layers. + +For $i$ th sample, taking the spatially average-pooled encoded feature as an input, the hyper-personalizer produces two outputs: $\mu_i$ and $\sigma_i^2$ (both are in $\mathbb{R}^Z$ ). The sizes of $\mu_i$ and $\sigma_i^2$ are equal to that of a target personalized layer (reparameterized sample-specific weight). Hence, the hyper-personalizer computes the mean and variance for each element of the sample-specific weight. + +# C. Comparison with Other Bayesian Approaches in Few-Shot Classification + +Table 7: Comparison of the proposed VoP and another Bayesian approach, samovar (Iakovleva et al., 2020), in few-shot classification. + +
MethodFeatures5-way Acc.(%)ΔAcc. to baseline
1-shot5-shot1-shot5-shot
Baseline (versa, (Gordon et al., 2018)) samovarConv-553.4 ± 1.967.4 ± 0.9--
52.4 ± 0.369.8 ± 0.2-1.01.6
Baseline (Proto-Net, (Snell et al., 2017)) VoP (Ours)Conv-449.4 ± 0.767.4 ± 0.6--
51.4 ± 0.568.4 ± 0.62.01.0
+ +Table 8: Comparison of the proposed VoP and existing few-shot classification methods for different backbone features. + +
MethodFeatures5-way Acc. (%)
1-shot5-shot
Matching Nets (Vinyals et al., 2016)46.660.0
Meta LSTM (Ravi & Larochelle, 2016)43.4 ± 0.860.6 ± 0.7
MAML (Finn et al., 2017)Conv-448.7 ± 1.863.1 ± 0.9
RelationNets (Sung et al., 2018)50.4 ± 0.865.3 ± 0.7
Proto-Net (Snell et al., 2017)49.4 ± 0.767.4 ± 0.6
VoP (Ours)51.4 ± 0.568.4 ± 0.6
versa (Gordon et al., 2018)53.4 ± 1.967.4 ± 0.9
samovar (Iakovleva et al., 2020)Conv-552.4 ± 0.369.8 ± 0.2
VoP (Ours)52.8 ± 0.270.3 ± 0.3
+ +In Sec. 4.3, we extended the proposed VoP to the few-shot classification. In this field, versa, a Bayesian approach, has tried to generate the weight of the last linear classification layer, for given task (support and query sets). While our VoP is based on the sample-specific posterior approximation for personalization, it starts from the formulation of the posterior approximation of the entire support set. Namely, versa is consciously designed to this few-shot classification task. On the top of the ConvNet backbone, versa generates weight and bias vectors for each class in class independent manner. To this end, it manipulates the size of conv-4 block feature with another $1 \times 1$ convolution layer, so that their embedding backbone, called as Conv-5, is larger than ours. Although versa uses more computation and is fitted to this few-shot classification task, the proposed VoP, simple extension to this task, outperforms it by $1.0\%$ on the 5-shot setting in Table 7. Also, as shown in Table 8, when using the same backbone (Conv-5), our VoP achieves higher accuracy than versa by a large margin $2.9\%$ in the 5-shot setting. + +Similar to versa, samovar also generates the task-specific weight of the classification layer. Based on the versa's formulation, samovar exploits the relationship between the support set and the union of support and query sets. In specific, the posterior for the union set is approximated, using the prior given by the support set. Hence, samovar is more deliberately formulated for this few-shot classification task. + +Furthermore, samovar has several advantages in the experimental setting. First, samovar employs versa as the baseline which is better than our baseline (Proto-Net). versa inevitably requires another $1 \times 1$ convolution layer and generates the linear classification layer on top of the layer. Whereas, we personalize the Conv-4 block (the last layer of ConvNet backbone), itself. Hence, we doesn't need more computation. Second, samovar exploits task conditioning and auxiliary co-training schemes to further improve the performance while VoP doesn't. + +Due to the different assumption in formulation, we can't direct apply VoP on the versa baseline. Also, the source code of samovar is not released, and it was impossible to reproduce samovar. Accordingly, it is difficult to compare our VoP and samovar on fair experimental setting of the baseline and w/o additional schemes. Therefore, keeping the difference in backbones, we first compare VoP and samovar in terms of the improvement to the corresponding baselines ( $\Delta$ Acc.) in Table 7. In the 5-shot setting, samovar yields better $\Delta$ Acc. than ours by $0.6\%$ , since it is based on the set-to-set relationship. Our VoP method is not designed to this few-shot classification task. Nevertheless, VoP is successfully extended to task in both 1- and 5-shot settings (better than the proto-net baseline by $2.0\%$ and $1.0\%$ , respectively). Especially, the proposed VoP achieves a larger $\Delta$ Acc. than samovar in challenging 1-shot setting ( $2.0\%$ vs $-1.0\%$ in $\Delta$ Acc.). Next, in Table 8 we apply the same backbone of samovar (Conv-5) to our VoP. Here, VoP outperforms samovar for both settings. + +Table 9: Comparison of VoP and BatchNorm Calibration (BC) in KWS and few-shot classification for accuracy $(\%)$ . + +
MethodKeyword spottingFew-shot classification
1-shot5-shot
Baseline87.46 ± 1.6849.42 ± 0.7367.39 ± 0.62
BatchNorm Calibration90.70 ± 1.0349.62 ± 0.3867.19 ± 0.44
VoP92.80 ± 1.4051.43 ± 0.5468.44 ± 0.64
+ +Table 10: Comparison of VoP and the simple fine-tuning of the global model with five enrollment samples using different learning rates (lr) in KWS according to accuracy (\%). + +
MethodBaselineBaseline w/ Dropout
Pre-trained87.46 ± 1.6881.77 ± 1.75
Fine-tuning (lr=1e-3)58.55 ± 0.9259.90 ± 0.57
Fine-tuning (lr=1e-4)72.95 ± 0.7777.10 ± 0.98
Fine-tuning (lr=1e-5)87.87 ± 0.0978.95 ± 0.21
Fine-tuning (lr=1e-6)87.80 ± 0.2877.70 ± 0.84
VoP92.80 ± 1.40-
+ +# D. Comparison with Other Naive Techniques + +On the KWS tasks with the closed-set setting, we compare the proposed VoP with two naive techniques, BatchNorm Calibration (BC) (Jin et al., 2020) and fine-tuning the global model with few enrollment samples (5), which are straightforwardly applicable to the personalization task. Since BC (Jin et al., 2020) inevitably requires the batch normalization layer, we apply it to a network with batch normalization layers. In specific, we pass the target data through the network, and then re-calculate the batch normalization parameters for their personalization. As demonstrated in Table 9, BC improves the baseline by $3.3\%$ , but is worse than our VoP. This result means that the personalization of only the parameters of the batch normalization layers has a limitation since most of parameters are still fixed (not personalized). Contrarily, our VoP can effectively regularize the entire parameters of the target layers to represent discriminative characteristics among personalities. + +Next, we compare the proposed VoP with the simple fine-tuning of the pre-trained global models varying the learning rates. In Table 10, the pre-trained (Baseline) is Baseline of Tables 2 and 9, and the pre-trained (Baseline w/ Dropout) is Baseline w/ Dropout of Table 2. We fine-tune each model with five enrolment samples for 10 times on different learning rates. In the case of Baseline w/ Dropout, the fine-tuning degrades the pre-trained global model for all the learning rates. Only when the dropout scheme is removed (Baseline), fine-tuning with such small learning rates can increase the performance of the pre-trained model, but the gaps are meagre $(0.41\%$ and $0.34\%)$ . On the other hand, the proposed VoP notably outperforms all the variants of the fine-tuning technique, and achieves significant performance improvement of the pre-trained baseline. + +# E. Computational Overhead + +The overhead of the hyper-personalizer (HP) itself is large as in the conventional hyper-network approaches. But, after training, in VoP, this overhead happens during enrollment process only. As we abolish the HP after enrollment, computation cost of VoP is same with the baseline in testing. We measure the training overhead by (Mac / no. params.) in Table 11. + +Table 11: Mac and parameters + +
ModuleBaseline1stHP2nd HP
Mac10M88M0.1M
Memory0.95M0.1M0.05M
+ +# F. Privacy Issue + +In recent years, deep learning-based applications and services have focused on data privacy and security issues. Our proposed Variational On-the-Fly Personalization (VoP) also handles the private data. However, VoP is free from the above issues because VoP generates the personal weights at the edge device with few forwardings. In other words, at the server, the global model and hyper-personalizer are trained with the given training dataset. After training, the personalization process is on-the-fly conducted on the client's edge device without training, and the server does not access this process. We design the personalization process with a small amount of the enrollment samples at the personal device which can protect privacy. + +# G. Implementation Details + +For all experiments, we implement VoP using the Pytorch libraries with a single 1080ti GPU. For the keyword spotting and speaker verification tasks, we used the released official implementations (Castorini, 2017; ClovaAI, 2020) following a MIT License. In few-shot classification, we re-implemented the baseline (Snell et al., 2017) on the Pytorch libraries. All experiments are conducted three times with a GeForce GTX 1080 Ti GPU and we report the mean and standard deviation. \ No newline at end of file diff --git a/variationalontheflypersonalization/images.zip b/variationalontheflypersonalization/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..ac059c82129ce8c44eb100f16f76f5e66a2c0460 --- /dev/null +++ b/variationalontheflypersonalization/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3c3770d4759419bcec0fb40fd4891ed30edf43556e58c6c22837794841bfdf27 +size 607563 diff --git a/variationalontheflypersonalization/layout.json b/variationalontheflypersonalization/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..77a066d4098633cf8390c6be09ceec66ff1eb1dd --- /dev/null +++ b/variationalontheflypersonalization/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:407cee488215df60c2cc7540237a6e2465565a12207cecb5ee9a08484dcff910 +size 559398 diff --git a/variationalsparsecodingwithlearnedthresholding/45d9e313-aacd-45da-b984-d98d417950f4_content_list.json b/variationalsparsecodingwithlearnedthresholding/45d9e313-aacd-45da-b984-d98d417950f4_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..77625d4a8efbfd3d5a295a62ce8b0acb90c7c8c0 --- /dev/null +++ b/variationalsparsecodingwithlearnedthresholding/45d9e313-aacd-45da-b984-d98d417950f4_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:787e818ec29241a54aa793c9a6d9bab3a3865caecdfe8617304da0abc186936c +size 150193 diff --git a/variationalsparsecodingwithlearnedthresholding/45d9e313-aacd-45da-b984-d98d417950f4_model.json b/variationalsparsecodingwithlearnedthresholding/45d9e313-aacd-45da-b984-d98d417950f4_model.json new file mode 100644 index 0000000000000000000000000000000000000000..ba0cbc618ca48d568cdb72e45d3eeba5fbd3cd0c --- /dev/null +++ b/variationalsparsecodingwithlearnedthresholding/45d9e313-aacd-45da-b984-d98d417950f4_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eaddf9f5ae4fca0d59b62dcec9879d2d40c5ef35ca173b21d43141f36f1ab5d0 +size 182095 diff --git a/variationalsparsecodingwithlearnedthresholding/45d9e313-aacd-45da-b984-d98d417950f4_origin.pdf b/variationalsparsecodingwithlearnedthresholding/45d9e313-aacd-45da-b984-d98d417950f4_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..087bb48b6d61e689cb974f3d33f762d359835c19 --- /dev/null +++ b/variationalsparsecodingwithlearnedthresholding/45d9e313-aacd-45da-b984-d98d417950f4_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c56dd96b5e56969817a873e5c4494dd9475ae7a2d3e483701e13451194c7bc2d +size 7915044 diff --git a/variationalsparsecodingwithlearnedthresholding/full.md b/variationalsparsecodingwithlearnedthresholding/full.md new file mode 100644 index 0000000000000000000000000000000000000000..37d61d4f8e1aadc7e862e26559865ff2b2ec1036 --- /dev/null +++ b/variationalsparsecodingwithlearnedthresholding/full.md @@ -0,0 +1,762 @@ +# Variational Sparse Coding with Learned Thresholding + +Kion Fallah1 Christopher J. Rozell1 + +# Abstract + +Sparse coding strategies have been lauded for their parsimonious representations of data that leverage low dimensional structure. However, inference of these codes typically relies on an optimization procedure with poor computational scaling in high-dimensional problems. For example, sparse inference in the representations learned in the high-dimensional intermediary layers of deep neural networks (DNNs) requires an iterative minimization to be performed at each training step. As such, recent, quick methods in variational inference have been proposed to infer sparse codes by learning a distribution over the codes with a DNN. In this work, we propose a new approach to variational sparse coding that allows us to learn sparse distributions by thresholding samples, avoiding the use of problematic relaxations. We first evaluate and analyze our method by training a linear generator, showing that it has superior performance, statistical efficiency, and gradient estimation compared to other sparse distributions. We then compare to a standard variational autoencoder using a DNN generator on the Fashion MNIST and CelebA datasets. + +# 1. Introduction + +Variational inference has become a ubiquitous tool in unsupervised learning of a distribution of latent features. These variational distributions can offer approximations in cases where inference over a true distribution is computationally expensive. Once inference is performed, latent features can be used for a variety of machine learning tasks, such as summarizing a dataset or training a generative model. The structure and statistical properties of latent features depend on the practitioner's choice of a prior distribution. Sparse distributions, in which only a few features are non-zero for + +![](images/9ff25e74d56835dea1eddcc9db0404e6a390d6e767840b814f0cf685393518d9.jpg) + +![](images/5626b4ad1863d7dde68e20a0ed4e2bfd760e271a46018f4ac6dac2f834bc78d1.jpg) +Figure 1. Comparison of standard black-box variational inference and our proposed approach for variational sparse coding. Orange arrows depict a forward pass, blue arrows depict automatic differentiation. Top: Sampling from standard variational inference approaches result in all features non-zero. Bottom: Our approach incorporates sparsity via a shifted soft-threshold function. We utilize a straight-through estimator, skipping the gradient of the shifted soft-threshold, for exact sparsity without numerical instability during training. + +each input data sample, have been favored for encouraging statistically efficient representations, especially when input data has low-dimensional structure (Olshausen & Field, 2004; Elad, 2010). + +To perform inference in sparse models with low computational cost, recent black-box variational inference (BBVI) (Ranganath et al., 2013) methods have been proposed to learn distribution parameters with DNNs using automatic differentiation (Kingma & Welling, 2014; Rezende et al., 2014). Unfortunately, these approaches either do not explicitly learn sparse features (Barello et al., 2018) or rely on relaxations that can lead to poor gradient estimation during training (Tonolini et al., 2020). + +Motivated by the success of soft-thresholding in iterative optimization procedures (Daubechies et al., 2003; Donoho & Johnstone, 1994), we propose a BBVI method to learn sparse distributions by thresholding samples drawn from a Laplacian or Gaussian distribution. We analytically show that thresholded samples from the former are identically distributed to a Spike-and-Slab distribution, giving practitioners control over the extent of sparsity by adjusting a + +threshold hyper-parameter. In cases where the degree of sparsity is not known beforehand, we also propose a technique to learn a distribution on the threshold parameter. To train our inference network, we apply a straight-through estimator (Bengio et al., 2013; Oord et al., 2018), leading to favorable training stability and gradient estimation. Finally, we propose a new sampling procedure that encourages feature reuse, encouraging the generator to learn more diverse features. We showcase the performance of our method compared to other inference strategies by training and analyzing a linear generator on whitened image patches (Olshausen & Field, 1996) and a DNN generator on the Fashion MNIST (Xiao et al., 2017) and CelebA (Liu et al., 2015) datasets1. + +# 2. Related Work + +# 2.1. MAP Estimate/Regressive Inference + +Sparsity models have a long history in statistical modeling with methods such as LASSO regularization (Tibshirani, 1996). These models often infer sparse latent features via a maximum a posteriori (MAP) estimate, requiring an iterative optimization procedure to be solved. The seminal work of (Olshausen & Field, 1996) proposes sparse codes as a means of unsupervised learning of a linear generator. Once trained, columns of the generator qualitatively resemble the receptive fields of mammalian cortical cells. Although methods exist to solve this optimization in discrete (Beck & Teboulle, 2009; Yang et al., 2012) and continuous (Rozell et al., 2008) time, their computational cost often scales poorly with dimensionality, making them prohibitive to use in modern deep learning settings. + +An alternative approach for inference has been to use DNNs to regress sparse codes for given input data. One method "unrolls" iterations of the ISTA algorithm (Gregor & LeCun, 2010). These methods are limited for unsupervised learning since they require ground truth codes as supervision during training. + +# 2.2. Variational Inference + +Early variational inference approaches applied exponential families for sparse coding, using iterative procedures to fit a variational posterior distribution (Girolami, 2001; Seeger, 2008). Later works explored variational methods for Spike-and-Slab models (Goodfellow et al., 2012; Sheikh & Lücke, 2016), using approximations to analytic solutions for faster inference. None of these approaches effectively scale inference to high-dimensional DNN representations. + +The proposal of BBVI, where DNNs are used to estimate parameters of a variational posterior distribution, has led + +to a leap in the computational efficiency of variational inference (Kingma & Welling, 2014; Rezende et al., 2014). As such, many recent methods have been proposed to train DNN inference networks with various prior distributions. These include Laplacian (Barello et al., 2018), Spike-and-Slab (Tonolini et al., 2020), and Beta-Bernoulli (Singh et al., 2017) distributions. Other work has incorporated sparsity through hierarchical posterior distributions (Salimans, 2016), evolutionary variational algorithms (Drefs et al., 2022), or group-sparsity in connections to generator networks (Ainsworth et al., 2018; Moran et al., 2021). We refer the reader to (Zhang et al., 2018) for a review of variational inference. + +# 2.3. Estimating the Variational Bound + +Various sampling approaches have been proposed to estimate the variational bound. (Cremer et al., 2017) proposes a sampling procedure based on a tighter bound on the data likelihood introduced in (Burda et al., 2016). Counterintuitively, using this tighter bound in training leads to a reduced signal-to-noise ratio in the inference network gradient (Rainforth et al., 2018). In (Grover et al., 2014), the authors apply rejection sampling using a computed acceptance probability for each sample. A later work (Bauer & Mnih, 2019) learns this acceptance probability with an additional DNN. Other work uses an alternative gradient estimator in BBVI which ignores certain terms during automatic differentiation to reduce variance (Roeder et al., 2017), with a bias-free estimator proposed by (Tucker et al., 2018). + +# 3. Methods + +# 3.1. Black-box Variational Inference + +The capability of DNNs as universal function approximators has been recently applied to learn complex distributions. Given a dataset of training samples $[\mathbf{x}^1, \ldots, \mathbf{x}^N]^T \in \mathbb{R}^{N \times D}$ from target density $p(\mathbf{x})$ , BBVI can be applied to train an inference network $q_{\phi}(\mathbf{z} \mid \mathbf{x})$ to learn a distribution over latent features $\mathbf{z}^k \in \mathbb{R}^d$ . This distribution can be applied in various machine learning tasks, such as training a generator $p_{\theta}(\mathbf{x} \mid \mathbf{z})$ . To do this, one may employ the variational lower bound (ELBO) to maximize the marginal likelihood over the training samples (Jordan et al., 1998): + +$$ +\begin{array}{l} \log p _ {\boldsymbol {\theta}} (\mathbf {x}) = \log \mathbb {E} _ {p (\mathbf {z})} [ p _ {\boldsymbol {\theta}} (\mathbf {x} \mid \mathbf {z}) ] \\ = \log \mathbb {E} _ {p (\mathbf {z})} \left[ \frac {q _ {\phi} (\mathbf {z} \mid \mathbf {x})}{q _ {\phi} (\mathbf {z} \mid \mathbf {x})} p _ {\boldsymbol {\theta}} (\mathbf {x} \mid \mathbf {z}) \right] \\ \geq \mathbb {E} _ {q _ {\phi}} \left[ \log p _ {\boldsymbol {\theta}} (\mathbf {x} \mid \mathbf {z}) \right] - D _ {K L} \left(q _ {\phi} (\mathbf {z} \mid \mathbf {x}) \mid \mid p (\mathbf {z})\right) \\ = \mathcal {L} (\boldsymbol {\theta}, \phi ; \mathbf {x}). \tag {1} \\ \end{array} +$$ + +![](images/1da083969c06ee10ba339ce49af9f32a785a5514b6eaa331baad790c4d5f7549.jpg) +Figure 2. Visual depiction of the shifted soft-threshold applied to a Laplacian distribution. Probability mass $\mu \pm \lambda$ is collapsed to the origin. The red points in the left are shifted to meet at $\mu$ on the right. + +prior $p(\mathbf{z})$ and a distribution family for the posterior $q_{\phi}(\mathbf{z} \mid \mathbf{x})$ . In this work, we follow the common assumption of independence for both, $p(\mathbf{z}) = \prod_{i=1}^{d} p(z_i), q_{\phi}(\mathbf{z} \mid \mathbf{x}) = \prod_{i=1}^{d} q_{\phi}(z_i \mid \mathbf{x})$ . For each prior distribution we consider, we will use the same distribution family for our variational posterior. + +Parameters $(\phi, \theta)$ can be trained via a stochastic version of the variational expectation maximization algorithm (Neal & Hinton, 1998; Barello et al., 2018). Using batched training samples $\mathbf{x}^k$ , this algorithm iterates in two steps from initializations $(\phi^{(0)}, \pmb{\theta}^{(0)})$ : + +1. Expectation: $\phi^{(t)} = \arg \max_{\phi}\mathcal{L}\left(\pmb{\theta}^{(t - 1)},\phi ;\mathbf{x}^k\right)$ +2. Maximization: $\pmb{\theta}^{(t)} = \arg \max_{\pmb{\theta}}\mathcal{L}\left(\pmb {\theta},\phi^{(t)};\mathbf{x}^k\right)$ + +In the expectation step a differentiable transform $g_{\phi}(\mathbf{x}^k,\epsilon^{j,k})$ of auxiliary samples $\epsilon^{j,k}\sim p(\epsilon)$ is used to estimate the expectation over the inference network distribution. Coined the "reparameterization trick," this technique has been shown to reduce the variance of the gradient estimates through the inference network (Kingma & Welling, 2014; Rezende et al., 2014). In practice, the two steps of the EM algorithm are often approximated concurrently with a gradient step using a single sample $J = 1$ . + +In the next sections, we will describe 1) a method for reparameterization that results in sparse latent features and 2) a new sampling procedure in the expectation step that improves performance for distributions with sparse priors. + +# 3.2. Reparameterization for Thresholded Samples + +A favorable choice of sparse prior distribution is the Spike-and-Slab $p(z_{i}) = \gamma p(s_{i}) + (1 - \gamma)\delta (z_{i})$ (Mitchell & Beauchamp, 1988), which allows sparse random variables to be sampled by first sampling a Bernoulli random variable with probability $\gamma$ . If the random variable is non-zero, then a sample is drawn from the slab distribution $p(s_{i})$ . A Spike-and-Slab is favorable to setting $p(z_{i})$ equal to Nor + +mal, Laplacian, or Cauchy distributions because these latter distributions will never result in samples with features exactly equal to zero. This allows one to benefit from precise sparsity for downstream computations (e.g., decoding, image generation). Unfortunately, current BBVI approaches depend on continuous approximations (controlled by temperature parameter $\tau$ ) to each Bernoulli random variable $\tau$ (Tonolini et al., 2020; Jang et al., 2017; Maddison et al., 2017). Tuning $\tau$ requires a trade-off between variance and bias when estimating gradients, potentially leading to poor performance. + +Rather than parameterize $p(z_{i})$ with discrete random variables, we propose an approach that applies shifted soft-thresholding of samples drawn from a Laplacian distribution. Let $p(s) = \mathrm{Laplace}(\mu ,b)$ be a Laplacian pdf with shift $\mu$ and scale $b$ . We can draw a sample $s\sim p(s)$ and apply the shifted soft-threshold function: + +$$ +\begin{array}{l} \mathcal {T} (s; \lambda , \mu) = \operatorname {s i g n} (s - \mu) \max \left(| s - \mu | - \lambda , 0\right) \tag {2} \\ + \mathbb {I} \left[ | s - \mu | > \lambda \right] \mu . \\ \end{array} +$$ + +For ease of notation, we will use the shorthand $\mathcal{T}_{\lambda}(s)$ to refer to $\mathcal{T}(s;\lambda,\mu)$ . Intuitively, this function is a soft-threshold around $\mu$ , where points mapped to $\mu$ are set exactly to zero. This is visualized in Figure 2. When $\mu = 0$ , this function is precisely the soft-threshold function (Donoho & Johnstone, 1994). Next, we will show how this shifted soft-threshold can be used to reparameterize to a Spike-and-Slab without needing discrete random variables. + +Proposition 3.1 Samples from a Laplace distribution $s \sim p(s)$ passed through a shifted soft-threshold $z = \mathcal{T}_{\lambda}(s)$ are equivalently distributed as a Spike-and-Slab distribution $z \stackrel{i.i.d.}{\sim} p(z)$ . + +Note that under this rule for $z$ , $p(z \mid |s - \mu| \leq \lambda) = \delta(z)$ , where the spike probability $(1 - \gamma)$ can be found by computing $p(|s - \mu| \leq \lambda)$ : + +$$ +\begin{array}{l} p (| s - \mu | \leq \lambda) = 2 \int_ {0} ^ {\lambda} \frac {1}{2 b} \exp (- s b ^ {- 1}) d s \\ = 1 - \exp (- \lambda b ^ {- 1}) = (1 - \gamma). \tag {3} \\ \end{array} +$$ + +We show in Appendix A that $p(z \mid |s - \mu| > \lambda)$ is distributed as $p(s)$ . Combining these facts and marginalizing over $p(s)$ yields: + +$$ +z \sim \frac {\gamma}{2 b} \exp \left(\frac {- | z - \mu |}{b}\right) + (1 - \gamma) \delta (z). +$$ + +Using this technique, we can sample sparse random variables $\mathbf{z}^k$ for a corresponding input data $\mathbf{x}^k$ from an inference network trained via the EM algorithm (1). For a given input data sample, we encode the parameters of a base distribution that is either a Gaussian or Laplacian via $q_{\phi}(\mathbf{s}\mid \mathbf{x}^{k})$ . + +These can be used to both compute the KL divergence and to reparameterize a sample to be passed through the shifted soft-threshold. The threshold parameter can be either set as a fixed hyperparameter $\lambda = \lambda_0$ (equating to a fixed prior on the spike probability) or learned via variational inference with a factorial gamma prior $p(\lambda) = \prod_{i=1}^{d} \Gamma(\alpha_0, \frac{\alpha_0}{\lambda_0})$ (Jankowiak & Obermeyer, 2018; Garrigues & Olshausen, 2010). In the case where we perform inference on $\lambda$ , we assume independence with the base distribution $p(\mathbf{s})$ . + +One challenge during training is dealing with the non-differentiable $T_{\lambda}$ in the first term of (1). We have found that the subgradient of this function leads to shrinkage of the base distribution parameters, eventually leading to numerical instability or posterior collapse (Lucas et al., 2019). For further discussion on this issue, refer to Appendix C. As a result, we employ a straight-through estimator (Bengio et al., 2013; Jang et al., 2017; Oord et al., 2018), skipping the shifted soft-threshold when we differentiate the loss by passing the gradient from the generator directly to the base distribution parameters. This is depicted in Figure 1. + +This results in our final training objective with a reweighted KL term (Higgins et al., 2017). Following the notation of (Oord et al., 2018), we denote by $\mathrm{sg}[\cdot]$ the stopgradient operator (identity in the forward pass with partial derivatives equal to zero). + +$$ +\widetilde {\mathbf {z}} ^ {k} = \mathbf {s} ^ {k} + \mathcal {T} _ {\boldsymbol {\lambda} ^ {k}} \left(\operatorname {s g} \left[ \mathbf {s} ^ {k} \right]\right) - \operatorname {s g} \left[ \mathbf {s} ^ {k} \right] \tag {4} +$$ + +$$ +\begin{array}{l} \mathcal {L} (\boldsymbol {\theta}, \phi ; \mathbf {x} ^ {k}) = \mathbb {E} _ {q _ {\phi}} \left[ \log p _ {\boldsymbol {\theta}} \left(\mathbf {x} ^ {k} \mid \widetilde {\mathbf {z}} ^ {k}\right) \right] \\ - \beta_ {1} D _ {K L} \left(q _ {\phi} (\mathbf {s} \mid \mathbf {x} ^ {k}) \mid \mid p (\mathbf {s})\right) \tag {5} \\ - \beta_ {2} D _ {K L} \left(q _ {\phi} (\boldsymbol {\lambda} \mid \mathbf {x} ^ {k}) | | p (\boldsymbol {\lambda})\right) \\ \end{array} +$$ + +Note that in the case where we fix $\lambda^k = \lambda_0$ , the second term in (4) has no gradient and the third term in (5) is omitted. More details on reparameterization for the sampling procedure $(\mathbf{s}^k,\pmb{\lambda}^k)\sim q_{\phi}(\mathbf{s},\pmb {\lambda}\mid \mathbf{x}^k)$ and on computing the loss terms in (5) are included in Appendix B. + +# 3.3. Max ELBO Sampling + +A favorable property of MAP estimates is that priority of which latent features are non-zero is given to those that best represent features in input data. These developed features lead to the highest decrease in loss, a property exploited in greedy MAP inference procedures (Tropp & Gilbert, 2007). Unfortunately, BBVI does not inherently have this property, with the factorial prior in the KL divergence term in (5) encouraging all features to be equally likely for each input data sample. To address this, we propose a sampling procedure that biases towards reuse of developed features. + +Before introducing our approach, we note the standard approach in BBVI for using multiple samples to approximate + +# Algorithm 1 Training with Thresholded Samples + +Input: Training batch $\mathbf{x}^k$ , threshold hyper-parameter $\lambda_0$ , whether to use a GammaPrior (along with gamma hyperprior $\alpha_0$ ), network initializations $(\phi^0, \theta^0)$ , number of samples $J$ , and number of iterations $T$ . + +for $t = 1$ to $T$ do + +$$ +\mathbf {f o r} j = 1 \mathbf {t o} J \mathbf {d o} +$$ + +$$ +\epsilon^ {j, k} \sim p (\epsilon) +$$ + +if GammaPrior then + +$$ +\left(\mathbf {s} ^ {j, k}, \boldsymbol {\lambda} ^ {j, k}\right) \gets g _ {\phi} \left(\mathbf {x} ^ {k}, \boldsymbol {\epsilon} ^ {j, k}\right) +$$ + +else + +$$ +\mathbf {s} ^ {j, k} \leftarrow g _ {\phi} \left(\mathbf {x} ^ {k}, \epsilon^ {j, k}\right) +$$ + +$$ +\boldsymbol {\lambda} ^ {j, k} \leftarrow \boldsymbol {\lambda} _ {0} +$$ + +end if + +$$ +\widetilde {\mathbf {z}} ^ {j, k} \leftarrow \mathbf {s} ^ {j, k} + \mathcal {T} _ {\lambda^ {j, k}} \left(\operatorname {s g} \left[ \mathbf {s} ^ {j, k} \right]\right) - \operatorname {s g} \left[ \mathbf {s} ^ {j, k} \right] +$$ + +$$ +\mathcal {L} ^ {j, k} \leftarrow \log p _ {\boldsymbol {\theta}} \left(\mathbf {x} ^ {k} \mid \widetilde {\mathbf {z}} ^ {j, k}\right) - \beta D _ {K L} +$$ + +end for + +$$ +\widehat {\mathcal {L}} ^ {k} = \arg \max _ {j} \mathcal {L} ^ {j, k} +$$ + +$$ +\left(\boldsymbol {\phi} ^ {t}, \boldsymbol {\theta} ^ {t}\right) = \arg \max \widehat {\mathcal {L}} ^ {k} +$$ + +end for + +the expectation with respect to $q_{\phi}$ in (5). Given a sampling budget $J$ , one may draw $J$ i.i.d. samples $\mathbf{z}^{j,k} \sim q_{\phi}(\mathbf{z} \mid \mathbf{x}^k)$ from the posterior and compute the ELBO for each sample. + +$$ +\mathcal {L} ^ {j, k} = \log p _ {\boldsymbol {\theta}} \left(\mathbf {x} ^ {j, k} \mid \mathbf {z} ^ {j, k}\right) - \beta D _ {K L} \left(q _ {\phi} \left(\mathbf {z} ^ {j, k} \mid \mathbf {x} ^ {k}\right) \mid \mid p (\mathbf {z})\right) \tag {6} +$$ + +Then, to estimate the training objective, one may average over the loss from each sample: + +$$ +\widehat {\mathcal {L}} _ {a v g} ^ {k} = \frac {1}{J} \sum_ {j = 1} ^ {J} \mathcal {L} ^ {j, k}. \tag {7} +$$ + +In the case where we have a sparse prior, each of the $J$ samples taken here will have different support and thus encourage development of different latent features. + +Rather than give each sample equal probability, we introduce a new sampling strategy motivated by the approximation to expectations utilized in (Olshausen & Field, 1996; Connor et al., 2020). In these works, it is observed that the selected prior distribution concentrates most of its probability mass around the maximum value. This leads to an approximation of the expectation over the prior latent variable with a delta at the max value $\widehat{\mathbf{z}}$ , motivating a MAP estimate: + +$$ +\begin{array}{l} \log \mathbb {E} _ {p (\mathbf {z})} [ p _ {\boldsymbol {\theta}} (\mathbf {x} \mid \mathbf {z}) ] \approx \log \int_ {z} p _ {\boldsymbol {\theta}} (\mathbf {x} \mid \mathbf {z}) p (\mathbf {z}) \delta (\widehat {\mathbf {z}}) d \mathbf {z} \\ = \max _ {\mathbf {z}} \log p _ {\boldsymbol {\theta}} (\mathbf {x} \mid \mathbf {z}) + \log p (\mathbf {z}). \tag {8} \\ \end{array} +$$ + +Although our training setting differs in that we take our expectation over the variational posterior $\mathbb{E}_{q_{\phi}}$ , in many cases + +we explicitly regularize this distribution with a KL divergence penalty against a sparse prior. To this same end, rather than approximate our expectation $\mathbb{E}_{q_{\phi}}$ with the average over several samples, we approximate it with a single sample with the highest likelihood: + +$$ +\widehat {\mathcal {L}} _ {m a x} ^ {k} = \max _ {j} \mathcal {L} ^ {j, k}. \tag {9} +$$ + +Although this provides a biased estimate of the loss, we will show in later sections that this heuristic provides an increase in performance and latent feature reuse during training. We combine this method with our sampling approach to outline our full training procedure in Algorithm 1. + +# 4. Experiments + +# 4.1. Linear Generator + +# 4.1.1. SPARSE CODING PERFORMANCE + +In our first experiment, we test different inference methods on sparse coding of the whitened image patches used in (Olshausen & Field, 1996). We train on 80,000 16x16 training patches with a dictionary of 256 elements (i.e., a linear generator $\theta = \mathbf{A} \in \mathbb{R}^{256 \times 256}$ ). We start in this simplified setting since it allows us to compare against baseline sparse coding strategies (that use MAP estimates) and so we can analyze the dictionary we learn for each method. As a baseline, we infer coefficients $\widehat{\mathbf{z}}^k$ using the FISTA algorithm (Beck & Teboulle, 2009) to optimize objective (10). This objective includes a data fidelity term, sparsity-encouraging $\ell_1$ penalty on latent features, and a Frobenius norm regularizer on the dictionary to prevent unbounded growth: + +$$ +\min _ {\mathbf {A}} \left\| \mathbf {x} ^ {k} - \mathbf {A} \widehat {\mathbf {z}} ^ {k} \right\| _ {2} ^ {2} + \lambda \| \widehat {\mathbf {z}} ^ {k} \| _ {1} + \kappa \| \mathbf {A} \| _ {F} ^ {2}. \tag {10} +$$ + +In all of our experiments, we set the sparsity hyperparameter such that roughly $10\%$ features are non-zero for each batch of data. For FISTA, this occurs when $\lambda = 20$ . We use this objective to measure validation performance of our variational methods. + +To train our inference networks, we use an ELBO objective with a Frobenius norm regularizer on the dictionary: + +$$ +\min _ {\mathbf {A}, \phi} - \mathcal {L} (\mathbf {A}, \phi ; \mathbf {x} ^ {k}) + \kappa \| \mathbf {A} \| _ {F} ^ {2} \tag {11} +$$ + +$$ +\log p _ {\mathbf {A}} \left(\mathbf {x} ^ {k} \mid \mathbf {z} ^ {k}\right) = - \left\| \mathbf {x} ^ {k} - \mathbf {A} \mathbf {z} ^ {k} \right\| _ {2} ^ {2}, \tag {12} +$$ + +where $\mathbf{z}^k$ is either found via the inference procedure outlined in section 3.2 or by previous methods that used Gaussian (Kingma & Welling, 2014), Laplacian (Barello et al., 2018), or Spike-and-Slab (Tonolini et al., 2020) prior distributions. For the Spike-and-Slab prior, we approximate each Bernoulli random variable with a straight-through estimator of a Gumbel-Softmax sample (Jang et al., 2017). For + +each method, we apply the sampling procedure outlined in Section 3.3 with $J = 1$ and $J = 20$ . Details on training hyper-parameters are provided in Appendix D. + +![](images/df4983bac4af16983470c2d736ce67d18c372505b15a3e8aeb87fac95d35f7a2.jpg) + +![](images/e4b5fcd81ecad85fd0780c96915b3ac22eea11caa8f331fdf8c02150733adaf5.jpg) + +![](images/908f0c8075878923f7ee39b90912d6aa543964bf8b8167017b9a99e94fb3c71b.jpg) + +![](images/caa6fc33d9efecdf333e8bbb32e68331dec105b94b465db51c6b21f7b7e35dc1.jpg) + +![](images/2653e3447ca7d78f833343e58b0310248bda474474e182e6b779dc9422fcac37.jpg) + +![](images/8d7667d034f8e54bea553bb9cfa6b92cceb4f3a04fedf4b6846668262fdb29a3.jpg) + +![](images/9e71fe40cb1132096245ea140e7ebb4215ecb16c2ce8d2bcee54f80d3229308e.jpg) + +![](images/1d1904870ef0e6b41d4765eb417b5e9ec05cdc4987b99d51234b19d892484c9a.jpg) + +![](images/793f796c506850efa17bfa37cd7c04b1cfdde306c93f1a6d2026f01e347b7949.jpg) +(a) FISTA + +![](images/15f00289b2c6e36ca5b7ad76b4f9ff57f95ffe07f33267d0af8214f4746abd4d.jpg) + +![](images/78a9caf3128501256e8417b6ba0e178bf3a7c95ca24928899bacb4e36f2f3540.jpg) + +![](images/8868ea3d6d753ec63bf0580a2e6228df98dac3ead8536b265288f62bccd46f19.jpg) +(b) Gaussian + +![](images/700a98293153931541977f1e0aca999c9fa7ed922bff303761d504bdfe9ab7b7.jpg) + +![](images/99ae4b4acb6e15b2aee9f074b572fb3b74065afe3ac4d7c884feeb03fd94bcf5.jpg) + +![](images/423c4627d2e17caf3a1e07f31e653ac57ca50e1a63951e7d1d8bb26a5b36d742.jpg) +(c) Laplacian + +![](images/d1de338bfc589484f4def2e9ebde6d312f4b6fca6c2e3274c972aa37affd34ef.jpg) + +![](images/e86fc2f6596c85eb5ae9b27d50e7e0593ba4c9cdfe7eebfeea9c5dc700918e2c.jpg) + +![](images/450145d29d031bc384d3081562d9fa25723a4ad8a8da7b35e6b9b65d11191537.jpg) + +![](images/73c03e4167a5501120d912264930f48583f37a76806020830754942447ab07ab.jpg) + +![](images/7f05a7c015d0edf2045a8a3f2942d98497b3ee4e5cc22851f8e92e5229161f04.jpg) + +![](images/de10557dc75bb9f3bc6beba794cec9bdf5887b311db00c1a75002d986339f687.jpg) + +![](images/4a9809ee297eb8f31fee87f41e4034f0d4e7f7a180b69944338ceed61ee8e6a0.jpg) + +![](images/fd6fd31d191ae61d5286792dc93374e0669238658a2bce50da98f4f53829d544.jpg) + +![](images/75eaaa7e9142ef4079a4906ae8cee4e7a6f513a0294a871744e4cde9fe5eee1e.jpg) + +![](images/db0744dae591cbc1f65662c4931b6c227984292c61ec01d328427db239dfa117.jpg) + +![](images/ea4b57a73c642a918d473608187feaef1a7d560cb11222e3b71d0058faa27d35.jpg) + +![](images/b6c5bcbc7b1ea40557ed4a3ac7f6fb87aaabbba19b804af1a21e92736b9bcbb8.jpg) + +![](images/cc4d1681393a2b9f24b1fdda3d18e1a67633d65eae080ee0c4ecb70e5dee88be.jpg) + +![](images/4de335b5f2518c4b81d97f95d27594e17cd3fce67676f2546cd52360029e0505.jpg) + +![](images/01a35a7db295689736d60eacf68824ae55684c925c4ae01d4ecac6eca719794e.jpg) + +![](images/e9a71cb5bd078b6ab11ad14ccdb036e4aa3fcbdba5cf2630e43013a424b5a90e.jpg) + +![](images/e2bf08c33c2c3db9a212af1c98e9e126d3cfccab314abcd21a8c67d00a36ca4d.jpg) + +![](images/6e2602289fa111513e9de5b0a9fe0803c3f7a3de77bfaf04ca552a34539f9734.jpg) + +![](images/57a7e316cc430f3737e3e8188bc9cea43063131186a8e9d58f3d78eb82d32250.jpg) + +![](images/a3ac47e94199fcb517ba4480951ee87baef41c0c983b54570e1162423a5c55ba.jpg) + +![](images/aa0599a7b6d92db94d4b5bb5e68463b06310e5a3dc3b0c5b1c0d52ed5da6f64b.jpg) +(d) Spike-and-Slab + +![](images/7883f953a01f62e2e44f3db1fdc5d760cdb952d466d6f0e50dc12706e788bb7c.jpg) + +![](images/8be91d796f5ab974fc0448f0eb4084027ccc24bcaffc5b2c1be0d09897f3de40.jpg) + +![](images/da3e861c7842c78750261d32be91252eb1fef5475c5b065937f1db4a2d607fe8.jpg) +(e) Thresholded Gaussian + +![](images/177cfe408ddfdf259dfbd48b757e4f2b0e8fcae196b62ed60c1f3976321a28c3.jpg) + +![](images/7cf47000c36e07fb3c9bbe9bc2f460e7ec525cc39f6784ef64502e5c91d64e59.jpg) + +![](images/62ee56786f7135ec6a56085e9d1eed45b66c420840a8d0d383be279c3fbcd34f.jpg) +(f) Thresholded Laplacian + +![](images/92a6e955a6b3fdc994ce6113d3777b285e09b20fa75f8c1a8c80e092e538b127.jpg) + +![](images/db3eb756845bf5ef5357e58ca17bc8e47c74824ede12de52e2b5b6736847848b.jpg) + +Figure 3. Entries of the learned linear generator (dictionary) for different approaches for inferring sparse codes. FISTA uses an iterative MAP estimate that optimizes objective (10) directly. Others use a variational approach with different prior distributions using $J = 20$ samples. The Spike-and-Slab, Thresholded Gaussian, and Thresholded Laplacian methods learn dictionaries with most entries visually resembling the dictionary learned by FISTA. + +Figure 3 plots the columns of the learned dictionary for each inference method for $J = 20$ . As expected, FISTA learns dictionary entries that qualitatively resemble Gabor wavelets (Olshausen & Field, 1996). The Laplacian prior (Barello et al., 2018) learns a few dictionary entries that resemble wavelets, with most entries resembling noise. Although the entries learned by all sparse priors resemble wavelets, only the Thresholded Laplacian is capable of learning this structure with $J = 1$ . Full learned dictionaries for all methods under both sampling budgets are visualized in Appendix F. + +Table 1 compares average quantitative performance over three training runs for each inference method. The Laplacian prior with a fixed threshold performs the best among variational methods on objective (10). We note that methods that learn the threshold parameters tend to increase the number of active latent features, leading to an increase in L1 penalty in the validation loss. Although the Spike-and-Slab prior minimizes the importance weighted (IWAE) loss from (Burda et al., 2016) with $K = 200$ , it performs worse on the sparse coding objective. We note that the IWAE loss measures the tightness of the ELBO bound (reconstruction + KL loss), whereas the thresholding in our method has a trade-off between deviation of the KL loss and posterior expressivity. + +Table 1. Performance of different inference methods with a linear generator on whitened image patches. Validation loss computed on objective (10). Multi-information measures the statistical efficiency of inferred codes. The importance weighted autoencoder (IWAE) loss (Burda et al., 2016) is a tight bound on the ELBO, but does not necessarily depict success in the sparse coding task. A table with standard deviations for $J = 20$ is included in Table 6 in Appendix F + +
Method/Prior DistributionValidation LossMulti-InformationIWAE Loss
J=1J=20J=1J=20J=1J=20
FISTA (baseline)1.01E+02-8.75E+01---
Gaussian1.35E+031.35E+037.34E+027.36E+022.57E-012.16E-01
Laplacian5.96E+025.79E+025.36E+025.34E+022.20E-012.22E-01
Spike-and-slab2.52E+022.39E+021.94E+021.96E+022.41E-012.12E-01
Thresholded Gaussian2.32E+022.30E+021.67E+021.76E+021.52E+001.33E+00
Thresholded Gaussian+Gamma2.85E+022.70E+022.35E+022.29E+021.17E+001.13E+00
Thresholded Laplacian1.98E+021.94E+021.80E+021.91E+029.30E-011.13E+00
Thresholded Laplacian+Gamma2.23E+022.11E+022.38E+022.33E+029.81E-011.12E+00
+ +To measure the statistical efficiency in the inferred codes, we follow previous work in estimating the multi-information, $\sum_{i=1}^{d} h(z_i) - h(\mathbf{z})$ , of the inferred codes (Fallah et al., 2020; Eichhorn et al., 2009; Bethge, 2006). This quantity is minimized when the features have high joint entropy while being independent of one another, denoting a reduction in redundancy. Among variational methods, the Thresholded Gaussian minimizes this quantity. + +To further understand the benefit of our proposed method, we investigate the quality of the gradient estimates through both the dictionary and inference network at the end of training. To measure this, we use the signal-to-noise ratio (SNR) metric proposed in (Rainforth et al., 2018): + +$$ +\mathrm {S N R} (\theta) = \left| \mathbb {E} \left[ \nabla_ {\theta} \mathcal {L} \right] / \sigma \left[ \nabla_ {\theta} \mathcal {L} \right] \right|. +$$ + +Where $\theta$ is a single parameter from our dictionary or inference network and $\mathcal{L}$ is our training loss. In our experiments, we average the SNR over all parameters in our inference network or dictionary. + +The benefit of measuring the gradient quality through a relative metric like SNR is that it weights the variance by the importance of each parameter. For example, dictionary entries that are rarely activated for a given input data will have a low expected gradient, but may have high variance. We evaluate the SNR over 1000 sparse code samples for each data point in our validation set. Figure 4 compares the SNR for both the dictionary and inference network for various methods. It can be seen that the Spike-and-Slab suffers from low SNR in the case of $J = 1$ , with a significant increase for $J = 20$ . We speculate that this metric explains the lack of clear wavelets in the dictionary learned by the Spike-and-Slab for $J = 1$ . + +# 4.1.2. SAMPLING PERFORMANCE + +To test whether our sampling procedure leads to more feature reuse, we measure the consistency in the features used over several forward passes for fixed input data. Each forward pass leads to a sparse code with a different support set, indicating use of different features. Hence, we can compute the Jaccard index between the support set of several samples $\mathbf{z}^{1,k},\ldots ,\mathbf{z}^{J,k}\sim q_{\phi}(\mathbf{z}\mid \mathbf{x}^k)$ for fixed input to measure consistency (Jaccard, 1912). Intuitively, the Jaccard index measures similarity between discrete sets, providing a value in [0, 1] based on how similar the support is over different forward passes. Let $S(\mathbf{z}^{j,k})$ denote the support of $\mathbf{z}^{j,k}$ (i.e. + +![](images/ce120a91be3f29d0c1553fece25abcac72e031c6b99ef9d64b588b97a0962093.jpg) +(a) Inference Network Gradient SNR + +![](images/cebf51128004f0709bd8e2f6982ae7cd61154ab5928870d06f811ea5f074ed0a.jpg) +(b) Generator Gradient SNR +Figure 4. Comparison of the SNR of the (a) inference network and (b) linear generator gradients at the end of training. Thresholded methods perform the best, with all sparse priors experiencing higher SNR with $J = 20$ samples under max ELBO sampling. + +![](images/e1a0fa183daedf3224bfc902e6717b31b1d310a0a09d378a50b52a9886abc853.jpg) +(a) $\mathrm{J} = {20}$ + +![](images/07bbcdabe86f80e8e56c8cdc186f502ea156b98068a61604e87540084052fbb2.jpg) +(b) $\mathrm{J} = {100}$ +Figure 6. Selected entries of an estimated dictionary for variational autoencoders trained with a (a) Gaussian prior and (b) Thresholded Gaussian+Gamma prior with a 512 dimensional latent space3. For each method, the first row denotes dictionary entries with the highest magnitude and the bottom row denotes random entries from the middle of the dictionary. + +$i\in S(\mathbf{z}^{j,k})$ if $z_{i}^{j,k}\neq 0)$ , the Jaccard index is computed as: + +$$ +C \left(\mathbf {z} ^ {m, k}, \mathbf {z} ^ {n, k}\right) = \frac {\left| S \left(\mathbf {z} ^ {m , k}\right) \cap S \left(\mathbf {z} ^ {n , k}\right) \right|}{\left| S \left(\mathbf {z} ^ {m , k}\right) \cup S \left(\mathbf {z} ^ {n , k}\right) \right|}. \tag {13} +$$ + +For any given input data $\mathbf{x}^k$ we can draw $J$ samples from our inference network and compute the average pairwise Jaccard index as $\frac{1}{J(J - 1)}\sum_{m}^{J}\sum_{n\neq m}^{J}C(\mathbf{z}^{m,k},\mathbf{z}^{n,k})$ . To normalize for the fact that each training methods leads to a different number of non-zero dictionary entries (e.g., an inference network that only uses a subset of the available support is more likely to be consistent), we measure consistency using the support of features with $\| \mathbf{a}_i\| _2^2 >1\mathrm{E} - 01$ . + +We use this metric to compare the consistency of inference networks trained under the average ELBO scheme from (7) and the proposed max ELBO scheme in (9) using $J = [20,100]$ samples. We observe that both methods result in $10\%$ of features non-zero on average. + +We plot the consistency on the validation set averaged over three training runs as a histogram in Figure 5. It can be seen that the max ELBO sampling procedure leads to higher consistency (indicating reuse of developed features) compared to average sampling. Qualitatively, the dictionary entries learned in the average sampling scheme has several repeated entries, indicating poor reuse in comparison to the qualitatively diverse entries learned by max sampling. We visualize the full dictionary for both in Figure F.2 in Appendix F. + +![](images/191e4ed3d2ab5ae24b01309e856fcedf7f9b5f17fd5310f8ea725254b2145b90.jpg) +(a) Gaussian + +![](images/c5f03ef2536605688ed0046eb8fbb5d58842160d2f34a0f8f295d54e4fe273b1.jpg) +Figure 5. Histogram of the average pairwise Jaccard index over 20 forward passes on two trained inference networks. The pairwise Jaccard index measures the consistency of the support set of inferred codes. Max ELBO sampling leads to a higher average Jaccard index, indicating reuse of developed latent features. +(b) Thresholded Gaussian+Gamma + +# 4.2. DNN Generator + +We next investigate the efficacy of variational sparse coding in unsupervised learning on the Fashion MNIST (FMNIST) (Xiao et al., 2017) and CelebA datasets (Liu et al., 2015). We follow a similar methodology as the previous section, except that we apply a DNN generator in place of the linear dictionary (more details in Appendix E). Following the principle of overcomplete representations in sparse coding, where the robustness of latent features increases with the dimensionality (Olshausen, 2013), we compare performance as we sweep dimensionality. + +Figure 7 shows the quantitative performance of different prior methods trained with either increasing latent dimensionality or percentage of latent features non-zero. For both datasets, as the dimensionality increases with a fixed degree of sparsity, it can be seen that the Gaussian prior (corresponding to a variational autoencoder (Kingma & Welling, 2014; Higgins et al., 2017)) has a significant increase in redundancy, measured via the multi-information, with a slight increase in the validation Fréchet inception distance (FID) (Heusel et al., 2017) and MSE. Alternatively, all the sparse priors show superior scaling with dimensionality, with the Thresholded Gaussian and Thresholded Gaussian+Gamma depicting superior performance to the Spike-and-Slab model from Tonolini et al. (2020). Additionally, all thresholded methods scale better with MSE as the degree of sparsity (corresponding to the $\%$ of features non-zero) increases. + +We observe the same qualitative generative interpretability + +![](images/c44e4740b55723201f23bb7c15080de23551a3e8de9e413e0d6ac716f7793352.jpg) +(a) FMNIST MI + +![](images/60e0ecc2f779cd72c7fa77a245a97f570d1b23d5b6ac4104ec13ff0f941cd33d.jpg) +(b) FMNIST FID + +![](images/f7458bf3b4096978ddd7b3a64b2f9a09412669ca75ceb16b23046b43c80e3b9c.jpg) +(c) FMNIST MSE + +![](images/e4d61700749c9d5f82a227296e875bc0f87232e4ef9aff94423e4d9f2aedf000.jpg) +(d) FMNIST MSE per % Sparsity + +![](images/9057a63a5b3afc7e5efa1f377d3c46218fcd7c96c4359ed7fe5ae6ee4d6ca424.jpg) +(e) CelebA MI + +![](images/8337500d48da8fa58e1f0092747363eb2bdaee764807cea0757a5ebd399bf92d.jpg) +(f) CelebA FID + +![](images/6c86565582c76bf6f1962cb73c0f8cdbae9735e9e77846574e78c5fd7d09b9c7.jpg) +(g) CelebA MSE + +![](images/b9f2491376b357b63217b72ead8d80ac3d804158a7c2545ff026256af094d555.jpg) +(h) CelebA MSE per % Sparsity + +when sweeping each individual latent feature as in previous work that investigates Gaussian priors (Higgins et al., 2017) and sparse priors (Tonolini et al., 2020). In these works, it is observed that each latent feature corresponds to a specific semantic change in the generated image (such as changes in skin color, background color, hairstyle, etc.). Unfortunately, in the case where one trains a DNN generator, they are unable to observe the generator features the same way one could with the columns of the linear dictionary. + +To this end, we estimate a linear dictionary for each fully trained CelebA inference network to visualize what is encoded by each latent feature. Given a collection of data samples $\mathbf{X} = \left[\mathbf{x}^{1},\dots ,\mathbf{x}^{n}\right]^{T}$ and corresponding inferred codes $\mathbf{Z} = \left[\mathbf{z}^{1},\dots ,\mathbf{z}^{n}\right]^{T}$ from an inference network with fixed weights fully trained with a DNN generator $\mathbf{z}^k\sim q_\phi (\mathbf{z}\mid \mathbf{x}^k)$ , one can estimate a linear dictionary as (Isely et al., 2010; Fallah et al., 2020): + +$$ +\mathbf {X} = \mathbf {A Z} +$$ + +$$ +\widehat {\mathbf {A}} = \left(\mathbf {X} \mathbf {Z} ^ {T}\right) \left(\mathbf {Z} \mathbf {Z} ^ {T}\right) ^ {- 1}. +$$ + +We use this technique with each trained inference network to analyze which features in the training dataset are represented by each latent feature. We plot selected entries from dictionaries estimated for the Gaussian and Thresholded Gaussian+Gamma in Figure 6. Interestingly, the first eight entries from the Gaussian prior resemble the qualitative features observed in the $\beta$ -VAE (Higgins et al., 2017). Poor statistical efficiency in the Gaussian prior indicates + +![](images/f1111a8d95b6d7cfb71692b87172adaaa89a9b6a61cd9ab1e56267760659c398.jpg) +Figure 7. Comparison of variational autoencoder with different prior distributions as the latent feature dimensionality increases on the Fashion MNIST (a-d) and CelebA (e-h) datasets. (a, e) Multi-information scales at a higher rate with the Gaussian prior, indicating inferior statistical efficiency at higher latent dimensions. (b, f) The Fréchet Inception Distance of images reconstructed by learned DNN generator. (c, g) Mean squared error on validation data for a fixed degree of sparsity. (d, h) Mean squared error for a fixed dimensionality with an increase in the degree of sparsity (indicating the % of non-zero latent features set by the prior). +Figure 8. Estimated dictionary entries for latent features with the highest absolute point-biserial correlation with the CelebA binary attribute labels. From top to bottom, the rows denote the Gaussian prior, Thresholded Gaussian prior, and Thresholded Gaussian+Gamma prior. + +that certain latent features are not encoding useful information from training data, leading to corresponding estimated dictionary entries that resemble noise (visualized in the second row). Meanwhile, all the entries for the sparse prior more clearly resemble features in the training dataset. While the qualitative results here are similar to previous research comparing learned features from principal component analysis (PCA) and independent component analysis (ICA) on face datasets (Bartlett et al., 2002), a detailed quantitative comparison with those results is beyond the scope of the present paper. We visualize more estimated dictionary plots in Appendix G. + +Finally, we use the binary attribute labels included with the CelebA dataset to measure correlation between latent fea + +tures and attributes in the input data. Given vectors of 40 binary attributes for each data sample $\mathbf{y}^1, \ldots, \mathbf{y}^N$ and corresponding latent features $\mathbf{z}^1, \ldots, \mathbf{z}^N$ from a trained inference network, we can compute the point-biserial correlation coefficient between each attribute $m$ and each dimension of latent feature $n$ as: + +$$ +\rho_ {p b} ^ {m, n} = \frac {M _ {1} - M _ {0}}{s _ {N}} \frac {\sqrt {n _ {1} n _ {0}}}{\sqrt {N}}. +$$ + +Where $M_1$ and $M_0$ are the sample mean of latent features $z_n^k$ corresponding to when attribute label $y_m^k$ equals one or zero, respectively. $s_N$ is the sample standard deviation over all features, and $n_1$ and $n_0$ respectively denote the total count of attribute labels that equal 1 and 0. + +We plot the estimated dictionary entry corresponding to the feature with the highest absolute correlation for selected attributes in Figure 8. Noting that features can be positive or negative for a given input data, it can be seen that the sparse priors lead to dictionary entries with features that visually resemble the semantic meaning of each attribute label. + +# 5. Discussion + +In this work, we have presented a new method for variational sparse coding by thresholding samples from an inference network. This simple approach avoids discrete random variables in its parameterization, and we show that it leads to superior performance and gradient estimation. Compared to a standard Gaussian prior, it provides more statistical efficiency in its use of latent features. One area of future work may consider alternative discrete random variable estimators that employ control variates (Tucker et al., 2017). Another interesting direction is the substitution of the KL divergence with distance metrics that perform better when the prior lies on a manifold (as is the case with sparse signals) (Patrini et al., 2020). + +# 6. Acknowledgements + +The authors would like to thank Adam Charles, Francesco Tonolini, and Linxing Preston Jiang for their correspondence regarding their experience with variational sparse coding. This work was partially supported by NSF CAREER award CCF-1350954, ONR grant number N00014-15-1-2619 and AFRL grant number FA8750-19-C-0200. + +# References + +Ainsworth, S. K., Foti, N. J., Lee, A. K. C., and Fox, E. B. oi-VAE: Output Interpretable VAEs for Nonlinear Group Factor Analysis. pp. 10, 2018. +Barello, G., Charles, A. S., and Pillow, J. W. Sparse-Coding Variational Auto-Encoders. preprint, Neuroscience, August 2018. URL http://biorxiv.org/lookup/doi/10.1101/399246. +Bartlett, M., Movellan, J., and Sejnowski, T. Face recognition by independent component analysis. IEEE Transactions on Neural Networks, 13(6):1450-1464, November 2002. ISSN 1941-0093. doi: 10.1109/TNN.2002.804287. Conference Name: IEEE Transactions on Neural Networks. +Bauer, M. and Mnih, A. Resampled Priors for Variational Autoencoders. arXiv:1810.11428 [cs, stat], April 2019. URL http://arxiv.org/abs/1810.11428.arXiv:1810.11428. +Beck, A. and Teboulle, M. A Fast Iterative Shrinkage-Thresholding Algorithm for Linear Inverse Problems. SIAM Journal on Imaging Sciences, 2(1):183-202, January 2009. ISSN 1936-4954. doi: 10.1137/080716542. URL http://epubs.siam.org/doi/10.1137/080716542. +Bengio, Y., Léonard, N., and Courville, A. Estimating or Propagating Gradients Through Stochastic Neurons for Conditional Computation. arXiv:1308.3432 [cs], August 2013. URL http://arxiv.org/abs/1308.3432.arXiv:1308.3432. +Bethge, M. Factorial coding of natural images: how effective are linear models in removing higher-order dependencies? Journal of the Optical Society of America A, 23(6):1253, June 2006. ISSN 1084-7529, 1520-8532. doi: 10.1364/JOSAA.23.001253. URL https://www.osapublishing.org/abstract.cfm?URI=josaa-23-6-1253. +Burda, Y., Grosse, R., and Salakhutdinov, R. Importance Weighted Autoencoders. arXiv:1509.00519 [cs, stat], November 2016. URL http://arxiv.org/abs/1509.00519.arXiv:1509.00519. +Connor, M. C., Canal, G. H., and Rozell, C. J. Variational Autoencoder with Learned Latent Structure. arXiv:2006.10597 [cs, stat], June 2020. URL http://arxiv.org/abs/2006.10597. arXiv: 2006.10597. +Cremer, C., Morris, Q., and Duvenaud, D. Reinterpreting Importance-Weighted Autoencoders. arXiv:1704.02916 [stat], August 2017. URL http://arxiv.org/abs/1704.02916.arXiv:1704.02916. + +Daubechies, I., Defrise, M., and De Mol, C. An iterative thresholding algorithm for linear inverse problems with a sparsity constraint. arXiv:math/0307152, November 2003. URL http://arxiv.org/abs/math/0307152. arXiv:math/0307152. +Donoho, D. L. and Johnstone, I. M. Ideal spatial adaptation by wavelet shrinkage. Biometrika, 81(3):425-455, September 1994. ISSN 0006-3444. doi: 10.1093/biomet/81.3.425. URL https://doi.org/10.1093/biomet/81.3.425. +Drefs, J., Guiraud, E., and Lücke, J. Evolutionary variational optimization of generative models. Journal of Machine Learning Research, 23(21):1-51, 2022. URL http://jmlr.org/papers/v23/20-233.html. +Eichhorn, J., Sinz, F., and Bethge, M. Natural Image Coding in V1: How Much Use Is Orientation Selectivity? PLoS Computational Biology, 5(4):e1000336, April 2009. ISSN 1553-7358. doi: 10.1371/journal.pcbi.1000336. URL https://dx.plos.org/10.1371/journal.pcbi.1000336. +Elad, M. Sparse and Redundant Representations. Springer New York, New York, NY, 2010. ISBN 978-1-4419-7010-7 978-1-4419-7011-4. doi: 10.1007/978-1-4419-7011-4. URL http://link.springer.com/10.1007/978-1-4419-7011-4. +Fallah, K., Willats, A. A., Liu, N., and Rozell, C. J. Learning sparse codes from compressed representations with biologically plausible local wiring constraints. preprint, Neuroscience, October 2020. URL http://biorxiv.org/lookup/doi/10.1101/2020.10.23.352443. +Garrigues, P. and Olshausen, B. Group Sparse Coding with a Laplacian Scale Mixture Prior. In Advances in Neural Information Processing Systems, volume 23. Curran Associates, Inc., 2010. +Girolami, M. A Variational Method for Learning Sparse and Overcomplete Representations. Neural Computation, 13(11):2517-2532, November 2001. ISSN 0899-7667, 1530-888X. doi: 10.1162/089976601753196003. URL https://direct.mit.edu/neco/article/13/11/2517-2532/6475. +Goodfellow, I. J., Courville, A., and Bengio, Y. Large-Scale Feature Learning With Spike-and-Slab Sparse Coding. pp. 8, 2012. +Gregor, K. and LeCun, Y. Learning Fast Approximations of Sparse Coding. pp. 8, 2010. +Grover, A., Gummadi, R., Lazaro-Gredilla, M., Schuurmans, D., and Ermon, S. Variational Rejection Sampling. pp. 10, 2014. + +Heusel, M., Ramsauer, H., Unterthiner, T., Nessler, B., and Hochreiter, S. GANs Trained by a Two Time-Scale Update Rule Converge to a Local Nash Equilibrium. In Guyon, I., Luxburg, U. V., Bengio, S., Wallach, H., Fergus, R., Vishwanathan, S., and Garnett, R. (eds.), Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017. URL https://proceedings.neurips.cc/paper/2017/file/8a1d694707eb0fefe65871369074926d-Paper.pdf. +Higgins, I., Matthew, L., Pal, A., Burgess, C., Glorot, X., Botvinick, M., Mohamed, S., and Lerchner, A. BetavAE: LEARNING BASIC VISUAL CONCEPTS WITH A CONSTRAINED VARIATIONAL FRAMEWORK. pp. 22, 2017. +Isely, G., Hillar, C., and Sommer, F. Deciphering subsampled data: adaptive compressive sampling as a principle of brain communication. In Advances in Neural Information Processing Systems, volume 23. Curran Associates, Inc., 2010. URL https://papers.nips.cc/paper/2010/bitstream/a0160709701140704575d499c997b6ca-Abstr.html. +Jaccard, P. The Distribution of the Flora in the Alpine Zone.1. New Phytologist, 11(2):37-50, 1912. ISSN 1469-8137. doi: 10.1111/j.1469-8137.1912.tb05611.x. URL https://onlinelibrary.wiley.com/doi/abs/10.1111/j.1469-8137.1912.tb05611.x. +Jang, E., Gu, S., and Poole, B. Categorical Reparameterization with Gumbel-Softmax. arXiv:1611.01144 [cs, stat], August 2017. URL http://arxiv.org/abs/1611.01144. arXiv:1611.01144. +Jankowiak, M. and Obermeyer, F. Pathwise Derivatives Beyond the Reparameterization Trick. arXiv:1806.01851 [cs, stat], July 2018. URL http://arxiv.org/abs/1806.01851.arXiv:1806.01851. +Jordan, M. I., Ghahramani, Z., Jaakkola, T. S., and Saul, L. K. An Introduction to Variational Methods for Graphical Models. In Jordan, M. I. (ed.), Learning in Graphical Models, pp. 105-161. Springer Netherlands, Dordrecht, 1998. ISBN 978-94-010-6104-9 978-94-011-5014-9. doi: 10.1007/978-94-011-5014-9_5. URL http://link.springer.com/10.1007/978-94-011-5014-9_5. +Kingma, D. P. and Welling, M. Auto-Encoding Variational Bayes. arXiv:1312.6114 [cs, stat], May 2014. URL http://arxiv.org/abs/1312.6114. arXiv: 1312.6114. + +Liu, Z., Luo, P., Wang, X., and Tang, X. Deep learning face attributes in the wild. In Proceedings of International Conference on Computer Vision (ICCV), December 2015. +Lucas, J., Tucker, G., Grosse, R., and Norouzi, M. Don't Blame the ELBO! A Linear VAE Perspective on Posterior Collapse. arXiv:1911.02469 [cs, stat], November 2019. URL http://arxiv.org/abs/1911.02469.arXiv:1911.02469. +Maddison, C. J., Mnih, A., and Teh, Y. W. The Concrete Distribution: A Continuous Relaxation of Discrete Random Variables. arXiv:1611.00712 [cs, stat], March 2017. URL http://arxiv.org/abs/1611.00712. arXiv: 1611.00712. +Meyer, G. P. An Alternative Probabilistic Interpretation of the Huber Loss. pp. 5261-5269, 2021. URL https://openaccess.thecvf.com/content/CVPR2021/html/Meyer_An_Alternative_Probabilistic_Interpretation_of_the_Huber_Loss_CVPR_2021_paper.html. +Mitchell, T. J. and Beauchamp, J. J. Bayesian Variable Selection in Linear Regression. Journal of the American Statistical Association, 83(404): 1023-1032, December 1988. ISSN 0162-1459. doi: 10.1080/01621459.1988.10478694. URL https://www.tandfonline.com/doi/abs/10.1080/01621459.1988.10478694. Publisher: Taylor & Francis. +Moran, G. E., Sridhar, D., Wang, Y., and Blei, D. M. Identifiable Variational Autoencoders via Sparse Decoding. arXiv:2110.10804 [cs, stat], October 2021. URL http://arxiv.org/abs/2110.10804. arXiv: 2110.10804. +Neal, R. M. and Hinton, G. E. A View of the Em Algorithm that Justifies Incremental, Sparse, and other Variants. In Jordan, M. I. (ed.), Learning in Graphical Models, NATO ASI Series, pp. 355-368. Springer Netherlands, Dordrecht, 1998. ISBN 978-94-011-5014-9. doi: 10.1007/978-94-011-5014-9_12. URL https://doi.org/10.1007/978-94-011-5014-9_12. +Olshausen, B. A. Highly overcomplete sparse coding. In Human Vision and Electronic Imaging XVIII, volume 8651, pp. 168-176. SPIE, March 2013. doi: 10.1117/12.2013504. +Olshausen, B. A. and Field, D. J. Emergence of simple-cell receptive field properties by learning a sparse code for natural images. Nature, 381(6583): 607-609, June 1996. ISSN 1476-4687. doi: 10. 1038/381607a0. URL https://www.nature.com/articles/381607a0. Number: 6583 Publisher: Nature Publishing Group. + +Olshausen, B. A. and Field, D. J. Sparse coding of sensory inputs. Current Opinion in Neurobiology, 14(4):481-487, August 2004. ISSN 0959-4388. doi: 10.1016/j.conb.2004.07.007. URL https://www.sciencedirect.com/science/article/pii/S0959438804001035. +Oord, A. v. d., Vinyals, O., and Kavukcuoglu, K. Neural Discrete Representation Learning. arXiv:1711.00937 [cs], May 2018. URL http://arxiv.org/abs/1711.00937.arXiv:1711.00937. +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., and Chintala, S. Pytorch: An imperative style, high-performance deep learning library. In Wallach, H., Larochelle, H., Beygelzimer, A., d'Alché-Buc, F., Fox, E., and Garnett, R. (eds.), Advances in Neural Information Processing Systems 32, pp. 8024-8035. Curran Associates, Inc., 2019. +Patrini, G., Berg, R. v. d., Forre, P., Carioni, M., Bhargav, S., Welling, M., Genewein, T., and Nielsen, F. Sinkhorn AutoEncoders. In Proceedings of The 35th Uncertainty in Artificial Intelligence Conference, pp. 733-743. PMLR, August 2020. URL https://proceedings.mlr.press/v115/patrini20a.html. ISSN: 2640-3498. +Rainforth, T., Kosiorek, A. R., Le, T. A., Maddison, C. J., Igl, M., Wood, F., and Teh, Y. W. Tighter Variational Bounds are Not Necessarily Better. arXiv:1802.04537 [cs, stat], March 2018. URL http://arxiv.org/abs/1802.04537.arXiv:1802.04537. +Ranganath, R., Gerrish, S., and Blei, D. M. Black Box Variational Inference. arXiv:1401.0118 [cs, stat], December 2013. URL http://arxiv.org/abs/1401.0118.arXiv:1401.0118. +Rezende, D. J., Mohamed, S., and Wierstra, D. Stochastic Backpropagation and Approximate Inference in Deep Generative Models. arXiv:1401.4082 [cs, stat], May 2014. URL http://arxiv.org/abs/1401.4082.arXiv:1401.4082. +Roeder, G., Wu, Y., and Duvenaud, D. Sticking the Landing: Simple, Lower-Variance Gradient Estimators for Variational Inference. arXiv:1703.09194 [cs, stat], May 2017. URL http://arxiv.org/abs/1703.09194.arXiv:1703.09194. +Rozell, C. J., Johnson, D. H., Baraniuk, R. G., and Olshausen, B. A. Sparse Coding via Thresholding and + +Local Competition in Neural Circuits. Neural Computation, 20(10):2526-2563, October 2008. ISSN 0899-7667, 1530-888X. doi: 10.1162/neco.2008.03-07-486. URL https://direct.mit.edu/neco/article/20/10/2526-2563/7343. +Salimans, T. A Structured Variational Auto-encoder for Learning Deep Hierarchies of Sparse Features. arXiv:1602.08734 [cs, stat], February 2016. URL http://arxiv.org/abs/1602.08734. arXiv: 1602.08734. +Seeger, M. W. Bayesian Inference and Optimal Design for the Sparse Linear Model. pp. 55, April 2008. +Sheikh, A.-S. and Lücke, J. Select-and-Sample for Spike-and-Slab Sparse Coding. In Advances in Neural Information Processing Systems, volume 29. Curran Associates, Inc., 2016. +Singh, R., Ling, J., and Doshi-Velez, F. Structured Variational Autoencoders for the Beta-Bernoulli Process. pp. 9, 2017. +Tibshirani, R. Regression shrinkage and selection via the lasso. Journal of the Royal Statistical Society: Series B (Methodological), 58(1):267-288, 1996. +Tonolini, F., Jensen, B. S., and Murray-Smith, R. Variational Sparse Coding. In Proceedings of The 35th Uncertainty in Artificial Intelligence Conference, pp. 690-700. PMLR, August 2020. URL https://proceedings.mlrpress/v115/tonolini20a.html. ISSN: 2640-3498. +Tropp, J. A. and Gilbert, A. C. Signal Recovery From Random Measurements Via Orthogonal Matching Pursuit. IEEE Transactions on Information Theory, 53(12):4655-4666, December 2007. ISSN 1557-9654. doi: 10.1109/TIT.2007.909108. Conference Name: IEEE Transactions on Information Theory. +Tucker, G., Mnih, A., Maddison, C. J., Lawson, D., and Sohl-Dickstein, J. REBAR: Low-variance, unbiased gradient estimates for discrete latent variable models. arXiv:1703.07370 [cs, stat], November 2017. URL http://arxiv.org/abs/1703.07370. arXiv: 1703.07370. +Tucker, G., Lawson, D., Gu, S., and Maddison, C. J. Doubly Reparameterized Gradient Estimators for Monte Carlo Objectives. arXiv:1810.04152 [cs, stat], November 2018. URL http://arxiv.org/abs/1810.04152.arXiv:1810.04152. +Xiao, H., Rasul, K., and Vollgraf, R. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms, 2017. URL https://arxiv.org/abs/1708.07747. + +Yang, A. Y., Zhou, Z., Ganesh, A., Sastry, S. S., and Ma, Y. Fast L1-Minimization Algorithms For Robust Face Recognition. arXiv:1007.3753 [cs], August 2012. URL http://arxiv.org/abs/1007.3753.arXiv:1007.3753. +Zhang, C., Butepage, J., Kjellstrom, H., and Mandt, S. Advances in Variational Inference. arXiv:1711.05597 [cs, stat], October 2018. URL http://arxiv.org/abs/1711.05597. arXiv:1711.05597. + +# A. Thresholded Laplacian Derivation + +To determine the distribution of our thresholded samples $p(z)$ , we marginalize the conditional distribution with respect to $p(s)$ . The shifted soft-threshold can be viewed as a shift of the pdf of $p(s)$ towards the mean value $\mu$ , as depicted in Figure 2. + +We thus break up the marginalization over $p(s)$ into two disjoint regions: the region that gets collapsed into the origin $p(|s - \mu| \leq \lambda)$ and the regions that get shifted towards the mean $p(|s - \mu| \geq \lambda)$ . We can then write the expectation: + +$$ +\begin{array}{l} p (z) = \mathbb {E} _ {p (s)} [ p (z \mid s) ] \\ = p (z \mid | s - \mu | \leq \lambda) p (| s - \mu | \leq \lambda) \\ + p (z \mid | s - \mu_ {0} | \geq \lambda) p (| s - \mu | \geq \lambda) \\ = (1 - \gamma) \delta (z) + \gamma p (z | | s - \mu | \geq \lambda) \\ \end{array} +$$ + +Where $(1 - \gamma) = 1 - \exp (-\lambda b^{-1})$ and $\gamma = \exp (-\lambda b^{-1})$ as shown in the main text. + +To derive $p(z \mid |s - \mu| \geq \lambda)$ , we write the pdf of $p(s)$ with the shift applied from soft-thresholding: + +$$ +\begin{array}{l} \left\{ \begin{array}{l l} \frac {1}{2 b} \exp \left(- \frac {| s - \mu + \lambda |}{b}\right) & s - \mu \leq 0 \\ \frac {1}{2 b} \exp \left(- \frac {| s - \mu - \lambda |}{b}\right) & s - \mu > 0 \end{array} \right. \\ = \frac {1}{2 b} \exp \left(- \frac {| s - \mu + \operatorname {s i g n} (s - \mu) \lambda |}{b}\right) \\ = \frac {1}{2 b} \exp \left(- \frac {| s - \mu |}{b}\right) \exp \left(- \lambda b ^ {- 1}\right) \\ \end{array} +$$ + +Where the third line follows from the equality condition of the triangle inequality (both terms have the same sign) and from the fact that $\lambda$ is always positive. + +This is precisely equal to $p(z \mid |s - \mu| \geq \lambda)$ multiplied by a normalizing constant $\frac{1}{Z}$ to become a valid distribution (accounting for the probability mass that was moved to zero). This normalizing constant is exactly one minus the mass moved to zero $Z = \gamma = \exp(-\lambda b^{-1})$ . This leads to our final conditional probability: + +$$ +p (z \mid | s - \mu_ {0} | \geq \lambda) = \frac {1}{2 b} \exp \left(- \frac {| s - \mu |}{b}\right) \tag {14} +$$ + +# B. Reparameterization Details for Thresholded Samples + +To reparameterize thresholded samples, we first draw samples $s_i^k$ for each feature space dimension from a base distribution that is either Gaussian or Laplacian. For an input data $\mathbf{x}^k$ , our encoder network outputs a shift and log-scale for each dimension of our latent feature for both distributions. The KL divergence loss is always computed on the base distribution, summing over each feature dimension. + +For a Gaussian distribution, we apply the standard reparameterization technique from (Kingma & Welling, 2014) using $(\mu_i^k, 2\log \sigma_i^k)$ output from a DNN: + +$$ +\begin{array}{l} \epsilon_ {i} ^ {j, k} \sim \mathcal {N} (0, 1) \\ z _ {i} ^ {j, k} = g _ {\phi} \left(\mathbf {x} ^ {k}, \epsilon_ {i} ^ {j, k}\right) _ {i} = \sigma_ {i} ^ {k} \epsilon_ {i} ^ {j, k} + \mu_ {i} ^ {k} \\ \end{array} +$$ + +with a KL divergence depending on scale prior $\sigma_0^2$ (Kingma & Welling, 2014): + +$$ +D _ {K L} ^ {\mathcal {N}} = \left(\left(\mu_ {i} ^ {k}\right) ^ {2} + \left(\sigma_ {i} ^ {k}\right) ^ {2}\right) \left(2 \sigma_ {0}\right) ^ {- 1} + \log \frac {\sigma_ {0}}{\sigma_ {i} ^ {k}} - \frac {1}{2} +$$ + +For a Laplacian distribution, we apply the reparameterization rule from (Connor et al., 2020) using $(\mu_i^k,\log b_i^k)$ output from a DNN: + +$$ +\epsilon_ {i} ^ {j, k} \sim \mathrm {U n i f} \left(- \frac {1}{2}, \frac {1}{2}\right) +$$ + +$$ +z _ {i} ^ {j, k} = g _ {\phi} \left(\mathbf {x} ^ {k}, \epsilon_ {i} ^ {j, k}\right) _ {i} = - b \operatorname {s i g n} \left(\epsilon_ {i} ^ {j, k}\right) \log \left(1 - 2 \epsilon_ {i} ^ {j, k}\right) +$$ + +Applying the KL divergence loss derived in (Meyer, 2021) with a scale prior $b_{0}$ : + +$$ +D _ {K L} ^ {L} = \frac {| \mu_ {i} ^ {k} |}{b _ {0}} + \frac {b _ {i} ^ {k} \exp \left(- | \mu_ {i} ^ {k} | (b _ {i} ^ {k}) ^ {- 1}\right)}{b _ {0}} + \log \frac {b _ {0}}{b _ {i} ^ {k}} - 1 +$$ + +To prevent numerical instability during training, we apply clamping to the log term in $g_{\phi}(\mathbf{x}^k,\epsilon_i^{j,k})_i$ to have a minimum value of 1E-06. Additionally, we multiply a warm-up variable $\omega$ to the inferred scale variable $b_{i}^{k}$ . At the beginning of training we set this variable $\omega^{(0)} = 0.1$ and increment it at each training iteration by 2E-04 until it reaches a maximum value of 1.0. + +When applying thresholding to either distribution, we either apply a fixed threshold set as a hyper-parameter $\lambda_{i} = \lambda_{0}$ or infer a threshold for each feature dimension. To perform reparameterization, we follow the pathwise derivative methods proposed in (Jankowiak & Obermeyer, 2018), parameterized by a neural network that outputs $(\log \alpha_{i}^{k}, \log \beta_{i}^{k})$ . For numerical stability, we clamp these values to be between $[1\mathrm{E} - 06, 1\mathrm{E} + 06]$ . We use both the reparameterization and KL divergence implementations included in PyTorch 1.10 (Paszke et al., 2019). In all cases, we set the prior $\alpha_{0} = 3$ , $\beta_{0} = \frac{3}{\lambda_{0}}$ . We find that on average this encourages the inferred threshold values to equal $\lambda_{0}$ . + +Our reparameterization procedure differs from the Spike-and-Slab from (Tonolini et al., 2020) in a few ways. First and foremost, we avoid the need of applying continuous approximations to Bernoulli random variables by applying shifted soft-thresholding. This also results in our model not needing to estimate a spike probability for each latent + +variable, but rather just parameters for the base distribution. Finally, rather than use the KL divergence for Spike-and-Slabs derived in (Tonolini et al., 2020), we only penalize the base distribution with a KL divergence. + +# C. Straight-Through Estimator Details + +The shifted soft-threshold is non-differentiable, with a subgradient of 0 when a latent component $z_{i} = 0$ . This is problematic since it serves as a block of gradient flowing from the generator to the inference network whenever a latent feature is not used (a common occurrence when sparsity is imposed on latent features). In these circumstances, although the gradient is blocked from the generator, a gradient is still computed for the KL divergence term. This empirically causes numerical instability (gradients go to NaN) or the inference network to primarily minimize the KL divergence term, leading to posterior collapse (Lucas et al., 2019). Note that this same problem would occur with a reparameterization procedure that simply sets $z_{i} = 0$ without applying $\mathcal{T}_{\lambda}$ in the cases where $\mathcal{T}_{\lambda}$ would result in a zero-valued latent component. + +Posterior collapse measures the extent to which the inference network is indistinguishable from the prior (Lucas et al., 2019): + +$$ +\mathbb {P} _ {\mathbf {x} \sim p (\mathbf {x})} \left[ D _ {K L} \left(q _ {\phi} \left(z _ {i}, \mathbf {x}\right) \| p \left(z _ {i}\right)\right) \leq \epsilon \right] \geq 1 - \delta . \tag {15} +$$ + +To measure another tangible problem of all latent features values going to zero, we also introduce the metric of feature collapse to measure whether inferred latent features $\widehat{\mathbf{z}}$ are zero for most images $\mathbf{x}$ : + +$$ +\mathbb {P} _ {\mathbf {x} \sim p (\mathbf {x})} \left[ | \widehat {z} _ {i} | \leq \epsilon \right] \geq 1 - \delta . \tag {16} +$$ + +We measure these two quantities in Table 2 using subgradient and straight-through estimators. It can be observed that using a single sample, the subgradient leads to numerical instability in all three runs. Increasing the number of samples avoids this instability, at the cost of complete posterior and feature collapse in all three runs. Meanwhile, the straight-through estimator avoids this issue. + +# D. Linear Generator Training Details + +For each method, we train using 80,000 image patches and validate using 16,000 image patches of dimension $16 \times 16$ with a dictionary of 256 entries. We train for 300 epochs using a batch size of 100. Our initial learning rate for the dictionary is $5\mathrm{E} - 01$ and we apply an exponential decay by a factor of 0.99 each epoch. Our inference network is trained with an initial learning rate of $1\mathrm{E} - 02$ , using an SGD+Nesterov optimizer with a CycleScheduler. For FISTA, we set $\kappa = 1\mathrm{E} - 03$ . For the variational methods, + +we set $\kappa = 1\mathrm{E} - 04$ , and the scale parameter of our prior $p(\mathbf{z})$ equal to 0.1 when applicable. Unless specified, we set the KL weight as $\beta = 1\mathrm{E} - 02$ for each method. We run each method for three trials, using the random seeds $\{0,1337,747\}$ . + +For FISTA, we multiply $\lambda$ by a warmup parameter $\omega$ that starts at $\omega^{(0)} = 0.1$ and is incremented by $1\mathrm{E} - 04$ each training iteration, capping at a maximum value of $\omega^{(t)} = 1.0$ . We find that this prevents all dictionary entries from going to zero when training with a Frobenius norm regularizer. + +For the Spike-and-Slab, we use the same warmup strategy proposed in (Tonolini et al., 2020). We set $\omega^{(0)} = 0.0$ , incrementing by $2\mathrm{E} - 04$ each iteration after iteration 1500. This parameter is also capped out at $\omega^{(t)} = 1.0$ . Additionally, we apply a warmup to the temperature parameter $\tau$ for the Gumbel-Softmax used in the Spike-and-Slab. This starts at $\tau^{(0)} = 1.0$ and is decreased by a multiplicative factor of 0.9995 until it reaches a minimum value of $\tau^{(t)} = 5\mathrm{E} - 01$ . We set the prior for the spike probability as 0.1. + +For the Thresholded Gaussian and Laplacian methods, we use the analytic results to set $\lambda_0$ respectively as 0.52 and 0.25. We find that these values lead to $10\%$ of the latent features non-zero for each input data on average. When using a Gamma prior on the threshold parameter, we reduce the corresponding KL weight by a multiplicative factor of 1E-01 (resulting in $\beta_{1} = 1\mathrm{E} - 02$ and $\beta_{2} = 1\mathrm{E} - 03$ ). We set $\alpha_0 = 3$ for each method that uses a Gamma prior. + +Each inference network uses an MLP backbone with the same architecture, with a separate projection head for each distribution parameter. The architecture for the backbone is outlined in Table 3. For each distribution parameter, an additional $256 \times 256$ linear layer is added on top of the output of this network. + +# E. DNN Generator Training Details + +For CelebA, we use 150,000 training samples and 19,000 validation samples. All samples are center cropped to $140 \times 140$ pixels and then resized to $64 \times 64$ . We also apply a random horizontal flip to training samples only. We train for 300 epochs using a batch size of 512 across two Nvidia RTX 3080s. We use an initial learning rate of 3E-04 using the Adam optimizer with $\beta = (0.5, 0.999)$ , weight decay equal to 1E-05, and a sample budget of $J = 10$ . Additionally, we use the automatic mixed precision (AMP) and DistributedDataParallel implementations included in PyTorch 1.10 (Paszke et al., 2019). We set $\beta = 1\mathrm{E} - 03$ for the KL divergence term in all methods. In the case where we have a Gamma distribution on the threshold parameter, we multiply the KL term by a factor of 1E-01 (leading to $\beta_{1} = 1\mathrm{E} - 03$ and $\beta_{2} = 1\mathrm{E} - 04$ ). The network architecture for the encoder and the decoder are included in Table 4. All + +Table 2. Posterior collapse and feature collapse for different sparsity estimators. Thresholding methods use a straight-through (ST) estimator or a subgradient (SG) estimator. NaN denotes a run that failed due to gradients equal to NaN. + +
Method/Prior Distribution% Posterior Collapse (ε = 1E-02, δ = 5E-02)% Feature Collapse (ε = 1E-02, δ = 5E-02)
J=1J=20J=1J=20
Thresholded Laplacian (SG)NaN100.00%NaN100.00%
Thresholded Laplacian (ST)4.17%4.56%0.00%0.00%
+ +Table 3. Inference Network Backbone for Linear Generator + +
Input ∈ R16×16
Linear: 256 × 512
ReLU
Linear: 512 × 1024
ReLU
Linear: 1024 × 512
ReLU
Linear: 512 × 256
ReLU
Output ∈ R256
+ +other methodology is kept consistent with the linear generator. We run each method for three trials, using the random seeds $\{0,1337,747\}$ . + +For FMNIST, we train with all 60,000 training samples and evaluate on all 10,000 validation samples. Hyperparameters are kept the same as CelebA experiments, except for a KL divergence weight $\beta = 1\mathrm{E} - 02$ and sampling budget $J = 20$ . A smaller network architecture is used for FMNIST, depicted in Table 5. + +# F. Additional Results for Linear Generator + +F.1. Full Dictionary for Different Priors +F.2. Full Dictionary for Different Sampling Methods +G. Additional Results for DNN Generator +G.1. Recovered Dictionary at Different Dimensionality + +Table 4. Network Architecture for CelebA Experiments + +
Encoder NetworkDecoder Network
Input ∈ R64×64×3Input ∈ Rd
conv: chan: 64, Kern: 4, stride: 2, pad: 1Linear: d × 1024 Units
BatchNorm: feat: 64ReLU
ReLUconvTranpose: chan: 128, Kern: 4, stride: 2, pad: 1
conv: chan: 64, Kern: 4, stride: 2, pad: 1BatchNorm: feat: 128
BatchNorm: feat: 64ReLU
ReLUconvTranpose: chann: 128, Kern: 4, stride: 2, pad: 1
conv: chan: 128, Kern: 4, stride: 2, pad: 1BatchNorm: feat: 128
BatchNorm: feat: 128ReLU
ReLUconvTranpose: chan: 64, kernel: 4, stride: 2, pad: 1
conv: chan: 256, Kern: 4, stride: 2, pad: 1BatchNorm: feat: 64
BatchNorm: feat: 256ReLU
ReLUconvTranpose: chan: 64, kernel: 4, stride: 2, pad: 1
conv: chan: 256, Kern: 4, stride: 2, pad: 0BatchNorm: feat: 64
BatchNorm: feat: 256ReLU
ReLUconvTranpose: chan: 3, kernel: 4, stride: 2, pad: 1
Output ∈ R256Sigmoid
Output ∈ R64×64×3
+ +Table 5. Network Architecture for FMNIST Experiments + +
Encoder NetworkDecoder Network
Input ∈ R28×28×1Input ∈ Rd
conv: chan: 64, Kern: 4, stride: 2, pad: 1Linear: d × 128 Units
BatchNorm: feat: 64ReLU
ReLUconvTranpose: chan: 128, Kern: 4, stride: 2, pad: 0
conv: chan: 64, Kern: 4, stride: 2, pad: 1BatchNorm: feat: 128
BatchNorm: feat: 64ReLU
ReLUconvTranpose: chann: 64, Kern: 4, stride: 1, pad: 0
conv: chan: 128, Kern: 4, stride: 1, pad: 0BatchNorm: feat: 64
BatchNorm: feat: 128ReLU
ReLUconvTranpose: chan: 64, kernel: 4, stride: 2, pad: 1
conv: chan: 64, Kern: 4, stride: 2, pad: 1BatchNorm: feat: 64
BatchNorm: feat: 128ReLU
ReLUconvTranpose: chan: 1, kernel: 4, stride: 2, pad: 1
Output ∈ R128Sigmoid
Output ∈ R28×28×1
+ +Table 6. A copy of Table 1 from the main text with $J = {20}$ samples with standard deviations included + +
Method/Prior DistributionValidation LossMulti-InformationIWAE Loss
FISTA (baseline)1.01E+02 ± 7.00E-018.75E+01 ± 5.43E-01-
Gaussian1.35E+03 ± 2.08E+007.36E+02 ± 3.06E-012.16E-01 ± 2.64E-04
Laplacian5.79E+02 ± 1.51E+005.34E+02 ± 5.29E-012.22E-01 ± 7.97E-04
Spike-and-slab2.39E+02 ± 4.27E+001.96E+02 ± 2.57E+002.12E-01 ± 2.64E-02
Thresholded Gaussian2.30E+02 ± 1.87E+001.76E+02 ± 2.08E-011.33E+00 ± 3.80E-03
Thresholded Gaussian+Gamma2.70E+02 ± 1.87E+002.29E+02 ± 3.79E-011.13E+00 ± 2.47E-03
Thresholded Laplacian1.94E+02 ± 1.66E+001.91E+02 ± 1.53E-011.13E+00 ± 1.29E-02
Thresholded Laplacian+Gamma2.11E+02 ± 1.47E+002.33E+02 ± 5.77E-011.12E+00 ± 8.09E-03
+ +![](images/fa945d1f0bda04724442178dbd74b30df0efa4bc74f754d7575967409c054d7a.jpg) +(a) Inference Network SNR + +![](images/d81b4cb6c345177e4bda8b3dce3b83f4e1710cf0d01784df7979b8636ccdbccf.jpg) +(b) Generator SNR + +![](images/4b3c0d68dd9b2e813a95c2825e79c8b807a3dc37bb0505c058fde2fa935d0105.jpg) +Figure 9. Comparison of SNR for (a) inference network and (b) linear generator for all methods using $J = 1$ and $J = 20$ with max ELBO sampling. +(a) +Figure 10. Full dictionary sorted by magnitude in descending order for FISTA with $\lambda = 20$ and a Frobenius norm penalty of $1\mathrm{E} - 03$ . + +![](images/55e52d447f2d389166193a65ac370fff4cf774b123754f19bdde4ff62ecaad47.jpg) +(a) $J = 1$ + +![](images/6fd72e8a8e651598288bb582a5256231290c8d9dde9cf8a66efc0dd87d2b860e.jpg) +(b) $J = 20$ + +![](images/3ddf86f675f1904640eeb1d9d010abb54cecbac7e461eb2ea0cf5732318b0c05.jpg) +Figure 11. Full dictionary sorted by magnitude in descending order for Gaussian prior with $J = 1$ and $J = 20$ under max ELBO sampling. +(a) $J = 1$ +Figure 12. Full dictionary sorted by magnitude in descending order for Laplacian prior with $J = 1$ and $J = 20$ under max ELBO sampling. + +![](images/8f3346ac40e00415b3597a972945d4015f9a52f89d595b70cca56388e045ef20.jpg) +(b) $J = 20$ + +![](images/aec8b2c96b11ba116e07bc2f33e3350c9c8be2e4ff7de8a868864edf28b2ab96.jpg) +(a) $J = 1$ + +![](images/4ac9fb82de171863790fff915c8bb01d3e7efa8bc42d6f2fbfc2610ec17c9526.jpg) +(b) $J = 20$ + +![](images/a0119be45c629991c9e2c9c99040651595db4ebe0522456b9eb03dd1653d1327.jpg) +Figure 13. Full dictionary sorted by magnitude in descending order for Spike-and-Slab prior with $J = 1$ and $J = 20$ under max ELBO sampling. +(a) $J = 1$ +Figure 14. Full dictionary sorted by magnitude in descending order for Thresholded Gaussian prior with $J = 1$ and $J = 20$ under max ELBO sampling. + +![](images/58f1f1a9b0b6609421fe4bf5d75ac02e98f779a97a8d2cd28a168a4376d943ed.jpg) +(b) $J = 20$ + +![](images/16efc86a946225d3c098cd06482fb00cbae9fedb94efa5e2cbbd62d87e7c45eb.jpg) +(a) $J = 1$ + +![](images/ec457dc45322b8518e70688f5efc77b97bce9b997634ee6cb7f7197e7d13d498.jpg) +(b) $J = 20$ + +![](images/68cab076288d03e2a8888d5ab83a905d4526a2b2d101009abf5173527659e7fc.jpg) +Figure 15. Full dictionary sorted by magnitude in descending order for Thresholded Gaussian + Gamma threshold prior prior with $J = 1$ and $J = 20$ under max ELBO sampling. +(a) $J = 1$ +Figure 16. Full dictionary sorted by magnitude in descending order for Thresholded Laplacian prior with $J = 1$ and $J = 20$ under max ELBO sampling. + +![](images/2289c4fa27c023947c322791fecebbf77bb76494568cfe8bec0924d6ac7d5049.jpg) +(b) $J = 20$ + +![](images/562b00f5838d308412149ef5a6070c7e0f4f75d93279b4a86852ed3d6c3942f4.jpg) +(a) $J = 1$ + +![](images/9f6e85be3415c3403410179498e8793959c4595e68cbb9f87f820600c3305b0a.jpg) +(b) $J = 20$ +Figure 17. Full dictionary sorted by magnitude in descending order for Thresholded Laplacian + Gamma threshold prior prior with $J = 1$ and $J = 20$ under max ELBO sampling. + +![](images/76c48696a6f3c24e0e9abcf49a39ace08f1db049ac85c31ccca237449e9f4095.jpg) +(a) Avg + +![](images/884acc3b88be1d23fb4905b5a5c795331ade8c259e239ceb7703d68d7977250d.jpg) +(b) IWAE + +![](images/07013ddaf78bd59a8ef03266d3e9ff7ff00e7232b55d4b21e4efe10c154473d1.jpg) +(c) Max +Figure 18. Full dictionary sorted by magnitude in descending order for different sampling methods using $J = 100$ samples using the Thresholded Laplacian prior. Average sampling and IWAE sampling learn repetitive features in their dictionary since they do not encourage feature reuse during training. On the other hand, max ELBO sampling learns a larger dictionary of diverse features. + +![](images/9037b47876876d45fffc6e499a68d6aae2ded05add5fb21fa552226d9823cedf.jpg) +(a) 64 Dimensions + +![](images/fb49d29638610120b9c4d5600725dfe00931e167c818694e010446fe41b1db7c.jpg) +(b) 4096 Dimensions +Figure 19. Image reconstruction on CelebA using DNN generator for (a) 64 dimensions and (b) 4096 dimensions. From top to bottom, the rows denote the ground truth images, a Gaussian prior, a Spike-and-Slab prior, a Thresholded Gaussian prior, and a Thresholded Gaussian+Gamma prior. + +![](images/3a018a83a732fd52539767df4e2443696dea1bf97ae4b1058548fee4242759a8.jpg) +(a) Gaussian +Figure 20. 64 dimensional latent space. Sampled entries from an estimated dictionary using an inference network trained with a DNN generator on CelebA. Entries are shown in descending order of Frobenius norm magnitude, with each row taking linearly spaced entries from the full dictionary. The sparse prior is set so to encourage $10\%$ of latent features to be non-zero. + +![](images/0f117af46ed1427f0c09dd90ac6d86726362cdbb27dc91fe3bb5455bb18eb69a.jpg) +(b) Thresholded Gaussian+Gamma + +![](images/ac321cd30906662b1893915663a0076e4db1ee3aff7d1965bb960e137f854555.jpg) +(a) Gaussian + +![](images/cf3b7aa205926d513c22bb0ae29d7b8e8d6ad0f3c316e55a2a877ef7b7511ad0.jpg) +(b) Thresholded Gaussian+Gamma + +![](images/4956562e5237acbb95ed36d397f7062084fbd9f4356562d0cf1bfc9b8d8c9f50.jpg) +Figure 21. 512 dimensional latent space. Sampled entries from an estimated dictionary using an inference network trained with a DNN generator on CelebA. Entries are shown in descending order of Frobenius norm magnitude, with each row taking linearly spaced entries from the full dictionary. The sparse prior is set so to encourage $10\%$ of latent features to be non-zero. +(a) Gaussian +Figure 22. 2048 dimensional latent space. Sampled entries from an estimated dictionary using an inference network trained with a DNN generator on CelebA. Entries are shown in descending order of Frobenius norm magnitude, with each row taking linearly spaced entries from the full dictionary. The sparse prior is set so to encourage $10\%$ of latent features to be non-zero. + +![](images/0bdfdc34f8357a7340cc6a6871ab8f50dd5b0a843fb69ba3019e045aaa1e36e0.jpg) +(b) Thresholded Gaussian+Gamma + +![](images/984a5b1e3eda498d3660f2d8b094c26310197a70c91255a3d97f1e16e3fece88.jpg) +(a) Gaussian +Figure 23. 4096 dimensional latent space. Sampled entries from an estimated dictionary using an inference network trained with a DNN generator on CelebA. Entries are shown in descending order of Frobenius norm magnitude, with each row taking linearly spaced entries from the full dictionary. The sparse prior is set so to encourage $10\%$ of latent features to be non-zero. + +![](images/67881e4d2f43dcf8824920be42572201074fa1ec976c265c879803177fc47b4d.jpg) +(b) Thresholded Gaussian+Gamma \ No newline at end of file diff --git a/variationalsparsecodingwithlearnedthresholding/images.zip b/variationalsparsecodingwithlearnedthresholding/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..db42b696e80b5e90a310d361bcb81a206c210f82 --- /dev/null +++ b/variationalsparsecodingwithlearnedthresholding/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c334901a670045e6d730386e51325ad5df8eabe15f40a593e0ef82b0cc355839 +size 3220220 diff --git a/variationalsparsecodingwithlearnedthresholding/layout.json b/variationalsparsecodingwithlearnedthresholding/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..a72e15f0b8a850662b13a3110d12c48cfa0ad49a --- /dev/null +++ b/variationalsparsecodingwithlearnedthresholding/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bdb226ccdfee60f95203a51ab748664886fd02bdca96dc86b39d6b3cf0969371 +size 894050 diff --git a/variationalwassersteingradientflow/de03a6b2-0d62-46fa-a231-5d636c956261_content_list.json b/variationalwassersteingradientflow/de03a6b2-0d62-46fa-a231-5d636c956261_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..1d095443b9b70fd2e9c8cc9153440831dbdf8f4b --- /dev/null +++ b/variationalwassersteingradientflow/de03a6b2-0d62-46fa-a231-5d636c956261_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f11ee7a04ace9d62a62198928f6d7295a964d0a72ecd2d7b6c3de654fa70967f +size 203747 diff --git a/variationalwassersteingradientflow/de03a6b2-0d62-46fa-a231-5d636c956261_model.json b/variationalwassersteingradientflow/de03a6b2-0d62-46fa-a231-5d636c956261_model.json new file mode 100644 index 0000000000000000000000000000000000000000..f337d6439cb62dbe3209d995f3fa5aa00dbcf8f1 --- /dev/null +++ b/variationalwassersteingradientflow/de03a6b2-0d62-46fa-a231-5d636c956261_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fdb2b46510e95881464cabfa6d7d080368e3b7555379e291c242f7e97e0d33af +size 246427 diff --git a/variationalwassersteingradientflow/de03a6b2-0d62-46fa-a231-5d636c956261_origin.pdf b/variationalwassersteingradientflow/de03a6b2-0d62-46fa-a231-5d636c956261_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..3c4870a3915c75b4c0b6a5533f6663e9bdb5f20b --- /dev/null +++ b/variationalwassersteingradientflow/de03a6b2-0d62-46fa-a231-5d636c956261_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a3a8250f87cb4656646091fa5dd3a771a8a7af93e4893f831106d9bfd26b2b1f +size 12402921 diff --git a/variationalwassersteingradientflow/full.md b/variationalwassersteingradientflow/full.md new file mode 100644 index 0000000000000000000000000000000000000000..e8d011f68399672d317820c683acf80f600e442d --- /dev/null +++ b/variationalwassersteingradientflow/full.md @@ -0,0 +1,1156 @@ +# Jiaojiao Fan $^{1}$ Qinsheng Zhang $^{1}$ Amirhossein Taghvaei $^{2}$ Yongxin Chen $^{1}$ + +# Abstract + +Wasserstein gradient flow has emerged as a promising approach to solve optimization problems over the space of probability distributions. A recent trend is to use the well-known JKO scheme in combination with input convex neural networks to numerically implement the proximal step. The most challenging step, in this setup, is to evaluate functions involving density explicitly, such as entropy, in terms of samples. This paper builds on the recent works with a slight but crucial difference: we propose to utilize a variational formulation of the objective function formulated as maximization over a parametric class of functions. Theoretically, the proposed variational formulation allows the construction of gradient flows directly for empirical distributions with a well-defined and meaningful objective function. Computationally, this approach replaces the computationally expensive step in existing methods, to handle objective functions involving density, with inner loop updates that only require a small batch of samples and scale well with the dimension. The performance and scalability of the proposed method are illustrated with the aid of several numerical experiments involving high-dimensional synthetic and real datasets. + +# 1 Introduction + +The Wasserstein gradient flow models the gradient dynamics on the space of probability densities with respect to the Wasserstein metric. It was first discovered by Jordan, Kinderlehrer, and Otto (JKO) in their seminal work (Jordan et al., 1998). They pointed out that the Fokker-Planck equation is in fact the Wasserstein gradient flow of the free energy, bringing tremendous physical insights to this type of partial differential equations (PDEs). Since then, the + +Wasserstein gradient flow has played an important role in optimal transport (Santambrogio, 2017; Carlier et al., 2017), PDEs (Otto, 2001), physics (Carrillo et al., 2021; Adams et al., 2011), machine learning (Bunne et al., 2021; Lin et al., 2021; Alvarez-Melis et al., 2021; Frogner & Poggio, 2020), sampling (Bernton, 2018; Cheng & Bartlett, 2018; Wibisono, 2018) and many other areas (Ambrosio et al., 2008). Despite the abundant theoretical results on the Wasserstein gradient flow established over the past decades (Ambrosio et al., 2008; Santambrogio, 2017), the computation of it remains a challenge. Most existing methods are either based on a finite difference method applied to the underlying PDEs or based on a finite dimensional optimization; both require discretization of the underlying space (Peyre, 2015; Benamou et al., 2016; Carlier et al., 2017; Li et al., 2020; Carrillo et al., 2021). The computational complexity of these methods scales exponentially with the problem dimension, making them unsuitable for the cases with probability densities over high dimensional space. + +This shortcoming motivated recent line of interesting works to develop scalable algorithms utilizing neural networks (Mokrov et al., 2021; Alvarez-Melis et al., 2021; Yang et al., 2020; Bunne et al., 2021; Bonet et al., 2021). A central theme, in most of these works, is the application of the JKO scheme in combination with input convex neural networks (ICNN) (Amos et al., 2017). The JKO scheme, which is essentially a backward Euler method, is used to discretize the continuous flow in time. At each time-step, one needs to find a probability distribution that minimizes a weighted sum of squared Wasserstein distance, with respect to the distribution at the previous time-step, and the objective function. The probability distribution is then parametrized as push-forward of the optimal transport map from the previous probability distribution. The optimal transport map is represented with gradient of an ICNN utilizing the knowledge that optimal transport maps are gradient of convex functions when the transportation cost is quadratic. The problem is finally cast as stochastic optimization problem which only requires samples from the distribution. + +Our paper builds on these recent works but with a crucial difference. We propose to use a variational form of the objective function, leveraging $f$ -divergences, which has been employed in multiple machine learning applications, such as generative models (Nowozin et al., 2016), and Bayesian + +inference (Wan et al., 2020). The variational problem is formulated as maximization over a parametrized class of functions. The variational form allows the evaluation of the objective in terms of samples, without the need for density estimation or approximating the logarithm of the determinant of the Hessian of ICNNs which appears in (Mokrov et al., 2021; Alvarez-Melis et al., 2021). Moreover, the variational form, even when restricted to a finite-dimensional class of functions, admits nice geometrical properties of its own leading to a meaningful objective function to minimize. + +At the end of the algorithm, a sequence of transport maps connecting the initial distribution with the terminal distribution along the gradient flow dynamics are obtained. One can then sample from the distributions along the flow by sampling from the initial distribution (often Gaussian) and then propagating these samples through the sequence of transport maps. When the transport map is modeled by the gradient of an input convex neural network, one can also evaluate the densities at every point. + +Our contributions are summarized as follows. + +i) We develop a numerical algorithm to implement the Wasserstein gradient flow that is based on a variational representation of the objective functions. The algorithm does not require spatial discretization, density estimation, or approximating logarithm of determinant of Hessians. + +ii) We numerically demonstrate the performance of our algorithm on several representative problems including sampling from high-dimensional Gaussian mixtures, porous medium equation, and learning generative models on MNIST and CIFAR10 datasets. We illustrate the computational advantage of our proposed method in comparison with (Mokrov et al., 2021; Alvarez-Melis et al., 2021), in terms of computational time and scalability with the problem dimension. + +iii) We establish some preliminary theoretical results regarding the proposed variational objective function. In particular, we provide conditions under which the variational objective satisfies a moment matching property and an embedding inequality with respect to a certain integral probability metric (see Proposition 4.1). + +Related works: Most existing methods to compute Wasserstein gradient flow are finite difference based (Peyre, 2015; Benamou et al., 2016; Carlier et al., 2017; Li et al., 2020; Carrillo et al., 2021). These methods require spatial discretization and are thus not scalable to high dimensional settings. There is a line of research that uses particle-based method to estimate the Wasserstein gradient flow (Carrillo et al., 2019a; Frogner & Poggio, 2020). In these algorithms, the current density value is often estimated using kernel method whose complexity scales at least quadratically with the number of particles. More recently, several interesting neural network based methods (Mokrov et al., 2021; Alvarez-Melis et al., 2021; Yang et al., 2020; Bunne et al., + +2021; Bonet et al., 2021; Hwang et al., 2021) were proposed for Wasserstein gradient flow. Mokrov et al. (2021) focuses on the special case with Kullback-Leibler divergence as objective function. Alvarez-Melis et al. (2021) uses a density estimation method to evaluate the objective function by back-propagating to the initial distribution, which could become a computational burden when the number of time discretization is large. Yang et al. (2020) is based on a forward Euler time discretization of the Wasserstein gradient flow and is more sensitive to time stepsize. Bunne et al. (2021) utilizes JKO scheme to approximate a population dynamics given an observed trajectory, which finds application in computational biology. Bonet et al. (2021) replaces Wasserstein distance in JKO by sliced alternative but its connection to the original Wasserstein gradient flow remains unclear. + +# 2 Background + +# 2.1 Optimization problem + +We are interested in developing algorithms for + +$$ +\min _ {P \in \mathcal {P} _ {a c} (\mathbb {R} ^ {n})} \mathcal {F} (P), \tag {1} +$$ + +where $\mathcal{P}_{ac}(\mathbb{R}^n)$ is the space of probability distributions that admit density $dP / dx$ with respect to Lebesgue measure. The objective function $\mathcal{F}(P)$ takes different form depending on the application. Three important examples are: + +Example I: Kullback-Leibler divergence with respect to a given target distribution $Q$ , + +$$ +\mathcal {D} (P | | Q) := \int \log \left(\frac {d P}{d Q}\right) d P \tag {2} +$$ + +plays an important role in the sampling problem. + +Example II: Generalized entropy + +$$ +\mathcal {G} (P) := \frac {1}{m - 1} \int P ^ {m} (x) d x, \quad m > 1 +$$ + +is important for modeling the porous medium. + +Example III: The (twice) Jensen-Shannon divergence + +$$ +\operatorname {J S D} (P \| Q) := \mathcal {D} \left( \right.P \left\| \right. \frac {P + Q}{2}\left. \right) + \mathcal {D} \left( \right.Q \left\| \right. \frac {P + Q}{2}\left. \right)\left. \right. +$$ + +is important in learning generative models. + +# 2.2 Wasserstein gradient flow + +Given a function $\mathcal{F}(P)$ over the space of probability densities, the Wasserstein gradient flow describes the dynamics of the probability density when it follows the steepest descent direction of the function $\mathcal{F}(P)$ with respect to the + +Riemannian metric induced by the 2-Wasserstein distance $W_{2}$ (Ambrosio et al., 2008). The Wasserstein gradient flow can be explicitly represented by the PDE + +$$ +\frac {\partial P}{\partial t} = \nabla \cdot \left(P \nabla \frac {\delta \mathcal {F}}{\delta P}\right), +$$ + +where $\delta \mathcal{F} / \delta P$ represents the first-variation of $\mathcal{F}$ with respect to the standard $L_{2}$ metric (Villani, 2003, Ch. 8). + +Wasserstein gradient flow corresponds to various important PDEs depending on the choice of objective functions $\mathcal{F}(P)$ . For instance, when $\mathcal{F}(P)$ is the free energy, i.e. + +$$ +\mathcal {F} (P) = \int_ {\mathbb {R} ^ {n}} P (x) \log P (x) d x + \int_ {\mathbb {R} ^ {n}} V (x) P (x) d x, +$$ + +the gradient flow is the Fokker-Planck equation (Jordan et al., 1998). + +$$ +\frac {\partial P}{\partial t} = \nabla \cdot (P \nabla V) + \Delta P. +$$ + +When $\mathcal{F}(P)$ is the generalized entropy $\mathcal{F}(P) = \frac{1}{m - 1}\int_{\mathbb{R}^n}P^m (x)dx$ for some positive number $m > 1$ , the gradient flow is the porous medium equation (Otto, 2001; Vázquez, 2007) $\frac{\partial P}{\partial t} = \Delta P^{m}$ . + +# 2.3 JKO scheme and reparametrization + +To numerically realize the Wasserstein gradient flow, a discretization over time is needed. One such discretization is the famous JKO scheme (Jordan et al., 1998) + +$$ +P _ {k + 1} = \underset {P \in \mathcal {P} _ {a c} (\mathbb {R} ^ {n})} {\arg \min } \frac {1}{2 a} W _ {2} ^ {2} (P, P _ {k}) + \mathcal {F} (P). \tag {3} +$$ + +This is essentially a backward Euler discretization or a proximal point method with respect to the Wasserstein metric. The solution to (3) converges to the continuous-time Wasserstein gradient flow when the step size $a \to 0$ . + +Recall the definition of the Wasserstein-2 distance + +$$ +W _ {2} ^ {2} (P, Q) = \min _ {T: T \sharp P = Q} \int_ {\mathbb {R} ^ {n}} \| x - T (x) \| _ {2} ^ {2} d P (x), +$$ + +where the minimization is over all the feasible transport maps that transport mass from distribution $P$ to distribution $Q$ . Hence, (3) can be recast as an optimization in terms of the transport maps $T:\mathbb{R}^n\to \mathbb{R}^n$ from $P_{k}$ to $P$ . By defining $P = T\nparallel P_k$ , the optimal $T$ is the optimal transport map from $P_{k}$ to $T\nparallel P_{k}$ and thus the gradient of a convex function $\varphi$ by Brenier's Theorem (Brenier, 1991). Bunne et al. (2021); Mokrov et al. (2021); Alvarez-Melis et al. (2021) propose to parameterize $T$ as the gradient of Input convex neural network (ICNN) (Amos et al., 2017) and express (3) as + +$$ +P _ {k + 1} = \nabla \varphi_ {k} \sharp P _ {k}, \tag {4} +$$ + +$$ +\varphi_ {k} = \underset {\varphi \in \mathrm {C V X}} {\arg \min } \frac {1}{2 a} \int_ {\mathbb {R} ^ {n}} \| x - \nabla \varphi (x) \| _ {2} ^ {2} d P _ {k} (x) + \mathcal {F} (\nabla \varphi \sharp P _ {k}), +$$ + +where CVX stands for the space of convex functions. In our method, we extend this idea and propose to reparametrize $T$ alternatively by a residual neural network. With this reparametrization, the JKO step (3) becomes + +$$ +P _ {k + 1} = T _ {k} \# P _ {k}, \tag {5} +$$ + +$$ +T _ {k} = \underset {T} {\arg \min } \frac {1}{2 a} \int_ {\mathbb {R} ^ {n}} \| x - T (x) \| _ {2} ^ {2} d P _ {k} (x) + \mathcal {F} (T \sharp P _ {k}). +$$ + +We use the preceding two schemes (4) and (5) in our numerical method depending on the application. + +# 3 Methods and algorithms + +We discuss how to implement JKO scheme with our approach and its computational complexity in this section. + +# 3.1 $\mathcal{F}(P)$ reformulation with variational formula + +The main challenge in implementing the JKO scheme is to evaluate the functional $\mathcal{F}(P)$ in terms of samples from $P$ . We achieve this goal by using a variational formulation of $\mathcal{F}$ . In order to do so, we use the notion of $f$ -divergence between the two distributions $P$ and $Q$ : + +$$ +D _ {f} (P \| Q) = \mathbb {E} _ {Q} \left[ f \left(\frac {d P}{d Q}\right) \right] \tag {6} +$$ + +where $P$ admits density with respect to $Q$ (denoted as $P \ll Q$ ) and $f:[0, +\infty) \to \mathbb{R}$ is a convex and lower semicontinuous function. Without loss of generality, we assume $f(1) = 0$ so that $D_{f}$ attains its minimum at $P = Q$ . + +Proposition 3.1. (Nguyen et al., 2010) $\forall P, Q \in \mathcal{P}(\mathbb{R}^n)$ such that $P \ll Q$ and differentiable $f$ : + +$$ +D _ {f} (P \| Q) = \sup _ {h \in \mathcal {C}} \mathbb {E} _ {P} [ h (X) ] - \mathbb {E} _ {Q} [ f ^ {*} (h (Y)) ]. \tag {7} +$$ + +where $f^{*}(y) = \sup_{x\in \mathbb{R}}[xy - f(x)]$ is the convex conjugate of $f$ and $\mathcal{C}$ is all measurable functions $h:\mathbb{R}^n\to \mathbb{R}$ . The supremum is attained at $h = f'(dP / dQ)$ . + +The variational form has the distinguishing feature that it does not involve the density of $P$ and $Q$ explicitly and can be approximated in terms of samples from $P$ and $Q$ . In general, our scheme can be applied to any $f$ -divergence, but we focus on the functionals in Section 2.1. + +With the help of the $f$ -divergence variational formula, when $\mathcal{F}(P) = \mathcal{D}(P\| Q)$ , $\mathcal{G}(P)$ or $\mathrm{JSD}(P\| Q)$ , the JKO scheme (5) can be equivalently expressed as + +$$ +P _ {k + 1} = T _ {k} \sharp P _ {k}, \tag {8} +$$ + +$$ +T _ {k} = \underset {T} {\arg \min } \left\{\frac {1}{2 a} \mathbb {E} _ {P _ {k}} [ \| X - T (X) \| ^ {2} ] + \sup _ {h} \mathcal {V} (T, h) \right\}. +$$ + +where $\mathcal{V}(T,h) = \mathbb{E}_{X\sim P_k}[\mathcal{A}_h(T(X))] - \mathbb{E}_{Z\sim \Gamma}[\mathcal{B}_h(Z)]$ , $\Gamma$ is a user designed distribution which is easy to sample from, and $\mathcal{A}$ and $\mathcal{B}$ are functionals whose form depends on $\mathcal{F}$ . The specializations of $\mathcal{A}$ and $\mathcal{B}$ appear in Table 1. + +The following lemma implies that if $\mathcal{F}(P)$ can be written as $D_{f}(P\| Q)$ , then $\mathcal{F}(P)$ monotonically decreases along its Wasserstein gradient flow, which makes it reasonable to solve (1) by using JKO scheme. It also justifies that the gradient flow finally converges to $Q$ . + +Lemma 3.2. Gao et al. (2019, Lemma 2.2) + +$$ +\frac {d}{d t} \mathcal {F} (P _ {t}) = - \mathbb {E} _ {P _ {t}} (\| \nabla f ^ {\prime} (P _ {t} / Q) \| ^ {2}). +$$ + +# 3.1.1 KL DIVERGENCE + +The KL divergence is a special instance of the $f$ -divergence with $f(x) = x\log x$ . Using $f(x) = x\log x$ in (7) yields the following expression for KL divergence as a corollary of Proposition 3.1. The proof appears in Section A.1 + +Corollary 3.3. The variational form for $\mathcal{D}(P\| Q)$ reads + +$$ +\mathcal {D} (P \| Q) = 1 + \sup _ {h} \mathbb {E} _ {P} \left[ \log \frac {h (X) \mu (X)}{Q (X)} \right] - \mathbb {E} _ {\mu} [ h (Z) ], +$$ + +where $\mu$ is a user designed distribution which is easy to sample from. The optimal function $h$ is equal to $dP / d\mu$ . + +This variational formula becomes practical when we have only access to un-normalized density of $Q$ , which is the case for the sampling problem. In practice, we choose $\mu = \mu_{k}$ adaptively, where $\mu_{k}$ is the Gaussian with the same mean and covariance as $P_{k}$ . We noticed that this choice improves the numerical stability of the algorithm. + +# 3.1.2 GENERALIZED ENTROPY + +The generalized entropy can be also represented as a $f$ -divergence. In particular, with $f(x) = \frac{1}{m - 1} (x^m - x)$ and $Q$ the uniform distribution on the superset of the support of density $P(x)$ with volume $\Omega$ : + +$$ +\begin{array}{l} D _ {f} (P \| Q) = \frac {\Omega^ {m - 1}}{m - 1} \int P ^ {m} (x) d x - \frac {1}{m - 1} \tag {9} \\ = \Omega^ {m - 1} \mathcal {G} (P) - \frac {1}{m - 1}. \\ \end{array} +$$ + +Plugging $f(x) = \frac{1}{m - 1} (x^m - x)$ into (7), we get the following expression of the generalized entropy as a corollary of Proposition 3.1. The proof appears in Section A.1 + +Corollary 3.4. The variational formulation for $\mathcal{G}(P)$ reads + +$$ +\mathcal {G} (P) = \frac {\operatorname* {s u p} _ {h} \left(\mathbb {E} _ {P} \left[ \frac {m h ^ {m - 1} (X)}{m - 1} \right] - \mathbb {E} _ {Q} [ h ^ {m} (Z) ]\right)}{\Omega^ {m - 1}}. \tag {10} +$$ + +The optimal function $h$ is equal to $\frac{dP}{dQ}$ . + +Table 1: Variational formula for $\mathcal{F}\left( P\right)$ + +
F(P)AhBhΓ
D(P||Q)log(h·μk/Q)hGaussian dist. μk
G(P)m/m-1·hm-1/Ωkm-1hm/Ωkm-1Uniform dist. Qk
JSD(P||Q)log(1-h)-log hEmpirical dist. Q
+ +In practice, we choose $\Omega = \Omega_{k}$ which is the volume of a set that guarantees to contain the support of $T\sharp P_{k}$ . In view of the connection between generalized entropy and $f$ -divergence, it is justified that the solution of Porous Media equation develops towards a uniform distribution. Especially, when $m = 2$ , (9) recovers the Pearson divergence between $P$ and the uniform distribution $Q$ . + +# 3.1.3 JENSEN-SHANNON DIVERGENCE + +$\operatorname{JSD}(P\|Q)$ corresponds to $f$ -divergence with $f(x) = -(x + 1)\log((1 + x)/2) + x\log x$ . Direct application of (7) concludes the following Corollary. + +Corollary 3.5. The variational form for $JSD(P\|Q)$ is + +$$ +\log 4 + \sup _ {h} \mathbb {E} _ {P} [ \log (1 - h (X)) ] + \mathbb {E} _ {Q} [ \log h (Z) ]. \tag {11} +$$ + +In particular, we apply JSD to the learn the image generative model, therefore we assume samples from $Q$ are accessible. + +Algorithm 1 Primal-dual gradient flow +Input: Objective functional $\mathcal{F}(P)$ , initial distribution $P_0$ JKO step size $a$ , number of JKO steps $K$ +Initialization: Parameterized $T_{\theta}$ and $h_\lambda$ +for $k = 1,2,\dots ,K$ do $T_{\theta}\gets T_{k - 1}$ if $k > 1$ for $j_{1} = 1,2,\ldots ,J_{1}$ do Sample $X_{1},\ldots ,X_{M}\sim P_{k}$ $Z_{1},\ldots ,Z_{M}\sim \Gamma$ Maximize $\frac{1}{M}\sum_{i = 1}^{M}[\mathcal{A}(T_{\theta}(X_i),h_{\lambda}) - \mathcal{B}(h_{\lambda}(Z_i))]$ over $\lambda$ for $J_{2}$ steps. Minimize $\frac{1}{M}\sum_{i = 1}^{M}\left[\frac{\|X_i - T_\theta(X_i)\|^2}{2a} +\mathcal{A}(T_\theta (X_i),h_\lambda)\right]$ over $\theta$ for $J_{3}$ steps. +end for $T_{k}\gets T_{\theta}$ +end for +Output: $\{T_k\}_{k = 1}^K$ + +# 3.2 Parametrization of $T$ and $h$ + +The two optimization variables $T$ and $h$ in our minimax formulation (8) can be both parameterized by neural networks, denoted by $T_{\theta}$ and $h_{\lambda}$ . With this neural network + +parametrization, we can then solve the problem by iteratively updating $T_{\theta}$ and $h_{\lambda}$ . This primal-dual method to solve (1) is depicted in Algorithm 1. + +In this work, we implemented two different architectures for the map $T$ . One way is to use a residual neural network to represent $T$ directly, and another way is to parametrize $T$ as the gradient of a ICNN $\varphi$ . The latter has been widely used in optimal transport (Makkuva et al., 2020; Fan et al., 2020; Korotin et al., 2021b). However, recently several works (Rout et al., 2021; Korotin et al., 2021a; Fan et al., 2021; Bonet et al., 2021) find poor expressiveness of ICNN architecture and also propose to replace the gradient of ICNN by a neural network. In our experiments, we find that the first parameterization gives more regular results, which aligns with the result in Bonet et al. (2021, Figure 4). However, it would be very difficult to calculate the density of pushforward distribution. Therefore, with the first parametrization, our method becomes a particle-based method, i.e. we cannot query density directly. As we discuss in Section D, when density evaluation is needed, we adopt the ICNN since we need to compute $T^{-1}$ . + +# 3.3 Computational complexity + +Each update $k$ in Algorithm 1 requires $O(J_{1}kMH)$ operations, where $J_{1}$ is the number of iterations per each JKO step, $M$ is the batch size, and $H$ is the size of the network. $k$ shows up in the bound because sampling $P_{k}$ requires us to pushforward $x_{0} \sim P_{0}$ through $k - 1$ maps. + +In contrast, Mokrov et al. (2021) requires $O\left(J_{1}\left((k + n)MH + n^{3}\right)\right)$ operations, which has a cubic dependence (Mokrov et al., 2021, Section 5) on dimension $n$ because they need to query the log det $\nabla^2\varphi$ in each iteration. There exists fast approximation (Huang et al., 2020) of log det $\nabla^2\varphi$ using Hutchinson trace estimator (Hutchinson, 1989). Alvarez-Melis et al. (2021) applies this technique, thus the cubic dependence on $n$ can be improved to quadratic dependence. Nonetheless, this is accompanied by an additional cost, which is the number of iterations to run conjugate gradient (CG) method. CG is guaranteed to converge exactly in $n$ steps in this setting. If one wants to obtain log det $\nabla^2\varphi$ precisely, the cost is still $O(n^{3})$ , which is the same as calculating log det $\nabla^2\varphi$ directly. If one uses an error $\epsilon$ stopping condition in CG, the complexity could be improved to $\sqrt{\kappa}\log (2 / \epsilon)n^{2}$ (Shewchuk et al., 1994), where $\kappa$ is the upper bound of condition number of $\nabla^2\varphi$ , but this would sacrifice on the accuracy. Given the similar neural network size, our method has the advantage of independence on the dimension for the training time. + +Other than training time, the complexity for evaluating the density has unavoidable dependence on $n$ due to the standard density evaluation process (see Section D). + +# 4 Theoretical results + +We introduce approximate $f$ -divergence notation and analyze its properties in this section. + +# 4.1 Approximate $f$ -divergence + +Given the results in Proposition 3.1, now we consider a restriction of the optimization domain $\mathcal{C}$ to a class of functions $\mathcal{H}$ , e.g. parametrized by neural networks, and define the new functional + +$$ +D _ {f} ^ {\mathcal {H}} (P \| Q) = \sup _ {h \in \mathcal {H}} \left\{\int h d P - \int f ^ {*} (h) d Q \right\}. +$$ + +This functional forms a surrogate for the exact $f$ -divergence. It is straightforward to see that the new function is always smaller than the exact $f$ -divergence, i.e. $D_f^{\mathcal{H}}(P\| Q) \leq D_f(P\| Q)$ where the inequality is achieved when $f'(\frac{dP}{dQ})$ belongs to $\mathcal{H}$ . In the following lemma, we establish some important theoretical properties of the approximate $f$ -divergence $D_f^{\mathcal{H}}(P\| Q)$ . In order to do so, we introduce the integral probability metric (Sriperumbudur et al., 2012; Arora et al., 2017) + +$$ +d _ {\mathcal {H}} (P, Q) = \sup _ {h \in \mathcal {H}} \frac {1}{\| h \| _ {2 , Q}} \left\{\int h d P - \int h d Q \right\}, +$$ + +where $\| h\|_{2,Q}^2 = \int h^2 dQ$ + +Proposition 4.1. The approximate $f$ -divergence $D_f^{\mathcal{H}}(P\| Q)$ satisfies the following properties: + +1. (positivity) If $\mathcal{H}$ contains all constant functions, then + +$$ +D _ {f} ^ {\mathcal {H}} (P \| Q) \geq 0, \quad \forall P, Q. +$$ + +2. (moment-matching) If for all $h \in \mathcal{H}$ , $c + \lambda h \in \mathcal{H}$ for $c, \lambda \in \mathbb{R}$ , then + +$$ +D _ {f} ^ {\mathcal {H}} (P \| Q) = 0 \Leftrightarrow \int h d P = \int h d Q, \forall h \in \mathcal {H}. +$$ + +3. (embedding inequalities) Additionally, if $f$ is strongly convex with constant $\alpha$ , and smooth with constant $L$ , then, + +$$ +\frac {\alpha}{2} d _ {\mathcal {H}} (P, Q) ^ {2} \leq D _ {f} ^ {\mathcal {H}} (P \| Q) \leq \frac {L}{2} d _ {\mathcal {H}} (P, Q) ^ {2}. +$$ + +The proposition has important implications. Part (1) establishes the condition under which the approximate $f$ -divergence is always positive. Part (2) identifies necessary and sufficient conditions under which the approximate divergence is zero for two given probability distributions $P$ and $Q$ . In particular, the divergence is zero iff the moments of $P$ and $Q$ are equal for all functions in the function class $\mathcal{H}$ . Finally, part (3) provides lower-bound and upper-bound for the approximate $f$ -divergence in terms of an integral probability metric defined on the function class $\mathcal{H}$ , implying that the + +two measures are equivalent when $f$ is both strongly convex and smooth. For example, a sequence $D_f^{\mathcal{H}}(P_d\| Q_d)\to 0$ as $d\to \infty$ iff $d_{\mathcal{H}}(P_d,Q_d)\to 0$ as $d\rightarrow \infty$ . Or if we are able to minimize the approximate $f$ -divergence $D_f^{\mathcal{H}}(P\| Q)$ with optimization gap $\epsilon$ , then the error in the moments of $P$ and $Q$ for functions in $\mathcal{H}$ is of order $O(\sqrt{\epsilon})$ . These results inform us that the proposed objective function of minimizing $D_f^{\mathcal{H}}(P\| Q)$ is meaningful and has geometrical significance. + +Remark 4.2. The assumption that $c + \lambda h \in \mathcal{H}$ for all $h \in \mathcal{H}$ and $c, \lambda \in \mathbb{R}$ holds for any neural network with linear activation function at the last layer. The assumption that $f$ is strongly convex and smooth may not hold for a typical $f$ such as $f(x) = x \log (x)$ over $(0, \infty)$ . However, It holds when the domain is restricted, which is true when either the samples are bounded or $h$ is bounded for all $h \in \mathcal{H}$ . + +# 4.2 Computational boundness + +It is also possible to obtain lower-bound for $D_f^{\mathcal{H}}(P\| Q)$ in terms of the exact $f$ -divergence $D_{f}(P\| Q)$ when the class $\mathcal{H}$ is rich enough. + +Proposition 4.3. If $f$ is $\alpha$ -strongly convex and the class of functions is able to approximate any function $h \in \mathcal{C}$ with $\tilde{h} \in \mathcal{H}$ such that $\| \tilde{h} - h \|_{2, Q} \leq \epsilon$ , then + +$$ +D _ {f} ^ {\mathcal {H}} (P \| Q) \geq D _ {f} (P \| Q) - \frac {\epsilon^ {2}}{2 \alpha}, \quad \forall P, Q. +$$ + +Proposition 4.3 gives upper-bound on the error between variational $f$ -divergence and the ground truth by the function class expressiveness, which can be verified for neural net function class. Assume $\mathcal{H}$ is the class of neural nets with an arbitrary depth under mild assumption on the activation function. Following the proof of Theorem 1 in Korotin et al. (2022), we can verify that for any $\epsilon > 0$ , compactly supported $Q$ , and function $\| h \|_{2,Q} < \infty$ , there exists a neural net $\tilde{h} \in \mathcal{H}$ such that $\| \tilde{h} - h \|_{2,Q} \leq \epsilon$ (c.f. discussion in Section A.3). However, Proposition 4.1-(3) and Proposition 4.3 require $f$ to be strongly convex, which might be too strong for some $f$ -divergences, such as KL divergence. + +Unlike the exact form of the $f$ -divergence, the variational formulation is well-defined for empirical distributions when the function class $\mathcal{H}$ is restricted and admits a finite Rademacher complexity. + +Proposition 4.4. Let $P^{(N)} = \frac{1}{N}\sum_{i=1}^{N}\delta_{X_i}$ , $Q^{(M)} = \frac{1}{M}\sum_{i=1}^{M}\delta_{Y_i}$ , where $\{X_i\}_{i=1}^N, \{Y_i\}_{i=1}^M$ are i.i.d samples from $P$ and $Q$ respectively. Then, it follows that + +$$ +\begin{array}{l} \mathbb {E} \left[ \left| D _ {f} ^ {\mathcal {H}} (P \| Q) - D _ {f} ^ {\mathcal {H}} \left(P ^ {(N)} \| Q ^ {(M)}\right) \right| \right] \\ \leq 2 \mathcal {R} _ {N} (\mathcal {H}, P) + 2 \mathcal {R} _ {M} (f ^ {*} \circ \mathcal {H}, Q), \\ \end{array} +$$ + +where the expectation is over the samples and $\mathcal{R}_N(\mathcal{H},P)$ denotes the Rademacher complexity of the function class $\mathcal{H}$ with respect to $P$ for sample size $N$ . + +Proposition 4.4 quantifies the generalization error in terms of Rademacher complexity. We leave the task of evaluating the Rademacher complexity for different function classes employed in this paper for future work. + +# 4.3 Convergence to spherical Gaussian distribution + +We assert the efficacy of JKO with variational estimation through a spherical Gaussian example. We consider sampling from the target distribution $Q = \mathcal{N}(\eta, I_n)$ by minimizing the functional $\mathcal{F}(P) = \mathcal{D}(P\|Q)$ . We choose $P_0 = \mu = \mathcal{N}(0, I_n)$ , and parameterize $T$ to be linear functions. Assume we get $T_0, \ldots, T_{K-1}$ by solving the particle approximated JKO in (14), and we can estimate $\mathbb{E}_{\mu}[h(\cdot)]$ precisely for simplicity. Denote $P_K$ as the $K$ -th JKO iteration $T_{K-1}\sharp(\ldots(T_0\sharp P_0))$ and $P_K^*$ as the ground truth solution of JKO. + +Proposition 4.5. Based on the assumptions in the paragraph above, let $P_K^{(N)} = \frac{1}{N}\sum_{i=1}^{N}\delta_{X_i}$ , where $\{X_i\}_{i=1}^N$ are i.i.d samples from $P_K$ . Then, it follows that + +$$ +\begin{array}{l} \mathbb {E} \left[ \left| \mathcal {D} ^ {\mathcal {H}} \left(P _ {K} ^ {*} \| Q\right) - \mathcal {D} ^ {\mathcal {H}} \left(P _ {K} ^ {(N)} \| Q\right) \right| \right] \\ \leq \frac {1}{2} \left(\Delta_ {N} + \sqrt {\xi_ {K , N} + 1 / N}\right) ^ {2} \\ \end{array} +$$ + +where $\Delta_N = \frac{\|\eta\|}{(1 + a)^K}$ + +$$ +\xi_ {K, N} = \left(\frac {a}{1 + a}\right) ^ {2} \frac {n}{N} \sum_ {j = 1} ^ {K} \frac {1}{(1 + a) ^ {2 (K - j)}}, +$$ + +and $\mathcal{H} \supseteq \{h : h(z) = \exp (\alpha^\top z + \gamma), \alpha \in \mathbb{R}^n, \gamma \in \mathbb{R}\}$ . + +This proposition quantifies the sample complexity and convergence rate of JKO with our variational estimation for a spherical Gaussian example. In the future, it would be useful to analyze the stability and convergence of the proposed min-max formulation for more general functional $\mathcal{F}(P)$ , both at the level of densities and at the level of samples/particles. + +# 5 Numerical examples + +In this section, we present several numerical examples to illustrate our algorithm. We mainly compare with the JKO-ICNN-d (Mokrov et al., 2021), JKO-ICNN-a (Alvarez-Melis et al., 2021). The difference between JKO-ICNN-d and JKO-ICNN-a is that the former computes the log det $(\nabla^2\varphi)$ directly and the latter adopts fast approximation. We use the default hyper-parameters in the authors' implementation. Our code is written in PyTorch-lightning and is publicly available at https://github.com/sbyebss/variational_wgf. + +# 5.1 Sampling from Gaussian Mixture Model + +We first consider the sampling problem to sample from a target distribution $Q$ . Note that $Q$ doesn't have to be nor- + +malized. To this end, we consider the Wasserstein gradient flow with objective function $\mathcal{F}(P) = \mathcal{D}(P\| Q)$ , that is, the KL divergence between distributions $P$ and $Q$ . When this objective is minimized, $P \propto Q$ . In our experiments, we consider the Gaussian mixture model (GMM) with 10 equal-weighted spherical Gaussian components. The mean of Gaussian components are randomly uniformly sampled inside a cube. The step size is set to be $a = 0.1$ and the initial measure is a spherical Gaussian $\mathcal{N}(0,16I_n)$ . In Figure 1, we show our generated samples are in concordance with the target measure. + +![](images/f06f1f03579e5ea0fbcf028c3fdf0f430e21adffb53c1f699210dd7855de8bcb.jpg) +(a) Dimension $n = 64$ + +![](images/96808aaa9722c22909f5ad815b3b6719d506ff70e87c5a7152888e48d95f8dce.jpg) +(b) Dimension $n = 128$ + +![](images/8c11e661b858e34bed0fb81e557dde1609ec0c532197ffd265d47abe9aa6ac3e.jpg) +Figure 1: Comparison between the target GMM and fitted measure of generated samples by our method. Samples are projected onto 2D plane by performing PCA. +Figure 2: Averaged training time (in minutes) of 40 JKO steps for sampling from GMM. +Figure 4: (a): We repeat the experiments for 15 times and compare the SymKL (Mokrov et al., 2021) between estimated distribution and the ground truth at $k = 18$ in OU process. (b): We show the comparison between our estimated $\mathcal{D}(P_k\| Q)$ and the ground truth in dimension $n = 64$ . They align with each other pretty well. + +In Figure 2, we plot the averaged training time of 5 runs for all compared methods. Note that we fix the number of conjugate descent steps to be at most 10 when approximating $\log \det \nabla^2\varphi$ in JKO-ICNN-a. That's why JKO-ICNN-d and JKO-ICNN-a have quite similar training time when $n < 10$ . + +To investigate the performance under the constraint of similar training time, we perform 40 JKO steps with our method + +![](images/04569c47483fbcb42524386b91055aaf43e82fe8c97f3542370699a6a6332679.jpg) +(a) $\log_{10}\mathrm{KSD}$ + +![](images/83a05009bf6f6b32834a87c6cc0505ff6c5b0d9fcf723765cc4bdb41cf7f6fd6.jpg) +(b) Objective functional +Figure 3: (a) We perform experiments in $n = 2,4,8,15,24,32$ for all methods and additionally $n = 64,128$ for our method. With the constraint of similar training time, our method gives smaller error in high dimension. (b) With the variational formula, we use only samples to estimate the objective functional $\mathcal{D}(P_k\| Q)$ in dimension $n = 64$ . It converges to the ideal objective minimum $\mathcal{D}(P_{\infty}\| Q) = 0$ . + +and the same for JKO-ICNN methods except for $n \geq 15$ , where we only let them run for 20, 15, 12 JKO steps for $n = 15, 24, 32$ respectively. In doing so, one can verify the training time of our method and JKO-ICNN is roughly consistent. We only report the accuracy results of JKO-ICNN-d for $n < 10$ in Figure 3 since it's prone to give higher accuracy than JKO-ICNN-a considering nearly the same training time in low dimension. We select Kernalized Stein Divergence (KSD) (Liu et al., 2016) as the error criteria because it only requires samples to estimate the divergence, which is useful in the sampling task. + +# 5.2 Ornstein-Uhlenbeck Process + +![](images/3f4cba88b5e24b275b7774fa20cceeede7d7bfe1ec7bc91104884d80930f7e21.jpg) +(a) $\log_{10}\mathrm{SymKL}$ + +![](images/ef36fe204a1cbc075fd32eb68c6337ce9989b8b86fba9ea57e953d785aeeec35.jpg) +(b) Objective functional + +We study the performance of our method in modeling the Ornstein-Uhlenbeck Process as dimension grows. The gradient flow is affiliated with the free energy (2), where $Q = e^{(x - b)^{\mathrm{T}}A(x - b) / 2}$ with a positive definite matrix $A\in \mathbb{R}^n\times \mathbb{R}^n$ and $b\in \mathbb{R}^n$ . Given an initial Gaussian distribution + +Table 2: Bayesian logistic regression accuracy and log-likelihood results. + +
DatasetAccuracyLog-Likelihood
OursJKO-ICNNOursJKO-ICNN
covtype0.7530.75-0.528-0.515
splice0.840.845-0.38-0.36
waveform0.7850.78-0.455-0.485
twonorm0.9820.98-0.056-0.059
ringnorm0.730.74-0.5-0.5
german0.670.67-0.59-0.6
image0.8660.82-0.394-0.43
diabetis0.7860.775-0.45-0.45
banana0.550.55-0.69-0.69
+ +$\mathcal{N}(0, I_n)$ , the gradient flow at each time $t$ is a Gaussian distribution $P_t$ with mean vector + +$$ +\mu_ {t} = \left(I _ {n} - e ^ {- A t}\right) b +$$ + +and covariance (Vatiwutipong & Phewchean, 2019) + +$$ +\Sigma_ {t} = A ^ {- 1} (I _ {n} - e ^ {- 2 A t}) + e ^ {- 2 A t}. +$$ + +We choose JKO step size $a = 0.05$ . We only present JKO-ICNN-d accuracy results because JKO-ICNN-a has the similar or slightly worse performance. + +There could be several reasons why we have better performance. 1) The proposed distribution $\mu$ is Gaussian, which is consistent with $P_{t}$ for any $t$ . This is beneficial for the inner maximization to find a precise $h$ . 2) Parameterizing $T$ as a neural network instead of gradient of ICNN is handier for optimization in this toy example. + +We also compare the training time per every two JKO steps with JKO-ICNN method. The computation time for JKO-ICNN-d is around $25s$ when $n = 2$ and increases to $105s$ when $n = 32$ . JKO-ICNN-a has slightly better scalability, which increases from $25s$ to $95s$ . Our method's training time remains at $22s \pm 5s$ for all the dimensions $n = 2 \sim 32$ . This is due to the fact that we fix the neural network size for both methods and our method's computation complexity does not depend on the dimension. + +# 5.3 Bayesian Logistic Regression + +To evaluate our method on a real-world dataset, we consider the bayesian logistic regression task with the same setting in Gershman et al. (2012). Given a dataset $\mathcal{L} = \{l_1,\dots ,l_S\}$ , a model with parameters $x\in \mathbb{R}^n$ and the prior distribution $p_0(x)$ , our target is to sample from the posterior distribution + +$$ +p (x | \mathcal {L}) \propto p _ {0} (x) p (\mathcal {L} | x) = p _ {0} (x) \cdot \prod_ {s = 1} ^ {S} p \left(l _ {s} | x\right). +$$ + +To this end, we let the target distribution $Q(x) = p_0(x)p(\mathcal{L}|x)$ and choose $\mathcal{F}(P)$ equal to $\mathcal{D}(P\|Q)$ . The parameter $x$ takes the form of $[\omega, \log \alpha]$ , where $\omega \in \mathbb{R}^{n-1}$ is the regression weights with the prior $p_0(\omega|\alpha) = \mathcal{N}(\omega, \alpha^{-1})$ . $\alpha$ is a scalar with the prior $p_0(\alpha) = \mathrm{Gamma}(\alpha|1,0.01)$ . We test on 8 relatively small datasets $(S \leq 7400)$ from Mika et al. (1999) and one large Cover-type dataset $(S = 0.58\mathrm{M})$ . The dataset is randomly split into training dataset and test dataset according to the ratio 4:1. The number of features scales from 2 to 60. From Table 2, we can tell that our method achieves a comparable performance as the other. The results of JKO-ICNN-d are adapted from Mokrov et al. (2021, Table 1). We present the datasets properties and comparison with another popular sampling method SVGD (Liu & Wang, 2016) in Table 5 in the Appendix. + +# 5.4 Porous media equation + +![](images/a380a525fbf464909851725a9549e28f3955595e853a0113dca288c493ba55fd.jpg) +Figure 5: SymKL with respect to the Barenblatt profile ground truth in 50 JKO steps. + +![](images/a9f94880db188a54c37e1e8575a456c4758aac5b53306ecd86ebf6766d7e0380.jpg) +(a) Dimension $n = 3$ + +![](images/36fc2d8aadc494e0055106cee2555f3bb4563572a33fa005bc82528bec41e0d0.jpg) +(b) Dimension $n = 6$ +Figure 6: We use variational formula to calculate the objective functional $\mathcal{G}(P)$ with samples and compare it with ground truth. + +We next consider the porous media equation with only diffusion: $\partial_t P = \Delta P^m$ . This is the Wasserstein gradient flow associated with the energy function $\mathcal{F}(P) = \mathcal{G}(P)$ . A representative closed-form solution of the porous media equation is the Barenblatt profile (GI, 1952; Vázquez, 2007) + +$$ +P (t, x) = \left(t + t _ {0}\right) ^ {- \alpha} \left(C - \beta \| x - x _ {0} \| ^ {2} \left(t + t _ {0}\right) ^ {\frac {- 2 \alpha}{n}}\right) _ {+} ^ {\frac {1}{m - 1}}, +$$ + +where $\alpha = \frac{n}{n(m - 1) + 2}$ , $\beta = \frac{(m - 1)\alpha}{2mn}$ , $t_0 > 0$ is the starting time, and $C > 0$ is a free parameter. In the experi + +ments, we set $m = 2$ , the stepsize for the JKO scheme to be $a = 0.0005$ and the initial time to be $t_0 = 0.001$ . We parametrize the transport map $T$ as the gradient of an ICNN and thus we can evaluate the density following Section D. From Figure 5, we observe that our method can give stable simulation results, where the error is controlled in a small region as diffusion time increases. + +# 5.5 Gradient flow on images + +![](images/927a5dc8110fabbf3d6419cfc2a935a81388cf9d04f6e63c487b885b5f64d2a3.jpg) + +![](images/aa7fa7832ae601c76c73db2ed7818a376162b412ebf4f6d73a34d5e98fbd7d66.jpg) + +![](images/5e69cd497dc13b3022ab9a515521c6528579ec8a45c7190b99233abecab20378.jpg) +(a) Trajectory + +![](images/2914cc33419e8fd3371045fc10dea247c5cc059a1d8a28fa129f93516bdd4f98.jpg) +(b) Uncurated samples +Figure 7: With Wasserstein gradient flow scheme, we visualize (a): trajectories of the generated samples from JKO-Flow and (b): 100 uncurated samples from $P_{K}$ . + +In this section, we illustrate the scalability of our algorithm to high-dimensional setting by applying our scheme on real image datasets, where only samples from $Q$ are accessible. With the variational formula (11), Algorithm 1 can be adapted to model gradient flow in image space. Specifically, we choose $\mathcal{F}(P)$ to be $\mathrm{JSD}(P\| Q)$ and $P_0 = \mathcal{N}(0,I_n)$ . We name the resulted model JKO-Flow. Note JKO-Flow model specializes to GAN (Goodfellow et al., 2014) when $a\to \infty$ and $K = 1$ . Thanks to the additional Wasserstein loss regularization, JKO-Flow enjoys stable training and suffer less from mode collapsing empirically. We evaluate JKO-Flow on popular MNIST (LeCun et al., 1998) and CIFAR10 (Krizhevsky et al., 2009) datasets. Figure 7 shows samples and their trajectories starting from $P_0$ to $P_K$ and demonstrates JKO-Flow can approximate Wasserstein gradient flow in image space empirically. To further quantify the performance of JKO-Flow, we measure discrepancy between $P_K$ and real distribution with the popular sample metric, Fenchel Inception Distance (Heusel et al., 2017) in Table 3. We also compare our method with normalizing flow (NF), which also consists of a sequence of forward mapping. + +Table 3: Results of Gradient flow (GF) based methods, GAN methods and normalizing flow (NF) on unconditional CIFAR10 dataset. + +
MethodFID score ↓
NFGLOW (Kingma & Dhariwal, 2018)45.99
GFVGrow (Gao et al., 2019)28.8
JKO-Flow23.1
GANsWGAN-GP (Arbel et al., 2018)31.1
SN-GAN (Miyato et al., 2018)21.7
+ +However, the invertible property of NF either requires heavy calculations (e.g. evaluating matrix determinant or solving Neural ODE) or special network structures that limit the expressiveness of NNs. We include more comparison and experiments details in Section G. + +# 6 Conclusion + +In this paper, we presented a numerical procedure to implement the Wasserstein gradient flow for objective functions in the form of $f$ -divergence. Our procedure is based on applying the JKO scheme on a variational formulation of the $f$ -divergence. Each step involves solving a minimax stochastic optimization problem for a transport map and a dual function that are parameterized by neural networks. We demonstrated the scalability of our approach to high-dimensional problems through numerical experiments on Gaussian mixture models and real datasets including MNIST and CIFAR10. We also provided preliminary theoretical results regarding the variational objective function. The results show that minimizing the variational objective is meaningful and serve as starting point for future research. Our method can also be adapted to Crank-Nicolson type scheme, which enjoys a faster convergence (Carrillo et al., 2021) in step size $a$ than the classical JKO scheme (see Section B). One restriction of our method is that it is only applicable to $f$ -divergence, thus a possible direction for future research is to extend the variational formulation beyond $f$ -divergence. Another limitation is that the min-max training is both theoretically and numerically more challenging than a single minimization. + +# Acknowledgement + +The authors would like to thank the anonymous reviewers for useful comments. JF, QZ, and YC are supported in part by grants NSF CAREER ECCS-1942523, NSF ECCS-1901599, and NSF CCF-2008513. + +# References + +Adams, S., Dirr, N., Peletier, M. A., and Zimmer, J. From a large-deviations principle to the Wasserstein gradient flow: a new micro-macro passage. Communications in Mathematical Physics, 307(3):791-815, 2011. (Cited on page 1.) +Alvarez-Melis, D., Schiff, Y., and Mroueh, Y. Optimizing functionals on the space of probabilities with input convex neural networks. arXiv preprint arXiv:2106.00774, 2021. (Cited on pages 1, 2, 3, 5, 6, 18, 19, and 21.) +Ambrosio, L., Gigli, N., and Savaré, G. Gradient flows: in metric spaces and in the space of probability measures. Springer Science & Business Media, 2008. (Cited on pages 1 and 3.) +Amos, B., Xu, L., and Kolter, J. Z. Input convex neural networks. In International Conference on Machine Learning, pp. 146-155. PMLR, 2017. (Cited on pages 1 and 3.) +An, D., Guo, Y., Lei, N., Luo, Z., Yau, S.-T., and Gu, X. Ae-ot: a new generative model based on extended semidiscrete optimal transport. *ICLR* 2020, 2019. (Cited on pages 26 and 27.) +An, D., Guo, Y., Zhang, M., Qi, X., Lei, N., and Gu, X. Ae-ot-gan: Training gans from data specific latent distribution. In European Conference on Computer Vision, pp. 548-564. Springer, 2020. (Cited on pages 26 and 27.) +Arbel, M., Sutherland, D. J., Binkowski, M. a., and Gretton, A. On gradient regularizers for mmd gans. In Bengio, S., Wallach, H., Larochelle, H., Grauman, K., Cesa-Bianchi, N., and Garnett, R. (eds.), Advances in Neural Information Processing Systems, volume 31. Curran Associates, Inc., 2018. URL https://proceedings.neurips.cc/paper/2018/file/07f75d9144912970de5a09f5a305e10c-Paper.pdf. (Cited on page 9.) +Arora, S., Ge, R., Liang, Y., Ma, T., and Zhang, Y. Generalization and equilibrium in generative adversarial nets (gans). In International Conference on Machine Learning, pp. 224-232. PMLR, 2017. (Cited on page 5.) +Benamou, J.-D., Carlier, G., Mérigot, Q., and Oudet, E. Discretization of functionals involving the monge-ampère operator. Numerische mathematik, 134(3):611-636, 2016. (Cited on pages 1 and 2.) +Bernton, E. Langevin monte carlo and jko splitting. In Conference On Learning Theory, pp. 1777-1798. PMLR, 2018. (Cited on page 1.) +Biewald, L. Experiment tracking with weights and biases, 2020. URL https://www.wandb.com/. Software available from wandb.com. (Cited on page 22.) + +Bonet, C., Courty, N., Septier, F., and Drumetz, L. Sliced-wasserstein gradient flows. arXiv preprint arXiv:2110.10972, 2021. (Cited on pages 1, 2, 5, and 22.) +Brenier, Y. Polar factorization and monotone rearrangement of vector-valued functions. Communications on pure and applied mathematics, 44(4):375-417, 1991. (Cited on page 3.) +Bunne, C., Meng-Papaxanthos, L., Krause, A., and Cuturi, M. Jkonet: Proximal optimal transport modeling of population dynamics. arXiv preprint arXiv:2106.06345, 2021. (Cited on pages 1, 2, and 3.) +Carlier, G., Duval, V., Peyre, G., and Schmitzer, B. Convergence of entropic schemes for optimal transport and gradient flows. SIAM Journal on Mathematical Analysis, 49(2):1385-1418, 2017. (Cited on pages 1 and 2.) +Carrillo, J. A., Craig, K., and Patachini, F. S. A blob method for diffusion. *Calculus of Variations and Partial Differential Equations*, 58(2):1-53, 2019a. (Cited on page 2.) +Carrillo, J. A., Hittmeir, S., Volzone, B., and Yao, Y. Nonlinear aggregation-diffusion equations: radial symmetry and long time asymptotics. Inventiones mathematicae, 218(3):889-977, 2019b. (Cited on page 20.) +Carrillo, J. A., Craig, K., Wang, L., and Wei, C. Primal dual methods for Wasserstein gradient flows. Foundations of Computational Mathematics, pp. 1-55, 2021. (Cited on pages 1, 2, 9, 18, 19, 20, and 21.) +Cheng, X. and Bartlett, P. Convergence of Langevin mcmc in kl-divergence. In Algorithmic Learning Theory, pp. 186-211. PMLR, 2018. (Cited on page 1.) +Eckhardt, R., Ulam, S., and Von Neumann, J. the monte carlo method. Los Alamos Science, 15:131, 1987. (Cited on page 24.) +Falcon, W. and Cho, K. A framework for contrastive self-supervised learning and designing a new approach. arXiv preprint arXiv:2009.00104, 2020. (Cited on page 22.) +Fan, J., Taghvaei, A., and Chen, Y. Scalable computations of Wasserstein barycenter via input convex neural networks. arXiv preprint arXiv:2007.04462, 2020. (Cited on page 5.) +Fan, J., Liu, S., Ma, S., Chen, Y., and Zhou, H. Scalable computation of monge maps with general costs. arXiv preprint arXiv:2106.03812, 2021. (Cited on page 5.) +Folland, G. B. Real analysis: modern techniques and their applications, volume 40. John Wiley & Sons, 1999. (Cited on page 16.) + +Frogner, C. and Poggio, T. Approximate inference with Wasserstein gradient flows. In International Conference on Artificial Intelligence and Statistics, pp. 2581-2590. PMLR, 2020. (Cited on pages 1 and 2.) +Gao, Y., Jiao, Y., Wang, Y., Wang, Y., Yang, C., and Zhang, S. Deep generative learning via variational gradient flow. In International Conference on Machine Learning, pp. 2093-2101. PMLR, 2019. (Cited on pages 4 and 9.) +Gershman, S., Hoffman, M., and Blei, D. Nonparametric variational inference. arXiv preprint arXiv:1206.4665, 2012. (Cited on page 8.) +GI, B. On some unsteady motions of a liquid and gas in a porous medium. *Prikl. Mat. Mekh.*, 16:67-78, 1952. (Cited on page 8.) +Goodfellow, I., Pouget-Abadie, J., Mirza, M., Xu, B., Warde-Farley, D., Ozair, S., Courville, A., and Bengio, Y. Generative adversarial nets. Advances in neural information processing systems, 27, 2014. (Cited on page 9.) +He, K., Zhang, X., Ren, S., and Sun, J. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770-778, 2016. (Cited on page 25.) +Heusel, M., Ramsauer, H., Unterthiner, T., Nessler, B., and Hochreiter, S. Gans trained by a two time-scale update rule converge to a local nash equilibrium. Advances in neural information processing systems, 30, 2017. (Cited on page 9.) +Huang, C.-W., Chen, R. T., Tsirigotis, C., and Courville, A. Convex potential flows: Universal probability distributions with optimal transport and convex optimization. arXiv preprint arXiv:2012.05942, 2020. (Cited on pages 5 and 22.) +Hutchinson, M. F. A stochastic estimator of the trace of the influence matrix for laplacian smoothing splines. Communications in Statistics-Simulation and Computation, 18(3):1059-1076, 1989. (Cited on page 5.) +Hwang, H. J., Kim, C., Park, M. S., and Son, H. The deep minimizing movement scheme. arXiv preprint arXiv:2109.14851, 2021. (Cited on page 2.) +Jordan, R., Kinderlehrer, D., and Otto, F. The variational formulation of the Fokker-Planck equation. SIAM journal on mathematical analysis, 29(1):1-17, 1998. (Cited on pages 1 and 3.) +Kidger, P. and Lyons, T. Universal approximation with deep narrow networks. In Conference on learning theory, pp. 2306-2327. PMLR, 2020. (Cited on page 16.) + +Kingma, D. P. and Dhariwal, P. Glow: Generative flow with invertible 1x1 convolutions. Advances in neural information processing systems, 31, 2018. (Cited on page 9.) +Korotin, A., Egiazarian, V., Asadulaev, A., Safin, A., and Burnaev, E. Wasserstein-2 generative networks. In International Conference on Learning Representations, 2021a. URL https://openreview.net/forum?id=bEoxzW_EXsa. (Cited on pages 5, 24, and 27.) +Korotin, A., Li, L., Solomon, J., and Burnaev, E. Continuous Wasserstein-2 barycenter estimation without minimax optimization. In International Conference on Learning Representations, 2021b. URL https://openreview.net/forum?id=3tFAs5E-Pe. (Cited on page 5.) +Korotin, A., Selikhanovych, D., and Burnaev, E. Neural optimal transport. *ArXiv*, abs/2201.12220, 2022. (Cited on pages 6 and 16.) +Krizhevsky, A., Hinton, G., et al. Learning multiple layers of features from tiny images. 2009. (Cited on page 9.) +LeCun, Y., Bottou, L., Bengio, Y., and Haffner, P. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278-2324, 1998. (Cited on page 9.) +Li, W., Lu, J., and Wang, L. Fisher information regularization schemes for Wasserstein gradient flows. Journal of Computational Physics, 416:109449, 2020. (Cited on pages 1 and 2.) +Lin, A. T., Li, W., Osher, S., and Montúfar, G. Wasserstein proximal of gans. In International Conference on Geometric Science of Information, pp. 524-533. Springer, 2021. (Cited on page 1.) +Liu, Q. and Wang, D. Stein variational gradient descent: A general purpose bayesian inference algorithm. In Lee, D., Sugiyama, M., Luxburg, U., Guyon, I., and Garnett, R. (eds.), Advances in Neural Information Processing Systems, volume 29. Curran Associates, Inc., 2016. URL https://proceedings.neurips.cc/paper/2016/file/b3ba8f1bee1238a2f37603d90b58898d-Paper.pdf. (Cited on page 8.) +Liu, Q., Lee, J., and Jordan, M. A kernelized stein discrepancy for goodness-of-fit tests. In International conference on machine learning, pp. 276-284. PMLR, 2016. (Cited on pages 7 and 23.) +MacKay, D. J. and Mac Kay, D. J. Information theory, inference and learning algorithms. Cambridge university press, 2003. (Cited on page 24.) + +Makkuva, A., Taghvaei, A., Oh, S., and Lee, J. Optimal transport mapping via input convex neural networks. In International Conference on Machine Learning, pp. 6672-6681. PMLR, 2020. (Cited on pages 5 and 26.) +Mika, S., Ratsch, G., Weston, J., Scholkopf, B., and Mullers, K.-R. Fisher discriminant analysis with kernels. In Neural networks for signal processing IX: Proceedings of the 1999 IEEE signal processing society workshop (cat. no. 98th8468), pp. 41-48. IEEE, 1999. (Cited on page 8.) +Miyato, T., Kataoka, T., Koyama, M., and Yoshida, Y. Spectral normalization for generative adversarial networks. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id=B1QRgziT-. (Cited on pages 9 and 25.) +Mokrov, P., Korotin, A., Li, L., Geneva, A., Solomon, J., and Burnaev, E. Large-scale wasserstein gradient flows. In Thirty-Fifth Conference on Neural Information Processing Systems, 2021. URL https://openreview.net/forum?id=nLjIuHsMHp. (Cited on pages 1, 2, 3, 5, 6, 7, 8, 18, 21, 22, 23, and 24.) +Nguyen, X., Wainwright, M. J., and Jordan, M. I. Estimating divergence functionals and the likelihood ratio by convex risk minimization. IEEE Transactions on Information Theory, 56(11):5847-5861, 2010. (Cited on page 3.) +Nowozin, S., Cseke, B., and Tomioka, R. f-gan: Training generative neural samplers using variational divergence minimization. In Proceedings of the 30th International Conference on Neural Information Processing Systems, pp. 271-279, 2016. (Cited on pages 1 and 15.) +Otto, F. The geometry of dissipative evolution equations: the porous medium equation. 2001. (Cited on pages 1 and 3.) +Peyre, G. Entropic approximation of Wasserstein gradient flows. SIAM Journal on Imaging Sciences, 8(4):2323-2351, 2015. (Cited on pages 1 and 2.) +Ronneberger, O., Fischer, P., and Brox, T. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pp. 234-241. Springer, 2015. (Cited on page 25.) +Rout, L., Korotin, A., and Burnaev, E. Generative modeling with optimal transport maps. arXiv preprint arXiv:2110.02999, 2021. (Cited on pages 5 and 27.) +Salim, A., Korba, A., and Luise, G. The Wasserstein proximal gradient algorithm. arXiv preprint arXiv:2002.03035, 2020. (Cited on page 19.) + +Salimans, T., Karpathy, A., Chen, X., and Kingma, D. P. PixelCNN++: Improving the pixelCNN with discretized logistic mixture likelihood and other modifications. arXiv preprint arXiv:1701.05517, 2017. (Cited on page 25.) +Santambrogio, F. Euclidean, metric, and wasserstein gradient flows: an overview. Bulletin of Mathematical Sciences, 7(1):87-154, 2017. (Cited on page 1.) +Seguy, V., Damodaran, B. B., Flamary, R., Courty, N., Rolet, A., and Blondel, M. Large-scale optimal transport and mapping estimation. arXiv preprint arXiv:1711.02283, 2017. (Cited on page 26.) +Shewchuk, J. R. et al. An introduction to the conjugate gradient method without the agonizing pain, 1994. (Cited on page 5.) +Sriperumbudur, B. K., Fukumizu, K., Gretton, A., Schölkopf, B., and Lanckriet, G. R. On the empirical estimation of integral probability metrics. *Electronic Journal of Statistics*, 6:1550–1599, 2012. (Cited on page 5.) +Vatiwutipong, P. and Phewchean, N. Alternative way to derive the distribution of the multivariate ornstein-uhlenbeck process. Advances in Difference Equations, 2019(1):1-7, 2019. (Cited on page 8.) +Vázquez, J. L. The porous medium equation: mathematical theory. Oxford University Press on Demand, 2007. (Cited on pages 3 and 8.) +Villani, C. Topics in optimal transportation. Number 58. American Mathematical Soc., 2003. (Cited on page 3.) +Wan, N., Li, D., and Hovakimyan, N. f-divergence variational inference. Advances in Neural Information Processing Systems, 33, 2020. (Cited on page 2.) +Waskom, M. L. seaborn: statistical data visualization. Journal of Open Source Software, 6(60):3021, 2021. doi: 10.21105/joss.03021. URL https://doi.org/10.21105/joss.03021. (Cited on page 22.) +Wellner, J. A. Empirical processes: Theory and applications. Notes for a course given at Delft University of Technology, 2005. (Cited on page 17.) +Wibisono, A. Sampling as optimization in the space of measures: The Langevin dynamics as a composite optimization problem. In Conference on Learning Theory, pp. 2093-3027. PMLR, 2018. (Cited on page 1.) +Yadan, O. Hydra - a framework for elegantly configuring complex applications. *GibHub*, 2019. URL https://github.com/facebookresearch/hydra. (Cited on page 22.) + +Yang, Z., Zhang, Y., Chen, Y., and Wang, Z. Variational transport: A convergent particle-based algorithm for distributional optimization. arXiv preprint arXiv:2012.11554, 2020. (Cited on pages 1 and 2.) +Zagoruyko, S. and Komodakis, N. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016. (Cited on page 25.) + +The appendix is structured as follows. In Section A, we provide the proofs of Corollaries in Section 3.1 and the theoretical results in Section 4. In Section B, we give a Crank-Nicolson-typed extension of our method for a faster convergence with respect to the step size $a$ . In Section C, we consider the case where the target functional $\mathcal{F}(P)$ involves the interaction energy, and propose to use forward-backward scheme to solve the Wasserstein GF. In Section D, for the sake of completeness, we discuss how to evaluate the probability density of each JKO step $P_{k}$ . In Section E, we provide additional experimental results and discussions, such as the computational time. In Section F, we provide the training details of experiments other than image generation. In Section 5.5, we provide the training details and discussions of image generation experiment. + +# A Proofs + +# A.1 Proof of variational formulas in Section 3.1 + +# A.1.1 KL DIVERGENCE + +The KL divergence is the special instance of the $f$ -divergence obtained by replacing $f$ with $f_{1}(x) = x \log x$ in (6) + +$$ +D _ {f _ {1}} (P \| Q) = \mathbb {E} _ {Q} \left[ \frac {P}{Q} \log \frac {P}{Q} \right] = \mathbb {E} _ {P} \left[ \log \frac {P}{Q} \right], +$$ + +which, according to (7), admits the variational formulation + +$$ +D _ {f _ {1}} (P \| Q) = 1 + \sup _ {h} \mathbb {E} _ {P} [ h (X) ] - \mathbb {E} _ {Q} \left[ e ^ {h (Z)} \right] \tag {12} +$$ + +where the convex conjugate $f_1^*(y) = e^{y - 1}$ and a change of variable $h \to h - 1$ are used. + +The variational formulation can be approximated in terms of samples from $P$ and $Q$ . For the case where we have only access to un-normalized density of $Q$ , which is the case for the sampling problem, we use the following change of variable: $h \to \log(h) + \log(\mu) - \log(Q)$ where $\mu$ is a user designed distribution which is easy to sample from. Under such a change of variable, the variational formulation reads + +$$ +D _ {f _ {1}} (P \| Q) = 1 + \sup _ {h} \mathbb {E} _ {P} \left[ \log h (X) + \log \frac {\mu (X)}{Q (X)} \right] - \mathbb {E} _ {\mu} [ h (Z) ]. +$$ + +Note that the optimal function $h$ is equal to the ratio between the densities of $T_{k} \sharp P_{k}$ and $\mu$ . Using this variational form in the JKO scheme (5) yields $P_{k + 1} = T_k \sharp P_k$ and + +$$ +T _ {k} = \underset {T} {\arg \min } \underset {h} {\max } \mathbb {E} _ {P _ {k}} \left[ \frac {\| X - T (X) \| ^ {2}}{2 a} + \log h (T (X)) + \log \frac {\mu (T (X))}{Q (T (X))} \right] - \mathbb {E} _ {\mu} [ h (Z) ]. \tag {13} +$$ + +Based on particle approximation, the implementable JKO is + +$$ +T _ {k} = \arg \min _ {T} \max _ {h} \frac {1}{N} \sum_ {i = 1} ^ {N} \left[ \frac {\| X _ {i} ^ {(k)} - T \left(X _ {i} ^ {(k)}\right) \| ^ {2}}{2 a} + \log h \left(T \left(X _ {i} ^ {(k)}\right)\right) + \log \frac {\mu \left(T \left(X _ {i} ^ {(k)}\right)\right)}{Q \left(T \left(X _ {i} ^ {(k)}\right)\right)} \right] - \mathbb {E} _ {\mu} [ h (Z) ]. \tag {14} +$$ + +Remark A.1. The Donsker-Varadhan formula + +$$ +\mathcal {D} (P \| Q) = \sup _ {h} \mathbb {E} _ {P} \left[ h (X) \right] - \log \mathbb {E} _ {Q} \left[ e ^ {h (Z)} \right] +$$ + +is another variational representation of KL divergence and it's a stronger than (12) because it's a upper bound of (12) for any fixed $h$ . However, we cannot get an unbiased estimation of the objective using samples. + +# A.1.2 GENERALIZED ENTROPY + +The generalized entropy can be also represented as $f$ -divergence. In particular, let $f_{2}(x) = \frac{1}{m - 1} (x^{m} - x)$ and let $Q$ be the uniform distribution on a set which is the superset of the support of density $P(x)$ and has volume $\Omega$ . Then + +$$ +D _ {f _ {2}} (P \| Q) = \frac {\Omega^ {m - 1}}{m - 1} \int P ^ {m} (x) d x - \frac {1}{m - 1}. +$$ + +As a result, the generalized entropy can be expressed in terms of $f$ -divergence according to + +$$ +\mathcal {G} (P) = \frac {1}{m - 1} \int P ^ {m} (x) d x = \frac {1}{\Omega^ {m - 1}} D _ {f _ {2}} (P \| Q) + \frac {1}{\Omega^ {m - 1} (m - 1)}. +$$ + +Upon using the variational representation of the $f$ -divergence with + +$$ +f _ {2} ^ {*} (y) = \left(\frac {(m - 1) y + 1}{m}\right) ^ {\frac {m}{m - 1}}, +$$ + +the generalized entropy admits the following variational formulation + +$$ +\mathcal {G} (P) = \sup _ {h} \frac {1}{\Omega^ {m - 1}} \left(\mathbb {E} _ {P} [ h (X) ] - \mathbb {E} _ {Q} \left[ \left(\frac {(m - 1) h (Z) + 1}{m}\right) ^ {\frac {m}{m - 1}} \right]\right) + \frac {1}{\Omega^ {m - 1} (m - 1)}. +$$ + +In practice, we find it numerically useful to let $h = \frac{1}{m - 1}\left[m\left(\hat{h}\right)^{m - 1} - 1\right]$ so that + +$$ +\mathcal {G} (P) = \frac {1}{\Omega^ {m - 1}} \sup _ {\hat {h}} \left(\mathbb {E} _ {P _ {k}} \left[ \frac {m}{m - 1} \hat {h} ^ {m - 1} (X) \right] - \mathbb {E} _ {Q} \left[ \hat {h} ^ {m} (Z) \right]\right). +$$ + +With such a change of variable, the optimal function $\hat{h} = T\sharp P_k / Q$ . Using this in the JKO scheme yields $P_{k + 1} = T_k\sharp P_k$ and + +$$ +T _ {k} = \arg \min _ {T} \max _ {h} \frac {1}{2 a} \mathbb {E} _ {P _ {k}} \| X - T (X) \| ^ {2} + \frac {1}{\Omega^ {m - 1}} \left(\mathbb {E} _ {P _ {k}} \left[ \frac {m}{m - 1} h ^ {m - 1} (X) \right] - \mathbb {E} _ {Q} \left[ h ^ {m} (Z) \right]\right). +$$ + +# A.1.3 JENSEN-SHANNON DIVERGENCE + +Jensen-Shannon divergence has been widely studied in GAN literature (Nowozin et al., 2016). The variational formula follows that $f(x) = -(x + 1)\log ((1 + x) / 2) + x\log x$ and $f^{*}(y) = -\log (2 - \exp (y))$ . Plugging in the variational formula in the JKO scheme gives + +$$ +T _ {k} = \underset {T} {\arg \min} \max _ {h} \frac {1}{2 a} \mathbb {E} _ {P _ {k}} \| X - T (X) \| ^ {2} + \mathbb {E} _ {P _ {k}} \left[ \log (1 - h (X)) \right] + \mathbb {E} _ {Q} \left[ \log h (Z) \right]. +$$ + +# A.2 Proof of Proposition 4.1 + +We present the proof of Proposition 4.1. Let us define $J(h) \coloneqq \int h dP - \int f^{*}(h)dQ$ . + +1. The proof follows from + +$$ +D _ {f} ^ {\mathcal {H}} (P, Q) = \sup _ {h \in \mathcal {H}} J (h) \geq \sup _ {c \in \mathbb {R}} J (c) = \sup _ {c \in \mathbb {R}} \{c - f ^ {*} (c) \} = f (1) = 0 +$$ + +where the last identity follows from the assumption that $f(1) = 0$ . + +2. The direction $(\Leftarrow)$ follows because + +$$ +J (h) \leq \int h d P - \int h d Q = 0, \quad \forall h \in \mathcal {H} +$$ + +where $f^{*}(y) = \sup_{x}\{xy - f(x)\} \geq y1 - f(1) = y$ is used. As a result, $D_f^{\mathcal{H}}(p\| Q) = \sup_{h\in \mathcal{H}}J(h)\leq 0$ . Using part (1), this is only possible when $D_f^{\mathcal{H}}(P\| Q) = 0$ . + +To show the other direction $(\Rightarrow)$ , for all $h \in \mathcal{H}$ , define $g(\lambda) \coloneqq J(f'(1) + \lambda h)$ where $\lambda \in \mathbb{R}$ . The function $g(\lambda)$ attains its maximum at $\lambda = 0$ because $g(\lambda) = J(f'(1) + \lambda h) \leq \sup_{h \in \mathcal{H}} J(h) = D_f^{\mathcal{H}}(P \| Q) = 0$ and $g(0) = J(f'(1)) = f'(1) - f^*(f'(1)) = f(1) = 0$ by Fenchel identity. Therefore, the first-order optimality condition $g'(0) = 0$ must hold. The result follows because + +$$ +g ^ {\prime} (0) = \int h d P - \int h f ^ {* \prime} (f ^ {\prime} (1)) d Q = \int h d P - \int h d Q +$$ + +3. Let us define $g_{h}(\lambda) \coloneqq J\big(f^{\prime}(1) + \frac{\lambda h}{\|h\|_{2,Q}}\big)$ . The first and the second derivatives of $g_{h}(\lambda)$ with respect to $\lambda$ are: + +$$ +g _ {h} ^ {\prime} (\lambda) = \int \frac {h}{\| h \|} d P - \int \frac {h}{\| h \|} f ^ {* \prime} (f ^ {\prime} (1) + \frac {\lambda h}{\| h \|}) d Q +$$ + +$$ +g _ {h} ^ {\prime \prime} (\lambda) = - \int \frac {h ^ {2}}{\| h \| ^ {2}} f ^ {* \prime \prime} (f ^ {\prime} (1) + \frac {\lambda h}{\| h \|}) d Q +$$ + +By assumption on $f$ , the convex conjugate $f^{*}$ is strongly convex with constant $\frac{1}{L}$ and smooth with constant $\frac{1}{\alpha}$ . Therefore, $\frac{1}{L} \leq f^{**}(y) \leq \frac{1}{\alpha}$ . As a result, $\frac{1}{L} \leq -g_h''(\lambda) \leq \frac{1}{\alpha}$ where we used $\| h \|^2 = \int h^2 dQ$ . Therefore, $g_h(\lambda)$ is strongly concave and smooth and satisfies the inequalities: + +$$ +\frac {\alpha}{2} g _ {h} ^ {\prime} (0) ^ {2} \leq \sup _ {\lambda} g _ {h} (\lambda) - g _ {h} (0) \leq \frac {L}{2} g _ {h} ^ {\prime} (0) ^ {2} +$$ + +Upon using $g_{h}(0) = J(f^{\prime}(1)) = 0$ and taking the sup over $h\in \mathcal{H}$ of all sides, + +$$ +\frac{\alpha}{2}\sup_{h\in \mathcal{H}}g_{h}^{\prime}(0)^{2}\leq \sup_{h\in \mathcal{H}}\sup_{\lambda}g_{h}(\lambda)\leq \frac{L}{2}\sup_{h\in \mathcal{H}}g_{h}^{\prime}(0)^{2}. +$$ + +By the assumption that for all $h\in \mathcal{H}$ $c + \lambda h\in \mathcal{H}$ for $c,\lambda \in \mathbb{R}$ + +$$ +\sup_{h\in \mathcal{H}}\sup_{\lambda}g_{h}(\lambda) = \sup_{h\in \mathcal{H}}J(h) = D_{f}^{\mathcal{H}}(P\| Q). +$$ + +The result follows by noting that $\sup_{h\in \mathcal{H}}g_h'(0) = d_\mathcal{H}(P,Q)$ . + +# A.3 Proof of Proposition 4.3 + +Proof. For a given $P$ and $Q$ , let $h_0 = f'(\frac{dP}{dQ})$ and $\tilde{h} \in \mathcal{H}$ be such that $\| \tilde{h} - h_0 \|_{2,Q} \leq \epsilon$ . Similar to the proof of Proposition 4.1, define $J(h) = \int h dP - \int f^*(h) dQ$ . Then, + +$$ +D _ {f} ^ {\mathcal {H}} (P \| Q) = \sup _ {h \in \mathcal {H}} J (h) \geq J (\tilde {h}) = J (\tilde {h}) - J (h _ {0}) + J (h _ {0}) = J (\tilde {h}) - J (h _ {0}) + D _ {f} (P \| Q) +$$ + +where $J(h_0) = D_f(P\| Q)$ is used in the last step. The proof follows by showing that $J(\tilde{h}) - J(h_0)\geq -\frac{1}{2\alpha}\| \tilde{h} -h_0\|_{2,Q}^2$ . In order to show this, note that $f^{*}$ is $\frac{1}{\alpha}$ smooth because $f$ is $\alpha$ strongly convex. Then, + +$$ +f ^ {*} (\tilde {h} (x)) - f ^ {*} (h _ {0} (x)) \leq f ^ {* \prime} (h _ {0} (x)) (\tilde {h} (x) - h _ {0} (x)) + \frac {1}{2 \alpha} | \tilde {h} (x) - h _ {0} (x) | ^ {2}, \quad \forall x. +$$ + +Taking the expectation over $Q$ and adding $\int h_0dP - \int \tilde{h} dP$ yields, + +$$ +J (h _ {0}) - J (\tilde {h}) \leq \int f ^ {* \prime} (h _ {0}) (\tilde {h} - h _ {0}) d Q + \int (h _ {0} - \tilde {h}) d P + \frac {1}{2 \alpha} \| \tilde {h} - h \| _ {2, Q} ^ {2}. +$$ + +Then, the proof follows from $f^{*'}(h_0) = f^{*'}(f'(\frac{dP}{dQ})) = \frac{dP}{dQ}$ to cancel the first two terms. + +Discussion on neural network function class Consider $\mathcal{H}$ is the class of neural nets with an arbitrary depth and mild assumption on the activation function. Following the proof of Theorem 1 in Korotin et al. (2022), we can verify that for any $\epsilon > 0$ , compactly supported $Q$ , and function $\|h\|_{2,Q} < \infty$ , there exists a neural net $\tilde{h} \in \mathcal{H}$ such that $\| \tilde{h} - h \|_{2,Q} \leq \epsilon$ . Indeed, let $Q$ be supported on $\mathcal{X} \subset \mathbb{R}^n$ , and $\mathcal{X}$ be compact, by Folland (1999, Proposition 7.9), the continuous functions $C^0(\mathcal{X})$ are dense in $L^2(Q)$ . Further by Kidger & Lyons (2020, Theorem 3.2), the neural nets in $\mathcal{H}$ are dense in $C^0(\mathcal{X})$ with respect to $L^\infty$ norm, and as such with respect to $L^2$ norm. Putting these two pieces together gives neural nets are dense in $L^2(Q)$ . + +# A.4 Proof of Proposition 4.4 + +Proof. We first introduce the following notations + +$$ +J (h) = \int h d P - \int f ^ {*} (h) d Q +$$ + +$$ +J _ {M, N} (h) = \int h d P ^ {(N)} - \int f ^ {*} (h) d Q ^ {(M)}, +$$ + +$$ +G _ {P} (h) = \int h d P - \int h d P ^ {(N)}, +$$ + +$$ +G _ {Q} (h) = \int f ^ {*} (h) d Q - \int f ^ {*} (h) d Q ^ {(M)}. +$$ + +Assume the $\sup_{h\in \mathcal{H}}J(h)$ is attained at $h = \bar{h}$ and $\sup_{h\in \mathcal{H}}J_{M,N}(h)$ is attained at $h = h_{M,N}$ . + +$$ +\sup_{h\in \mathcal{H}}J_{M,N}(h) - \sup_{h\in \mathcal{H}}J(h) = J_{M,N}(h_{M,N}) - \sup_{h\in \mathcal{H}}J(h)\leq J_{N}(h_{M,N}) - J(h_{M,N})\\ \leq \sup_{h\in \mathcal{H}}\{|G_{P}(h)|\} +\sup_{h\in \mathcal{H}}\{|G_{Q}(h)|\} . +$$ + +Similarly + +$$ +\sup _ {h \in \mathcal {H}} J (h) - \sup _ {h \in \mathcal {H}} J _ {M, N} (h) = J (\bar {h}) - \sup _ {h \in \mathcal {H}} J _ {M, N} (h) \leq J _ {M, N} (\bar {h}) - J (\bar {h}) \leq \sup _ {h \in \mathcal {H}} \{| G _ {P} (h) | \} + \sup _ {h \in \mathcal {H}} \{| G _ {Q} (h) | \}. +$$ + +Therefore, + +$$ +|D_{f}^{\mathcal{H}}(P^{(N)}\| Q^{(M)}) - D_{f}^{\mathcal{H}}(P\| Q)| = |\sup_{h\in \mathcal{H}}J_{M,N}(h) - \sup_{h\in \mathcal{H}}J(h)|\leq \sup_{h\in \mathcal{H}}\{|G_{P}(h)|\} +\sup_{h\in \mathcal{H}}\{|G_{Q}(h)|\} . +$$ + +The result follows by taking the expectation and the symmetrization inequality (Wellner, 2005, Lemma 5.1) to the last two terms + +$$ +\mathbb {E} \sup _ {h \in \mathcal {H}} \left\{| G _ {P} (h) | \right\} + \mathbb {E} \sup _ {h \in \mathcal {H}} \left\{| G _ {Q} (h) | \right\} \leq 2 \mathcal {R} _ {N} (\mathcal {H}, P) + 2 \mathcal {R} _ {M} \left(f ^ {*} \circ \mathcal {H}, Q\right). +$$ + +![](images/58f03e0a5bfcd454fbc75b586fe8cff5083940a3b0c0266a33ef4483c55111d1.jpg) + +It's not difficult to prove the following corollary following the same logic. + +Corollary A.2. Let $P^{(N)} = \frac{1}{N}\sum_{i=1}^{N}\delta_{X_i}$ , where $\{X_i\}_{i=1}^N$ are i.i.d samples from $P$ . Then, it follows that + +$$ +\mathbb {E} \left[ \left| D _ {f} ^ {\mathcal {H}} (P \| Q) - D _ {f} ^ {\mathcal {H}} (P ^ {(N)} \| Q) \right| \right] \leq 2 \mathcal {R} _ {N} (\mathcal {H}, P), +$$ + +where the expectation is over the samples and $\mathcal{R}_N(\mathcal{H},P)$ denotes the Rademacher complexity of the function class $\mathcal{H}$ with respect to $P$ for sample size $N$ . + +# A.5 Proof of Proposition 4.5 + +Proof. Suppose $P_0 = \mu = \mathcal{N}(0, I)$ , $Q = \mathcal{N}(\eta, I)$ and $\mathcal{F}(P)$ is the KL divergence $\mathcal{D}(P \| Q)$ , we parameterize $T_k(x) = x + \beta_k$ , $h_k(z) = \exp(\alpha_k^\top z + \gamma_k)$ . Then the closed-form solution of JKO is $P_k^* = \mathcal{N}(\eta_k, I)$ where + +$$ +\eta_ {k} = \eta \left(1 - \frac {1}{(1 + a) ^ {k}}\right). +$$ + +Our method adopts the JKO iteration (14) with the variational formula (2). Since $\mu$ is a user-defined Gaussian distribution, it is reasonable to assume $\mathbb{E}_{\mu}[h(Z)]$ can be estimated precisely. To sample from $P_{k}$ at the $k$ -th JKO step, we sample $N$ particles from the very beginning $\{X_{i}^{k}\}_{i = 1}^{N}\sim P_{0}$ with empirical mean $\eta_0^k = \frac{1}{N}\sum_{i = 1}^N X_i^k$ , and pushforward them through maps $T_{1},\ldots ,T_{k - 1}$ . We also define $\eta_k^K = \frac{1}{N}\sum_{i = 1}^N T_{k - 1}\circ \dots \circ T_1(X_i^K)$ . Clearly, $\eta_k^K = \eta_0^K +\sum_{j = 0}^{k - 1}\beta_j$ for $1\leq k\leq K$ , $1\leq K\leq \infty$ . Then the solutions of our method are + +$$ +\beta_ {k} = \frac {a (\eta - \eta_ {k} ^ {k + 1})}{1 + a}, \quad \alpha_ {k} = \beta_ {k} + \eta_ {k} ^ {k + 1} - \eta_ {k} ^ {k}, \quad \gamma_ {k} = - \alpha_ {k} ^ {\top} \eta_ {k} ^ {k} - \frac {\| \alpha_ {k} \| ^ {2}}{2}. +$$ + +Thus the mean of $P_K$ is $\widehat{\eta}_K = \sum_{j=0}^{K-1} \beta_K$ . By standard matrix calculation, we have $\widehat{\eta}_K = \eta_K - \varepsilon_N$ , where + +$$ +\varepsilon_ {N} = \frac {a}{1 + a} \sum_ {j = 1} ^ {K} \frac {\eta_ {0} ^ {j}}{(1 + a) ^ {K - j}}. +$$ + +Denote $\Delta_N = \frac{\|\eta\|}{(1 + a)^K}$ . By the closed-form of KL divergence between two Gaussians, + +$$ +\mathcal {D} ^ {\mathcal {H}} \left(P _ {K} ^ {*} \| Q\right) = \Delta_ {N} ^ {2} / 2 \tag {15} +$$ + +Denote $\xi_{K,N} = \mathbb{E}[||\varepsilon_N||^2] = \left(\frac{a}{1 + a}\right)^2\frac{n}{N}\sum_{j = 1}^{K}\frac{1}{(1 + a)^{2(K - j)}}$ . Additionally, by the Corollary 3.3, we can derive + +$$ +\mathcal {D} ^ {\mathcal {H}} (P _ {K} ^ {(N)} \| Q) = \| \eta_ {K} ^ {K} - \eta \| ^ {2} / 2, +$$ + +where $\eta_K^K$ is the mean of $P_K^{(N)}$ . Thus, + +$$ +\begin{array}{l} \mathbb {E} [ \mathcal {D} ^ {\mathcal {H}} (P _ {K} ^ {(N)} \| Q) ] = \mathbb {E} [ \| \eta_ {K} ^ {K} - \eta \| ^ {2} / 2 ] | \\ = \mathbb {E} [ \| \eta_ {K} ^ {K} - \eta_ {K} \| ^ {2} / 2 - (\eta_ {K} ^ {K} - \eta_ {K}) ^ {\top} (\eta_ {K} - \eta) + \| \eta_ {K} - \eta \| ^ {2} / 2 | ] \\ \leq \mathbb {E} [ \| \eta_ {K} ^ {K} - \eta_ {K} \| ^ {2} / 2 ] + \mathbb {E} [ | (\eta_ {K} ^ {K} - \eta_ {K}) ^ {\top} (\eta_ {K} - \eta) | ] + \| \eta_ {K} - \eta \| ^ {2} / 2 \\ = \mathbb {E} [ \| \eta_ {0} ^ {K} - \varepsilon_ {N} \| ^ {2} / 2 ] + \mathbb {E} [ | (\eta_ {0} ^ {K} - \varepsilon_ {N}) ^ {\top} (\eta_ {K} - \eta) | ] + \Delta_ {N} ^ {2} / 2 \\ \leq \mathbb {E} [ \| \eta_ {0} ^ {K} - \varepsilon_ {N} \| ^ {2} / 2 ] + \| \eta_ {K} - \eta \| \mathbb {E} [ \| \eta_ {0} ^ {K} - \varepsilon_ {N} \| ] + \Delta_ {N} ^ {2} / 2 \\ \leq \mathbb {E} [ \| \eta_ {0} ^ {K} - \varepsilon_ {N} \| ^ {2} / 2 ] + \Delta_ {N} \sqrt {\mathbb {E} [ \| \eta_ {0} ^ {K} - \varepsilon_ {N} \| ^ {2} ]} \\ = \frac {\xi_ {K , N}}{2} + \frac {1}{2 N} + \frac {\| \eta \|}{(1 + a) ^ {K}} \sqrt {\xi_ {K , N} + \frac {1}{N}}. \tag {16} \\ \end{array} +$$ + +By triangular inequality and (15), (16) it holds that + +$$ +\begin{array}{l} \mathbb {E} \big [ | \mathcal {D} ^ {\mathcal {H}} (P _ {K} ^ {*} \| Q) - \mathcal {D} ^ {\mathcal {H}} (P _ {K} ^ {(N)} \| Q) | \big ] \leq \mathcal {D} ^ {\mathcal {H}} (P _ {K} ^ {*} \| Q) + \mathbb {E} \big [ | \mathcal {D} ^ {\mathcal {H}} (P _ {K} ^ {(N)} \| Q) | \big ] \\ \le \Delta_ {N} ^ {2} / 2 + \Delta_ {N} \sqrt {\xi_ {K , N} + 1 / N} \\ = \frac {1}{2} \left(\Delta_ {N} + \sqrt {\xi_ {K , N} + 1 / N}\right) ^ {2}. \\ \end{array} +$$ + +# B Extension to Crank-Nicolson scheme + +Consider the Crank-Nicolson inspired JKO scheme (Carrillo et al., 2021) below + +$$ +P _ {k + 1} = \operatorname * {a r g m i n} _ {P \in \mathcal {P} _ {a c} (\mathbb {R} ^ {n})} \frac {1}{2 a} W _ {2} ^ {2} (P, P _ {k}) + \frac {1}{2} \mathcal {F} (P) + \frac {1}{2} \int \frac {\delta \mathcal {F}}{\delta P} (P _ {k}) P. +$$ + +The difficulty of implementing this scheme with neural-network based method is the easy access to the density of $P_{k}$ . The predecessors Mokrov et al. (2021) and Alvarez-Melis et al. (2021) don't have this property, while in our algorithm, $P_{k} \approx h_{k - 1}\Gamma_{k - 1}(k > 1)$ . This is because our optimal $h_k$ is equal to or can be transformed to the ratio between densities of $P_{k + 1}$ and $\Gamma_{k}$ . Assume $h$ can learn to approximate $P_{k + 1} / \Gamma_k$ , our method can be naturally extended to Crank-Nicolson inspired JKO scheme. + +# C Extension to the interaction energy functional + +In this section, we consider $\mathcal{F}(P)$ involves the interaction energy + +$$ +\begin{array}{l} \mathcal {F} (P) = \mathcal {W} (P) := \iint W (x - y) P (x) P (y) d x d y, \\ W: \mathbb {R} ^ {n} \to \mathbb {R} \text {i s s y m m e t r i c , i . e .} W (x) = W (- x). \\ \end{array} +$$ + +# C.1 Forward Backward (FB) scheme + +When $\mathcal{F}(P)$ involves the interaction energy $\mathcal{W}(P)$ , we add an additional forward step to solve the gradient flow: + +$$ +P _ {k + \frac {1}{2}} := (I - a \nabla_ {x} (W * P _ {k})) \sharp P _ {k} \tag {17} +$$ + +$$ +P _ {k + 1} := T _ {k + \frac {1}{2}} \sharp P _ {k + \frac {1}{2}}, \tag {18} +$$ + +where $I$ is the identity map, and $T_{k + \frac{1}{2}}$ is defined by replacing $k$ by $k + \frac{1}{2}$ in (8). In other words, the first gradient descent step (17) is a forward discretization of the gradient flow and the second JKO step (18) is a backward discretization. $\nabla_x(W * P)$ can be written as expectation $\mathbb{E}_{y\sim P}\nabla_x(W(x - y))$ , thus can also be approximated by samples. The computation complexity of step (17) is at most $O(N^2)$ where $N$ is the total number of particles to push-forward. This scheme has been studied as a discretization of gradient flows and proved to have sublinear convergence to the minimizer of $\mathcal{F}(P)$ under some regular assumptions (Salim et al., 2020). We make this scheme practical by giving a scalable implementation of JKO. + +Since $\mathcal{W}(P)$ can be equivalently written as expectation $\mathbb{E}_{x,y\sim P}[W(x - y)]$ , there exists another non-forward-backward (non-FB) method, i.e., removing the first step and integrating $\mathcal{W}(P)$ into a single JKO step: $P_{k + 1} = T_k\nparallel P_k$ and + +$$ +\begin{array}{l} T _ {k} = \underset {T} {\arg \min } \left(\mathbb {E} _ {P _ {k}} \| X - T (X) \| ^ {2} / 2 a \right. \\ + \mathbb {E} _ {X, Y \sim P _ {k}} [ W (T (X) - T (Y)) ] + \sup _ {h} \mathcal {V} (T, h)). \\ \end{array} +$$ + +In practice, we observe the FB scheme is more stable and gives more regular results however converge slower than non-FB scheme. The detailed discussion appears in the Appendix C.2, C.4. + +Remark C.1. In principle, one can single out $\log (Q)$ term from (13) and perform a similar forward step $P_{k + \frac{1}{2}} = (I - a(\nabla_x Q) / Q)\sharp P_k$ (Salim et al., 2020), but we don't observe improved performance of doing this in sampling task. + +# C.2 Simulation solutions to Aggregation equation + +Alvarez-Melis et al. (2021) proposes using the neural network based JKO, i.e. the backward method, to solve (19). They parameterize $T$ as the gradient of the ICNN. In this section, we use two cases to compare the forward method and backward when $\mathcal{F}(P) = \mathcal{W}(P)$ . This could help explain the FB and non-FB scheme performance difference later in Section C.4. + +We study the gradient flow associated with the aggregation equation + +$$ +\partial_ {t} P = \nabla \cdot (P \nabla W * P), \quad W: \mathbb {R} ^ {n} \rightarrow \mathbb {R}. \tag {19} +$$ + +The forward method is + +$$ +P _ {k + 1} := (I - a \nabla_ {x} (W * P _ {k})) \sharp P _ {k}. +$$ + +The backward method or JKO is + +$$ +P _ {k + 1} := T _ {k} \sharp P _ {k}, \quad T _ {k} = \underset {T} {\arg \min} \left\{\frac {1}{2 a} \mathbb {E} _ {P _ {k}} [ \| X - T (X) \| ^ {2} ] + \mathbb {E} _ {X, Y \sim P _ {k}} [ W (T (X) - T (Y)) ] \right\}. +$$ + +Example 1 We follow the setting in Carrillo et al. (2021, Section 4.3.1). The interaction kernel is $W(x) = \frac{\|x\|^4}{4} - \frac{\|x\|^2}{2}$ , and the initial measure $P_0$ is a Gaussian $\mathcal{N}(0, 0.25I)$ . In this case, $\nabla_x(W * P_k)$ becomes $\mathbb{E}_{y \sim P_k} \left[ (\|x - y\|^2 - 1)(x - y) \right]$ . We use step size $a = 0.05$ for both methods and show the results in Figure 8. + +Example 2 We follow the setting in Carrillo et al. (2021, Section 4.2.3). The interaction kernel is $W(x) = \frac{\|x\|^2}{2} - \ln \| x \|$ , and the initial measure $P_0$ is $\mathcal{N}(0,1)$ . The unique steady state for this case is + +$$ +P _ {\infty} (x) = \frac {1}{\pi} \sqrt {(2 - x ^ {2}) _ {+}}. +$$ + +The reader can refer to Alvarez-Melis et al. (2021, Section 5.3) for the backward method performance. As for the forward method, $\nabla_{x}(W * P_{k})$ becomes $\mathbb{E}_{y \sim P_{k}}\left[x - y - \frac{1}{x - y}\right]$ . Because the kernel $W$ enforces repulsion near the origin and $P_{0}$ + +![](images/513fac6e4adcca6669cf70f5ea758a584a8e574c13efc8b241425f61a5379fae.jpg) +(a) Forward method $k = 23, t = 1.15$ + +![](images/8d1bfd7665faeca0bb0755398419a0918d95946abdec1e4a4bebc736266a9270.jpg) + +![](images/94ca0d3e13aecb8b76914051d8e05af1081a525222f5cee492fb83c4081fbcdd.jpg) +(b) Forward method $k = 200, t = 10$ + +![](images/d54e597b8faf2958fe982fd7f46c71bce68ce7346f92fa01d742e91221b8a5f9.jpg) + +![](images/df51314c9678d665951dc5881ae40347b82d7bde1372a28a4d4a9fe0c3062ea0.jpg) +(c) Backward method $k = 23$ , $t = 1.15$ + +![](images/5e73ff726f843a735512440f6ffc12206e098876a81d67b465a79067d1ae100a.jpg) +Figure 8: The steady state is supported on a ring of radius 0.5. Backward converges faster to the steady rate but is unstable. As $k$ goes large, it cannot keep the regular ring shape and will collapse after $k > 50$ . + +![](images/230ee15a057ad2d2d681d620b6062b04da1f76bf10cd4218bc9ed3c2fc210e44.jpg) +(d) Backward method $k = 40, t = 2$ + +![](images/16c7907809f7c279084b26f9683e449d7931991835c186b2f0f0ee16be40631e.jpg) + +is concentrated around origin, $\nabla_{x}(W * P)$ will easily blow up. So the forward method is not suitable for this kind of interaction kernel. + +Through the above two examples, if $\nabla_{x}(W * P)$ is smooth, we can notice the backward method converges faster, but is not stable when solving (19). This shed light on the FB and non-FB scheme performance in Section C.3, C.4. However, if $\nabla_{x}(W * P)$ has bad modality such as Example 2, the forward method loses the competitiveness. + +# C.3 Simulations to Aggregation-Diffusion Equation with FB scheme + +![](images/0e08a44b65c681629a8153618c9b6849a37c7ad217b9e01d524f373ba2225d18.jpg) +(a) $k = 24$ + +![](images/60405c1ac89804e5925f4dd8d76d172699a65d43f70308a7c43049424975d96b.jpg) +(b) $k = 36$ + +![](images/44b8dd82afc845cd128db2d95048732662b1469522201b7e0e5ed63e22a821b9.jpg) +(c) $k = 60$ +Figure 9: Histogram for simulated measures $P_{k}$ by FB scheme at different $k$ . + +![](images/33642d85d08e3cbdb7ad038d0f7cc007cc3115dbb89aecbf760983d205c58e7f.jpg) +(d) $k = 84$ + +![](images/4a2b8a29c4f236902867ad18289f0ca1c35b2712087414f069cffff142fab4b6.jpg) +(e) $k = 92$ + +We simulate the evolution of solutions to the following aggregation-diffusion equation: + +$$ +\partial_ {t} P = \nabla \cdot (P \nabla W * P) + 0. 1 \Delta P ^ {m}, W (x) = - e ^ {- \| x \| ^ {2}} / \pi . +$$ + +This corresponds to the energy function $\mathcal{W}(P) + 0.1\mathcal{G}(P)$ . There is no explicit closed-form solution for this equation except for the known singular steady state (Carrillo et al., 2019b), thus we only provide qualitative results in Figure 9. We use the same parameters in Carrillo et al. (2021, Section 4.3.3). The initial distribution is a uniform distribution supported on $[-3,3]\times [-3,3]$ and the JKO step size $a = 0.5$ . We utilize FB scheme to simulate the gradient flow for this equation with $m = 3$ on $\mathbb{R}^2$ space. With this choice $W(x)$ , $\nabla_{x}(W*P_{k})$ is equal to $\mathbb{E}_{y\sim P_k}\left[2e^{-\| x - y\|^2 / \pi}\right]$ in the gradient descent step (17). And we estimate $\nabla_{x}(W*P_{k})$ with $10^{4}$ samples from $P_{k}$ . + +Throughout the process, the aggregation term $\nabla \cdot (P\nabla W * P)$ and the diffusion $0.1\Delta P^m$ adversarially exert their effects and cause the probability measure split to four pulses and converge to a single pulse in the end. Our result aligns with the simulation of discretization method (Carrillo et al., 2021) well. + +# C.4 Simulation solutions to Aggregation-diffusion equation with non-FB scheme + +In Figure 10, we show the non-FB solutions to Aggregation-diffusion equation in Section C.3. FB scheme should be independent with the implementation of JKO, but in the following context, we assume FB and non-FB are both neural network based methods discussed in Section 3. Non-FB scheme reads + +$$ +P _ {k + 1} = T _ {k} \sharp P _ {k} +$$ + +$$ +T _ {k} = \underset {T} {\arg \min } \left\{\frac {1}{2 a} \mathbb {E} _ {P _ {k}} [ \| X - T (X) \| ^ {2} ] + \mathbb {E} _ {X, Y \sim P _ {k}} [ W (T (X) - T (Y)) ] + \mathcal {G} (T, h) \right\}, +$$ + +where $\mathcal{G}(T,h)$ is represented by the variational formula (10). We use the same step size $a = 0.5$ and other PDE parameters as in Section C.3. + +![](images/7a70d54e4468093acfd2f65d924637316723e96b839189379f81d9b06bf2ce0d.jpg) +(a) $k = 18$ + +![](images/7c6a2276a420c2d7b1ba88b0565121503ff940ae8ef3dc51b27c57aa16e2aa01.jpg) +(b) $k = 24$ + +![](images/e3f0b17d19a1d109fbce94158be4007004975993552c5209de4f49dc2fac3b2e.jpg) +(c) $k = 30$ +Figure 10: Histograms for simulated measures $P_{k}$ by non-FB scheme at different $k$ . + +![](images/fef995143bc5c0154eb2e89606e9767e163323a4295ec217b56ad6374cc6e8f9.jpg) +(d) $k = 42$ + +Comparing the FB scheme results in Figure 9 and the non-FB scheme results in Figure 10, we observe non-FB converges $1.5 \times$ slower than the finite difference method (Carrillo et al., 2021), and FB converges $3 \times$ slower than the finite difference method. This may because splitting one JKO step to the forward-backward two steps removes the aggregation term effect in the JKO, and the diffusion term is too weak to make a difference in the loss. Note at the first several $k$ , both $P_{k}$ and $Q$ are nearly the same uniform distributions, so $h$ is nearly a constant and $T(x)$ exerts little effect in the variational formula of $\mathcal{G}(P)$ . Another possible reason is a single forward step for aggregation term converges slower than integrating aggregation in the backward step, as we discuss in Section C.2 and Figure 8. + +However, FB generates more regular measures. We can tell the four pulses given by FB are more symmetric. We speculate this is because gradient descent step in FB utilizes the geometric structure of $W(x)$ directly, but integrating $\mathcal{W}(P)$ in neural network based JKO losses the geometric meaning of $W(x)$ . + +# D Evaluation of the density + +In this section, we assume the solving process doesn't use forward-backward scheme, i.e. all the probability measures $P_{k}$ are obtained by performing JKO one by one. Otherwise, the map $I - a\nabla_{x}(W*P_{k}) = I - \mathbb{E}_{y\sim P_{k}}\nabla_{x}(W(x - y))$ includes an expectation term and becomes intractable to push-backward particles to compute density. + +If $T$ is invertible, these exist a standard approach, which we present here for completeness, to evaluate the density of $P_{k}$ (Alvarez-Melis et al., 2021; Mokrov et al., 2021) through the change of variables formula. More specifically, we assume $T$ is parameterized by the gradient of an ICNN $\varphi$ that is assumed to be strictly convex. Thus we can guarantee that the gradient $\nabla \varphi$ invertible. To evaluate the density $P_{k}(x_{k})$ at point $x_{k}$ , we back propagate through the sequence of maps $T_{k} = \nabla \varphi_{k},\ldots ,T_{1} = \nabla \varphi_{1}$ to get + +$$ +x _ {i} = T _ {i + 1} ^ {- 1} \circ T _ {i + 2} ^ {- 1} \circ \dots \circ T _ {k} ^ {- 1} (x _ {k}). +$$ + +The inverse map $T_{j}^{-1} = (\nabla \varphi_{j})^{-1} = \nabla \varphi_{j}^{*}$ can be obtained by solving the convex optimization + +$$ +x _ {j - 1} = \underset {x \in \mathbb {R} ^ {n}} {\arg \max } \langle x, x _ {j} \rangle - \varphi_ {j} (x). \tag {20} +$$ + +Then, by the change of variables formula, we obtain + +$$ +\log \left[ d P _ {k} \left(x _ {k}\right) \right] = \log \left[ d P _ {0} \left(x _ {0}\right) \right] - \sum_ {i = 1} ^ {k} \log \left| \nabla^ {2} \varphi_ {i} \left(x _ {i - 1}\right) \right|, \tag {21} +$$ + +where $\nabla^2\varphi_i(x_{i - 1})$ is the Hessian of $\varphi_{i}$ and $|\nabla^{2}\varphi_{i}(x_{i - 1})|$ is its determinant. By iteratively solving (20) and plugging the resulting $x_{j}$ into (21), we can recover the density $dP_{k}(x_{k})$ at any point. + +# E Additional experiment results and discussions + +# E.1 Computational time + +The forward step (17) takes about 14 seconds to pushforward one million points. + +Other than learning generative model, assume each JKO step involves 500 iterations, the number of iterations $J_{2} = 3$ , $J_{3} = 2$ , then the training of each JKO step (18) takes around 15 seconds. + +For learning image generative model, assume $J_{2} = 1$ , $J_{3} = 5$ , then the training of each JKO step (18) takes around 20 minutes. + +# E.2 Learning of function $h$ + +The learning of the function $h$ is crucial because it determines the effectiveness of variational formula. In our KL divergence and generalized entropy variational formulas, the optimal $h$ is equal to $T\sharp P_k / \Gamma$ , which can have large Lipschitz constant in some high dimensional applications and become difficult to approximate. To tackle this issue, we replace $h$ by $\exp (\bar{h}) - 1$ , thus the optimal $\bar{h}$ is $\log (h + 1)$ , whose Lipschitz constant is much weakened. We apply this trick in Section 5.1 and observe the improved performance. + +In image tasks, $h$ works like a discriminator in GAN. A typical problem in GAN is that the discriminator can be too strong to let generator keep learning. To avoid this, we add the spectral normalization in $h$ such that the Lipschitz of $h$ is bounded by 1. + +# E.3 Convergence comparison with the same number of JKO steps + +In this section, we show the convergence comparison under the constraint of performing same number of JKO steps for all methods. The result is in Figure 11. We repeat the experiment for 5 times with the same global random seed 1, 2, 3, 4, 5 for all methods. JKO-ICNN shows large variance and instability after longer run in high dimension. Specifically, we observe that at random seed 2 in dimension 24, JKO-ICNN-d converges for the first 19 JKO steps and then suddenly diverges, causing the occurrence of an extreme point. The similar instability issue is also reported in Bonet et al. (2021, Figure 3). With the same random seeds, through 40 JKO steps, we don't observe this instability issue using our method. + +# F Experiments implementation details other than image + +Our experiments are conducted on GeForce RTX 3090 or RTX A6000. We always make sure the comparison is conducted on the same GPU card when comparing training time with other methods. Our code is written in Pytorch-Lightning (Falcon & Cho, 2020). We use other wonderful python libraries including W&B (Biewald, 2020), hydra (Yadan, 2019), seaborn (Waskom, 2021), etc. We also adopt the code given by Mokrov et al. (2021) for some experiments. For fast approximation of $\log \det \nabla^2\varphi$ , we adapt the code given by Huang et al. (2020) with default parameters therein. + +Without further specification, we use the following parameters: + +- The number of iterations: $J_{1} = 600$ . $J_{2} = 3$ . $J_{3} = 1$ + +![](images/745a0bfbcc2c43662813bc6384ffea5637f409c0b3f2a13f63bab8e65d793697.jpg) +Figure 11: Quantitative comparison in converging to GMM with the constraint of performing 40 JKO steps for all methods. We calculate the kernelized Stein divergence between the generated distribution and the target distribution. + +- The batch size is fixed to be $M = 100$ . +- The learning rate is fixed to be 0.001. +- All the activation functions are set to be PReLU. +- $h$ has 3 layers and 16 neurons in each layer. +- $T$ has 4 layers and 16 neurons in each layer. + +The transport map $T$ can be parametrized in different ways. We use a residual MLP network for it in Section 5.1, 5.2, 5.3, C.3, C.2, and the gradient of a strongly convex ICNN in Section 5.4, C.4. Except image task, the dual test function $h$ is always a MLP network with quadratic or sigmoid actification function in the final layer to promise $h$ is positive. + +The networks $T$ and $h$ in Section 5.5 are chosen to be UNet and a normal CNN. + +# F.1 Calculation of error criteria + +Sampling from GMM We estimate the kernelized Stein discrepancy (KSD) following the author's instructions (Liu et al., 2016). We draw $N$ samples $X_{1},\ldots ,X_{N}$ from each method, and estimate KSD as + +$$ +\operatorname {K S D} (P, Q) = \frac {1}{N (N - 1)} \sum_ {1 \leq i \neq j \leq N} u _ {Q} (X _ {i}, X _ {j}), +$$ + +where + +$$ +\begin{array}{l} u _ {Q} (x, x ^ {\prime}) = s _ {q} (x) ^ {\top} k \left(x, x ^ {\prime}\right) s _ {q} \left(x ^ {\prime}\right) + s _ {q} (x) ^ {\top} \nabla_ {x ^ {\prime}} k \left(x, x ^ {\prime}\right) + \nabla_ {x} k \left(x, x ^ {\prime}\right) ^ {\top} s _ {q} \left(x ^ {\prime}\right) + \operatorname {t r a c e} \left(\nabla_ {x, x ^ {\prime}} k \left(x, x ^ {\prime}\right)\right), \\ s _ {Q} = \nabla_ {x} \log Q (x) = \frac {\nabla_ {x} Q (x)}{Q (x)}. \\ \end{array} +$$ + +We choose the kernel $\phi$ to be the RBF kernel and use the same bandwidth for all methods. We fix $N = 1\times 10^{5}$ + +OU process For each method, we draw $5 \cdot 10^{5}$ samples from $P_{t}$ and calculate the empirical mean $\widetilde{\mu}_{t}$ and covariance $\widetilde{\Sigma}_{t}$ . Then we calculate the SymKL between $\mathcal{N}(\widetilde{\mu}_t,\widetilde{\Sigma}_t)$ and the exact solution. + +Porous media equation We calculate the density of $P_{k}$ according to Section D and estimate the SymKL using Monte Carlo according to the instructions in Mokrov et al. (2021). + +# F.2 Sampling from Gaussian Mixture Models (Section 5.1) + +Two moons We run $K = 10$ JKO steps with $J_{2} = 6$ , $J_{3} = 1$ inner iterations. $h$ has 5 layers. $T$ has 4 layers. + +Table 4: Hyper-parameters in the GMM convergence experiments. + +
DimensionlOur methodsJKO-ICNN
T widthT depthh widthh depthwidthdepth
2583832562
453243233842
853243245122
15364464410242
17364464410242
24364564410242
32364564410242
64212851284--
1281.512851284--
+ +Table 5: Bayesian logistic regression accuracy and log-likelihood full results. + +
Dataset# featuresdataset sizeAccuracyLog-Likelihood
OursJKO-ICNN-dSVGDOursJKO-ICNN-dSVGD
covtype545810120.7530.750.75-0.528-0.515-0.515
splice6029910.840.8450.85-0.38-0.36-0.355
waveform2150000.7850.780.765-0.455-0.485-0.465
twonorm2074000.9820.980.98-0.056-0.059-0.062
ringnorm2074000.730.740.74-0.5-0.5-0.5
german2010000.670.670.65-0.59-0.6-0.6
image1820860.8660.820.815-0.394-0.43-0.44
diabetis87680.7860.7750.78-0.45-0.45-0.46
banana253000.550.550.54-0.69-0.69-0.69
+ +GMM The mean of Gaussian components are randomly sampled from $\mathrm{Uniform}([-\ell /2,\ell /2]^n)$ . $J_{3} = 2$ . The map $T$ has dropout in each layer with probability 0.04. The learning rate of our method is $1\cdot 10^{-3}$ for the first 20 JKO steps and $4\cdot 10^{-4}$ for the last 20 JKO steps. The learning rate of JKO-ICNN is $5\cdot 10^{-3}$ for the first 20 JKO steps, and then $2\cdot 10^{-3}$ for the rest steps. The batch size is 512 and each JKO step runs 1000 iterations for all methods. The rest parameters are in Table 4. + +# F.3 Ornstein-Uhlenbeck Process (Section 5.2) + +We use nearly all the same hyper-parameters as Mokrov et al. (2021), including learning rate, hidden layer width, and the number of iterations per JKO step. Specifically, we use a residual feed-forward NN to work as $T$ , i.e. without activation function. $h$ and $T$ both have 2 layers and 64 hidden neurons per layer for all dimensions. We also train them for $J_{1} = 500$ iterations per each JKO with learning rate 0.005. The batch size is $M = 1000$ . + +# F.4 Bayesian Logistic Regression (Section 5.3) + +Same as Mokrov et al. (2021), we use JKO step size $a = 0.1$ and calculate the log-likelihood and accuracy with 4096 random parameter samples. The rest parameters are in Table 6. + +# F.5 Porous media equation (Section 5.4) + +We use rejection sampling (Eckhardt et al., 1987) to sample from $P_0$ because its computational time is more promising than MCMC methods. However, the rejection sampling acceptance rate is expected to be exponentially small (MacKay & Mac Kay, 2003, Ch 29.3) in dimension, and empirically it's intractable when $n > 6$ . So we only give the results for $n \leq 6$ . + +In the experiment, $h$ have 4 layers and 16 neurons in each layer with CELU activation functions except the last layer, which is activated by PReLU. To parameterize the map, we adopt DenseICNN (Korotin et al., 2021a) structure with width 64, depth 2 and rank 1. The batch size is $M = 1024$ . Each JKO step runs $J_{1} = 1000$ iterations. The learning rate for both $\varphi$ and $h$ is $1 \cdot 10^{-3}$ . $J_{3} = 1$ for dimension 3 and $J_{3} = 2$ for dimension 6. + +Table 6: Hyper-parameters in the Bayesian logistic regression. + +
DatasetKMJ1T widthT depthh widthh depthT learning rateh learning rate
covtype710247000128412832·10-52·10-5
splice501024400128512841·10-41·10-4
waveform5102410003243241·10-55·10-5
twonorm155128003243231·10-31·10-3
ringnorm910245003243241·10-51·10-5
german148006403243242·10-42·10-4
image1251210003243241·10-41·10-4
diabetis166148353243231·10-41·10-4
banana1651210001621625·10-45·10-4
+ +# F.6 Aggregation-diffusion equation (Section C.3 and C.4) + +Each JKO step contains $J_{1} = 200$ iterations. The batch size is $M = 1000$ . + +# G Image experiment details + +# G.1 Hyperparameters and network architecture + +We use Adam optimizer with learning rate $2 \times 10^{-4}$ and other default settings in PyTorch library. We choose $J_{2} = 1$ , $J_{3} = 5$ . Our $h$ network follows the architecture of ResNet classifier network (He et al., 2016). More specially, our module uses two downsampling modules, which results in three feature map resolution ( $32 \times 32$ , $16 \times 16$ , $8 \times 8$ ). We use two convolutional residual blocks for each resolution and pass the features extracted from at $8 \times 8$ resolution into a 2-layer MLP. We use 128 channels for CNN and 128 hidden neurons for the MLP. Similar to training generative adversarial networks, we found adding regularizers on $h$ network can help stabilize training. Thus, we apply the spectral normalization (Miyato et al., 2018) on $h$ network. + +Our framework requires the $T_{k}$ networks to approximate mappings between same dimensional data spaces. Our network architecture follows the backbone of PixelCNN++ (Salimans et al., 2017), which can be viewed as a modified U-Net (Ronneberger et al., 2015) based on Wide ResNet (Zagoruyko & Komodakis, 2016). More specifically, we use 3 downsampling and 3 upsampling modules, which results in four feature map resolutions $(32 \times 32, 16 \times 16, 8 \times 8, 4 \times 4)$ . At each resolution, we have two convolutional residual blocks. We use 64, 128, 256, 512 channels for as image resolution decreases. + +Here are more training details: + +- We resize MNIST image to $32 \times 32$ resolution so that we $h, T_{k}$ networks can work on both MNIST and CIFAR10 with small modification of input channel. +- We use random horizontal flips during training for CIFAR10. +We use batch size $M = 128$ . +- On CIFAR10, we use implementation from torch-fidelity² to calculate FID scores with 50k samples. +- The JKO step size $a$ controls the divergence between $P_{k}$ and $P_{k + 1}$ . We observe training with large $a$ has unstable issues and mode collapse, a small $a$ suffers from slower convergence. We found $a = 5$ works well on both MNIST and CIFAR10 datasets. +- We use 10 epochs to train each $P_{k}$ , we notice $P_{30}$ generates realistic images when $a = 5.0$ . However, we find FID score decreases as $k$ increases. We present the change of FID score of samples from different $P_{k}$ in Figure 12. + +![](images/728e6d8e1e1c709df059b120765afb3dd7d63607d75799b2c8b811a6609378d0.jpg) +Figure 12: The FID score converges as $k$ increases on CIFAR10 dataset. + +![](images/cb75e7f6ecd01eb2b1a9fd3cc66d72646aafd9b110f08962b77624207e7517ec.jpg) +Figure 13: Mode collapsing in GANs. + +# G.2 More Comparison + +Comparison with GANs. As we use Jensen-Shannon divergence in our scheme, JKO-Flow specializes to Jensen-Shannon GAN when $a \to \infty$ , $K = 1$ . However, we found training with $a \to \infty$ , $K = 1$ is very unstable and suffer mode collapsing occasionally. Though training GANs can not recover the gradient flow from noise to image, it is interesting to compare JKO-Flow and GANs in terms of sampling quality. To make a fair comparison, we instantiate generator network as the same as $T_{k}$ network and discriminator as $h$ for GANs. We note such choice is not optimal for GAN since generators in existing works usually map a lower dimensional Gaussian noise into images instead of mapping from same dimensional space. We believe the comparison and JKO-Flow scheme may help future research when modeling mapping between same dimensional data spaces. As shown in Table 7, JKO-Flow enjoys better sample qualities. Empirically we found training GANs is more challenging when latent space is relative large and with more complex generator networks as mode collapsing becomes more common. We find the additional Wasserstein distance loss in JKO-Flow can be viewed a regularizer to avoid mode collapsing because $T_{k}$ will receive large penalty if it maps all inputs into a local minimal. However, one shortcoming of our method is the scheme of JKO-Flow needs to model a sequence of generators instead of one generate that push $P_{0}$ particles into $Q$ , and small step size controlled by $a$ resulted in slower convergence and more training time. + +Comparison with more generative models based on gradient flows and optimal transport maps. Most existing works in this line focus on the latent spaces of pre-trained autoencoders (Seguy et al., 2017; An et al., 2019; Makkuva et al., + +
MethodFID score ↓
GAN (JKO-Flow with a → ∞, K = 1)≥ 80
WGAN-GP62.3
SN-GAN43.2
JKO-Flow23.1
+ +Table 7: Comparison between JKO-Flow and various GANs. The generator and discriminator networks in GANs follow same architecture of $P_{k}$ and $h$ network in JKO-Flow. + +
MethodFID score ↓Inception Score ↑
AE-OT (An et al., 2019)28.5-
AE-OT-GAN (An et al., 2020)17.1-
OTM (Rout et al., 2021)20.697.41 ± 0.11
JKO-Flow23.17.48 ± 0.12
+ +Table 8: More comparison among generative models on CIFAR10. + +2020; Korotin et al., 2021a). The approach reduces burden of training gradients and optimal transport maps since tasks of modeling complex image modality and interactions between pixels are left to pre-trained decoders partially. We note the recent work Rout et al. (2021) investigates mappings between distributions located on the spaces with same dimensionality or unequal dimensionality. However, they only demonstrate the unconditional image generative model based on an embedding from a lower dimensional Gaussian distribution to image distributions. In contrast, we show JKO-Flow can learn complex mappings between both high dimensional distribution and achieve encouraging performance when applying such learned mappings in the challenging image generation task without additional conditional signal. We include more comparison in Table 8. + +# G.3 More generated samples and trajectories + +We include more results of JKO-Flow. Figure 14, Figure 16, Figure 15, and Figure 17 show more generated samples from $P_K$ and trajectories from JKO-Flow. + +![](images/2c6f012d0a62815f6e919e58275bfb71d2ddc2ccd3a43f2eebc58cd72ee49ad3.jpg) +Figure 14: More MNIST sample from JKO-Flow + +![](images/2c42913fdc4fdd3deb7e5c0018735a83b1adb7de40a0dc4d3f2546faf44da30a.jpg) +Figure 15: More MNIST trajectories from JKO-Flow with $K = 1$ to $K = 30$ . + +![](images/cba575226f4590d0ba5a4d4b6ed81de5cef53fae5514a335c6c990ae07be3373.jpg) +Figure 16: More CIFAR10 sample from JKO-Flow + +![](images/b8c4dc2b6647b238fd22f173034bc12cc30905d3f2a0679b99bc41ca26dbdd58.jpg) +Figure 17: More CIFAR10 trajectories from JKO-Flow with $K = 1$ to $K = 30$ . \ No newline at end of file diff --git a/variationalwassersteingradientflow/images.zip b/variationalwassersteingradientflow/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..79d949a656dc26e76037732478a5ede4bc934f2d --- /dev/null +++ b/variationalwassersteingradientflow/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:55d9646e455150839c95218654d923cc5083b9b017f731212497a336de273306 +size 2583173 diff --git a/variationalwassersteingradientflow/layout.json b/variationalwassersteingradientflow/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..6be462fc2f702a4b612bb462da2de14830e824b3 --- /dev/null +++ b/variationalwassersteingradientflow/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aa9a33d9ab43a32baf8b185262dcdcd90e22eeef5218b0b918bce5316c94024b +size 1458167 diff --git a/versatileduelingbanditsbestofbothworldanalysesforlearningfromrelativepreferences/f4ff40d4-8cc0-4911-afac-1e17b77d35a2_content_list.json b/versatileduelingbanditsbestofbothworldanalysesforlearningfromrelativepreferences/f4ff40d4-8cc0-4911-afac-1e17b77d35a2_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..7f9c3d9dde39b3ae38376243dfc64864b233a3e0 --- /dev/null +++ b/versatileduelingbanditsbestofbothworldanalysesforlearningfromrelativepreferences/f4ff40d4-8cc0-4911-afac-1e17b77d35a2_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0d8abeba9b082c67c06fa05beb37974be0de164d05b5c79455c084a0d343aba0 +size 122529 diff --git a/versatileduelingbanditsbestofbothworldanalysesforlearningfromrelativepreferences/f4ff40d4-8cc0-4911-afac-1e17b77d35a2_model.json b/versatileduelingbanditsbestofbothworldanalysesforlearningfromrelativepreferences/f4ff40d4-8cc0-4911-afac-1e17b77d35a2_model.json new file mode 100644 index 0000000000000000000000000000000000000000..d20d9f7ce1001cc6d3d42be414313ed411e4048f --- /dev/null +++ b/versatileduelingbanditsbestofbothworldanalysesforlearningfromrelativepreferences/f4ff40d4-8cc0-4911-afac-1e17b77d35a2_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:10b10e1164d147ceeef0bb5ac3aff28cff45ab90757b5290cbd24d8566ae96b3 +size 153492 diff --git a/versatileduelingbanditsbestofbothworldanalysesforlearningfromrelativepreferences/f4ff40d4-8cc0-4911-afac-1e17b77d35a2_origin.pdf b/versatileduelingbanditsbestofbothworldanalysesforlearningfromrelativepreferences/f4ff40d4-8cc0-4911-afac-1e17b77d35a2_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..c31006b89028d5a7a8e6d654440e59522e53040a --- /dev/null +++ b/versatileduelingbanditsbestofbothworldanalysesforlearningfromrelativepreferences/f4ff40d4-8cc0-4911-afac-1e17b77d35a2_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2a4148e73029ca0b1ac415b49325050237105bce00a0f4a03fa088a7f7fdedda +size 2687584 diff --git a/versatileduelingbanditsbestofbothworldanalysesforlearningfromrelativepreferences/full.md b/versatileduelingbanditsbestofbothworldanalysesforlearningfromrelativepreferences/full.md new file mode 100644 index 0000000000000000000000000000000000000000..8b75a66f4df470437b1b4ca6a7faad2fb042fb58 --- /dev/null +++ b/versatileduelingbanditsbestofbothworldanalysesforlearningfromrelativepreferences/full.md @@ -0,0 +1,647 @@ +# Versatile Dueling Bandits: Best-of-both World Analyses for Online Learning from Relative Preferences + +Aadirupa Saha1 Pierre Gaillard2 + +# Abstract + +We study the problem of $K$ -armed dueling bandit for both stochastic and adversarial environments, where the goal of the learner is to aggregate information through relative preferences of pair of decision points queried in an online sequential manner. We first propose a novel reduction from any (general) dueling bandits to multi-armed bandits which allows us to improve many existing results in dueling bandits. In particular, we give the first best-of both world result for the dueling bandits regret minimization problem—a unified framework that is guaranteed to perform optimally for both stochastic and adversarial preferences simultaneously. Moreover, our algorithm is also the first to achieve an optimal $O\left(\sum_{i=1}^{K} \frac{\log T}{\Delta_i}\right)$ regret bound against the Condorcet-winner benchmark, which scales optimally both in terms of the arm-size $K$ and the instance-specific suboptimality gaps $\{\Delta_i\}_{i=1}^K$ . This resolves the long standing problem of designing an instance-wise gap-dependent order optimal regret algorithm for dueling bandits (with matching lower bounds up to small constant factors). We further justify the robustness of our proposed algorithm by proving its optimal regret rate under adversariably corrupted preferences—this outperforms the existing state-of-the-art corrupted dueling results by a large margin. In summary, we believe our reduction idea will find a broader scope in solving a diverse class of dueling bandits setting, which are otherwise studied separately from multi-armed bandits with often more complex solutions and worse guarantees. The efficacy of our proposed algorithms are empirically corroborated against state-of-the-art dueling bandit methods. + +# 1. Introduction + +Studies have shown that it is often easier, faster and less expensive to collect feedback on a relative scale rather than asking ratings on an absolute scale. E.g., to understand the liking for a given pair of items, say (A,B), it is easier for the users to answer preference-based queries like: "Do you prefer Item A over B?", rather than their absolute counterparts: "How much do you score items A and B in a scale of [0-10]?" From a system designer's point of view, exploiting such user preference information could greatly aid in improving systems performances, especially when data can be collected on a relative scale and online fashion; such as recommendation systems, crowd-sourcing platforms, training bots, multi-player games, search-engine optimization, online retail, just to name a few. In many real world problems, especially where human preferences are elicited in an online fashion, e.g., design of surveys and expert reviews, assortment selection, search engine optimization, recommender systems, ranking in multiplayer games, etc, or even more general reinforcement learning problems where rewards shaping is often a challenging problem (e.g. if multi-objective rewards etc.), and instead, a preference feedback is much easier to elicit. + +Due to the widespread applicability and ease of data collection with relative feedback, learning from preferences has gained much popularity in the machine learning community and widely studied as the problem of *Dueling-Bandits* (DB) over last decade (Yue et al., 2012; Ailon et al., 2014; Zoghi et al., 2014a;b; 2015a), which is an online learning framework that generalizes the standard multiarmed bandit (MAB) (Auer et al., 2002a) setting for identifying a set of 'good' arms from a fixed decision-space (set of items) by querying preference feedback of actively chosen item-pairs. + +tive of the learner is to minimize the regret with respect to a (or set of) 'best' arm(s) in hindsight. + +Related Works Over the years, the problem of Dueling Bandits has been studied with various objectives and generalizations. This includes analyzing the learning rate under various preference structures, such as total ordering, transitivity, stochastic triangle inequality (Falahatgar et al., 2017; Yue & Joachims, 2011), utility based preference structure (Ailon et al., 2014; Szorenyi et al., 2015; Saha & Gopalan, 2018a; Chen et al., 2018), or under any general pairwise preference matrices (Dudík et al., 2015; Jamieson et al., 2015; Komiyama et al., 2016). Consequently, depending on the underlying preference structure, the learner's performance has been evaluated w.r.t. different benchmarks including among other promising generalizations. The problem of stochasticueling bandits has been studied for both PAC (Falahatgar et al., 2018; Szorenyi et al., 2015; Sui et al., 2018) as well as regret minimization setting (Zoghi et al., 2014a; Yue & Joachims, 2009; Chen & Frazier, 2017; Zoghi et al., 2015a) under several notions of benchmarks including best arm identification (Saha & Gopalan, 2019b; Busa-Fekete et al., 2014; Falahatgar et al., 2017), top-set detection (Busa-Fekete et al., 2013; Saha & Gopalan, 2019a), ranking (Ren et al., 2018; Saha & Gopalan, 2018b), amongst many. Some recent works have also looked into the problem for adversarial sequence of preference matrices (Saha & Gupta, 2022; Gajane et al., 2015; Saha et al., 2021), robustness to corruptions (Agarwal et al., 2021), or extendingueling bandits to potentially infinite arm sets (Saha, 2021; Kumagai, 2017) and contextual scenarios (Dudík et al., 2015; Saha & Krishnamurthy, 2021). Another interesting line of work alongueling bandits is to study the implications for its subsetwise generalization (Ren et al., 2018; Sui et al., 2018; Brost et al., 2016; Chen et al., 2018), also studied as battling bandits (Saha & Gopalan, 2018a; 2019a; Bengs et al., 2021). + +Despite widespread surge of interest along this line of research and multiple attempts there are some fundamental long standing open questions in dueling bandits which are (surprisingly!) yet unresolved. + +Unresolved Question #1 One of the longest and most widely studied objective in stochasticueling bandit is to measure regret w.r.t. the Condorcet winner (CW) arm: Given a preference matrix $\mathbf{P}$ , an arm $k^{(cw)} \in [K]$ is termed as the CW of $\mathbf{P}$ if $P(k^{(cw)}, k) > 0.5 \forall k \in [K] \setminus \{k^{(cw)}\}$ (Zoghi et al., 2014a). Assuming $P$ contains a CW, there have been several attempts to design an optimal regretueling bandit algorithm against the CW arm $k^{(cw)}$ (see Eq. (2) for details) (Zoghi et al., 2014a; Wu & Liu, 2016; Komiyama et al., 2015; Bengs et al., 2021). Without loss of generality, assuming $k^{(cw)} = 1$ and by denoting $\Delta_i = P(1, i) - 0.5$ to be the suboptimality gap of item $i$ w.r.t. the CW, it is well known that theueling bandit regret lower bound (w.r.t. the + +CW arm) is $\Omega\left(\sum_{i=2}^{K} \frac{\log T}{\Delta_i}\right)$ (Yue et al., 2012; Komiyama et al., 2015). However, despite several attempts, it is still unknown how to design an order optimal dueling bandit algorithm for the CW regret. Existing upper-bounds suffer all suboptimal $\Delta_{\min}^{-2}$ and/or $K^2$ dependencies. + +Notably, under more restricted structures, e.g. total ordering (Yue & Joachims, 2011), or utility based preferences (Szorenyi et al., 2015; Saha & Gopalan, 2020), or even special preference structures where the suboptimality gaps of all items $(\Delta_{i}, i \in [K] \setminus \{1\})$ are equal, the problem is easier to solve and tight regret guarantees are available with matching upper and lower bound analysis. However, for the case of any general preference matrix with CW, none of the existing attempts were able to close this regret analysis gap successfully (Zoghi et al., 2014a; Wu & Liu, 2016; Chen & Frazier, 2017; Komiyama et al., 2015; Saha & Gaillard, 2021). Subsequently, the natural questions to ask are: + +(1). Is the lower bound tight? (2). How to close the gap between the upper and lower bound for CW regret? + +Unresolved Question #2 Till date, all the proposed algorithms of dueling bandits need to know underlying preference structure ahead of time in order to yield optimal regret bounds. In fact, different algorithms have been proposed based on the nature/structures of the underlying preference matrices, e.g. (Yue & Joachims, 2011) for preferences with total orderings in terms of (relaxed) stochastic transitivity and stochastic triangle inequality; (Ailon et al., 2014; Gajane et al., 2015) for linear-utility based preferences, (Szorenyi et al., 2015) for BTL models, (Zoghi et al., 2014a; Komiyama et al., 2015; Wu & Liu, 2016) for stochastic preferences in presence of CW, (Saha et al., 2021; Gajane et al., 2015) for adversarial sequence of preferences, etc. However, it might not always be realistic to assume complete knowledge of the properties underlying preference matrices. Thus the daunting question to ask in this regard is + +Is it possible to design an order optimal 'best-of-both-world' algorithm for dueling bandits? + +That is, an algorithm that can adapt itself to the underlying structures of the preference environments and give optimal regret for both stochastic and adversarial settings? There has been a series of work on this line for the MAB framework (e.g., Bubeck & Slivkins, 2012; Auer & Chiang, 2016; Zimmert & Seldin, 2021), but unfortunately there has not been any existing 'best-of-both-world' attempt for generalueling bandits. + +Unresolved Question #3 In any real world situation, the true feedback are often corrupted with some form of system noise. Undoubtedly, the binary $0/1$ bitueling preferences are extremely prone to such noises when the learner might get to observe a flipped bit (adversarily corrupted) instead + +of the true dueling feedback. + +Can we design an efficient dueling bandit algorithm which is robust to adversarial corruptions and provably optimal? + +Our Contributions In this paper, we answer all of the above three questions affirmatively. The list of our specific contributions can be summarized as follows: + +1. A novel insight on the reduction from DB to MAB. +Ailon et al. (2014) proposed a reduction from utility-based dueling bandits (which is a special class of DB) to standard MAB. We show that the latter can easily be extended to any general dueling bandit problems (including CW), with significant consequences on the state of the art results in dueling bandits theory, as discussed in the points below. We believe that the reduction will find wider application in solving a diverse class of dueling bandit settings, using analyses of their MAB counterparts, which are otherwise studied separately from MAB with often more complex solutions and worse guarantees (Sec. 4). +2. First Best-of-Both World regret for DB. Applying the above reduction to a Best-of-Both world algorithm from MAB, we provide an algorithm that simultaneously guarantees a pseudo-regret bound $O(\sqrt{KT})$ in the adversarial setting and $O(K\log (T) / \Delta_{\mathrm{min}})$ in the stochastic one. This leads to the first best-of-both world results forueling bandits (Sec. 5). +3. Optimal stochastic gap-dependent Regret. Our algorithm also provides the first optimal Condorcet regret, which suffers neither from a suboptimal dependence on $\Delta_{\mathrm{min}}^{-2}$ nor from a quadratic dependence on the number of arms (Sec. 6.1). +4. Robustness to adversarial corruptions. Our algorithm is robust to adversarial corruptions and significantly improves existing results in DB (Agarwal et al., 2021) (Sec. 6.2). +5. Another easy algorithm for stochastic DB. We also propose a new elimination based algorithm with $O\left(\sum_{i=2}^{K}\frac{K \log T}{\Delta_i}\right)$ Condorcet regret which is regret optimal up to a factor of $K$ (Sec. 3). +6. Experimental evaluations. Finally we corroborate our theoretical results with extensive empirical evaluations (Sec. 7). + +# 2. Problem Formulation + +Notations. Decision space (or item/arm set) $[K] := \{1, 2, \ldots, K\}$ . For any matrix $\mathbf{M} \in \mathbb{R}^{K \times K}$ , we define $m_{ij} := M(i,j)$ , $\forall i,j \in [K]$ . $\mathbf{1}(\cdot)$ denotes the indicator random variable which takes value 1 if the predicate is true and 0 otherwise and $\lesssim$ a rough inequality which holds up to universal constants. For any two items $x,y \in [K]$ , we use the symbol $x \succ y$ to denote $x$ is preferred over $y$ . By convention, we set $\frac{0}{0} := 0.5$ . For any closed and convex set + +$S$ , we denote by $\mathcal{I}_S(x) \coloneqq 0$ , if $x \in S$ , and $\mathcal{I}_S(x) \coloneqq \infty$ otherwise; for any $x \in \mathbb{R}_+$ (notation used in Alg. 3). + +Consider any function $f:\mathbb{R}^K\mapsto \mathbb{R}$ . $\nabla f(\mathbf{x})$ denotes the gradient of function $f$ at point $\mathbf{x}\in \mathbb{R}^{K}$ . The convex conjugate (a.k.a. Fenchel conjugate) of $f$ is defined by: + +$$ +f ^ {*} (\mathbf {y}) := \sup _ {\mathbf {x} \in \mathbb {R} ^ {k}} \left(\langle \mathbf {x}, \mathbf {y} \rangle - f (\mathbf {x})\right). +$$ + +Thus we have for any any closed and convex set $S$ , $(f + \mathcal{I}_S)^*(\mathbf{y}) = \max_{\mathbf{x} \in S} \left( \langle \mathbf{x}, \mathbf{y} \rangle - f(\mathbf{x}) \right)$ . Further, as claimed in (Zimmert & Seldin, 2019), differentiable and convex $f$ with invertible gradient $(\nabla f)^{-1}$ , it holds that + +$$ +\nabla (f + \mathcal {I} _ {S}) ^ {*} (\mathbf {y}) = \arg \max _ {\mathbf {x} \in S} \left(\langle \mathbf {x}, \mathbf {y} \rangle - f (\mathbf {x})\right). +$$ + +Setup. We assume a decision space of $K$ arms denoted by $\mathcal{A} \coloneqq [K]$ . At each round $t$ , the task of the learner is to select a pair of actions $(k_{+1,t}, k_{-1,t}) \in [K] \times [K]$ , upon which a preference feedback $o_t \sim \mathrm{Ber}(P_t(k_{+1,t}, k_{-1,t}))$ is revealed to the learner according to the underlying preference matrix $\mathbf{P}_t \in [0,1]^{K \times K}$ (chosen adversarially), such that the probability of $k_{+1,t}$ being preferred over $k_{-1,t}$ is given by $Pr(o_t = 1) \coloneqq Pr(k_{+1,t} \succ k_{-1,t}) = P_t(k_{+1,t}, k_{-1,t})$ , and hence $Pr(o_t = 0) \coloneqq Pr(k_{-1,t} \succ k_{+1,t}) = 1 - P_t(k_{+1,t}, k_{-1,t})$ . + +Objective. Assuming the learner selects the duel $(k_{+1,t}, k_{-1,t})$ at round $t$ , one can measure its performance w.r.t. a single fixed arm $k^* \in [K]^1$ in hindsight by calculating the regret w.r.t. $k^* \in [K]$ + +$$ +R _ {T} \left(k ^ {*}\right) := \sum_ {t = 1} ^ {T} \frac {1}{2} \left(P _ {t} \left(k ^ {*}, k _ {+ 1, t}\right) + P _ {t} \left(k ^ {*}, k _ {- 1, t}\right) - 1\right). \tag {1} +$$ + +For the stochastic setting where $P_{t}$ s are fixed across all time steps $t \in [T]$ , we denote $P_{t} = P \forall t \in [T]$ . Further assuming there exists a Condorcet winner for $P$ , i.e. fixed arm $k^{(\mathrm{cw})} \in [K]$ such that $P(k^{(\mathrm{cw})}, k) > 0.5 \forall k \in [K] \setminus \{k^{(\mathrm{cw})}\}$ , the above notion of regret boils down to the regret with respect to the Condorcet winner for the choice of $k^* = k^{(\mathrm{cw})}$ , as widely studied in many dueling bandit literature (Zoghi et al., 2014a; Wu & Liu, 2016; Komiyama et al., 2015; Bengs et al., 2021), defined as: + +$$ +R _ {T} ^ {\left(\mathrm {c w}\right)} := \sum_ {t = 1} ^ {T} \frac {1}{2} \left(\Delta \left(k ^ {\left(\mathrm {c w}\right)}, k _ {+ 1, t}\right) + \Delta \left(k ^ {\left(\mathrm {c w}\right)}, k _ {- 1, t}\right)\right), \tag {2} +$$ + +where $\Delta (i,j)\coloneqq P(i,j) - 1 / 2$ being the suboptimality gap of item $i$ and $j$ in terms of their relative preferences. Without + +loss of generality we will assume $k^{(cw)} = 1$ throughout the rest of this paper (whenever relevant). + +# 3. Warm-Up: Near-Optimal Algorithm + +In this section, we propose an efficient UCB based algorithm for stochastic dueling bandit, which has a nearly optimal gap-dependent Condorcet regret of $R_T^{(cw)} = O\left(\sum_{i=2}^K i \Delta(k^{(cw)}, i)^{-1} \log T\right)$ (assuming $k^{(cw)} = 1$ is the Condorcet Winner). Note that existing dueling bandit algorithms, that satisfy a non-asymptotic Condorcet regret bound, suffer an additional constant of order $\Delta_{\min}^{-2}$ (Bengs et al., 2021), which implies a worst-case regret of order $O(T^{2/3})$ when $\Delta_{\min} \to 0$ . The simple elimination algorithm below solves this drawback and depends only on $\Delta_{\min}^{-1}$ but at the cost of a suboptimal quadratic dependence in the number of arms $K$ . Despite our efforts, we could not avoid this suboptimal factor by following the classical stochastic dual bandit analysis. In the following sections, we will show how to easily reach the optimal dependence in both $\Delta_{\min}$ and $K$ connecting the dueling bandit (DB) problem to standard MAB. + +Main Ideas: Algorithm RR-DB The high-level idea of Algorithm 1 is to sequentially compare arms in a round-robin fashion and eliminate arms when they are significantly suboptimal compared to any other arm. Typically, after $t$ rounds, a suboptimal arm $k$ has been compared at least $t / K$ times with the Condorcet winner. Denoting by $\Delta_k$ its suboptimality gap, the arm is eliminated after at most $t_k$ rounds, where $(t_k / K)^{-1/2} \approx \Delta_k$ . At that time the arm has been played $t_k / K$ times, yielding a regret of order $(t_k / K) \times \Delta_k \approx (K / \Delta_k^2) \times \Delta_k = K / \Delta_k$ . Summing over the arms yields a final regret of order $O(K^2 / \Delta_{\min})$ . + +Algorithm 1 RR-DB (Near Optimal DB) +1: input: Arm set: $[K]$ , Confidence parameter $\delta \in (0,1)$ +2: init: Active arms: $\mathcal{A}_1 \coloneqq [K]$ , $n_{ij}(t) \gets 0$ , $\forall i,j \in [K]$ +3: for $t = 1,2,\ldots,T$ do +4: Play $(k_{+1,t}, k_{-1,t}) \in \mathrm{argmin}_{i,j \in \mathcal{A}_t} \{n_{ij}(t - 1)\}$ +5: Observe $o_t(k_{+1,t}, k_{-1,t}) = 1 - o_t(k_{+1,t}, k_{-1,t})$ +6: for $i,j \in \mathcal{A}_t$ do +7: Define $\mathbb{1}_t(i,j) \coloneqq \mathbb{1}\{\{i,j\} = \{k_{-1,t}, k_{+1,t}\}\}$ and +[ n_{ij}(t) \coloneqq \sum_{s=1}^{t} \mathbb{1}_t(i,j) ] +[ \widehat{p}_{ij}(t) \coloneqq \frac{1}{n_{ij}(t)} \sum_{s=1}^{t} o_t(i,j) \mathbb{1}_t(i,j) ] +[ u_{ij}(t) \coloneqq \widehat{p}_{ij}(t) + \sqrt{\frac{\log(Kt / \delta)}{n_{ij}(t)}} ] +where we assume $x/0 = +\infty$ . + +8: end for +9: $\mathcal{A}_{t + 1} := \mathcal{A}_t \setminus \{i \in \mathcal{A}_t : \exists j \in \mathcal{A}_t \text{ s.t. } u_{ij}(t) < \frac{1}{2}\}$ +10: end for + +Without loss of generality assume the Condorcet winner $k^{(cw)} = 1$ , and denote $\Delta_i = \Delta(1, i)$ , $\forall i \in [K] \setminus \{1\}$ . + +Theorem 1 (Regret analysis of RR-DB (Alg. 1) for Stochastic Preferences against Condorcet Winner). Assume any instance of stochastic dueling bandit problem with Condorcet Winner $k^{(cw)} = 1$ . Let $\delta \in (0,1/2)$ , for any $T \geq 1$ , the regret of Algorithm 1 is upper-bounded with probability at least $1 - \delta$ as + +$$ +R _ {T} ^ {(c w)} \leq \frac {K ^ {2}}{2} + 4 \sum_ {i = 2} ^ {K} \frac {(i - 1) \log (K T / \delta)}{\Delta_ {i}}. +$$ + +Further, when $T \geq K^2$ , in the worst case (over the problem instance, i.e. $\Delta_2, \ldots, \Delta_K$ ), the regret of Algorithm 1 can be upper bounded as: + +$$ +R _ {T} ^ {(c w)} \leq 2 K \sqrt {T \log (K T / \delta)}. +$$ + +Remark 1. In particular, our regret analysis shows that, except a logarithmic factor, the regret bound of $RR - DB$ (Alg. 1) is off only by a multiplicative factor of $K$ , as follows from the known $\Omega \left( \sum_{k=1}^{K} \frac{\log T}{\Delta_k} \right)$ Condorcet winner regret lower bound (Yue et al., 2012; Komiyama et al., 2015). + +The proof is postponed to Appendix A. + +# 4. Key Idea: Reducing DB to MAB + +We now present a simple reduction from a multi-armed bandit algorithm to aueling bandit one. The latter was already proposed by Saha & Gupta (2022) to show worst-case guarantees and by Ailon et al. (2014) for utility basedueling bandits only. We recall it here since it is central to our analysis and we believe that it is of important interest for theueling bandit community that usually uses significantly different algorithms and analysis than the ones from standard multi-armed bandits. + +The main idea is to apply a multi-armed bandit algorithm independently to two players $i \in \{-1, +1\}$ respectively with losses defined for any $k \in [K]$ and $t \in [T]$ , by + +$$ +\ell_ {i, t} (k) := o _ {t} \left(k _ {- i, t}, k\right), +$$ + +where $o_{t}(k,k^{\prime}) = 1 - o_{t}(k^{\prime},k)$ for $1 < k^{\prime} \leq K$ follows a Bernoulli with parameter $P_{t}(k,k^{\prime})$ (and we assume $o_{t}(k,k) = 1 / 2$ ). + +We show below that any MAB regret upper-bound satisfied by $\mathcal{M}_i$ can be transformed into a DB regret upper-bound. + +Theorem 2 (DB Regret analysis of Alg. 2 in terms of the regret of the underlying MAB instances $(\mathcal{M}_{-1},\mathcal{M}_{+1})$ ). Define for $i\in \{-1,1\}$ and $k\in [K]$ by + +$$ +R _ {i, T} (k) := \sum_ {t = 1} ^ {T} \ell_ {i, t} \left(k _ {i, t}\right) - \ell_ {i, t} (k) +$$ + +Algorithm 2 Reduction from DB to MAB +1: input: Arm set: $[K]$ , two instances $\mathcal{M}_i$ of an algorithm for MAB, $i\in \{-1, + 1\}$ +2: for $t = 1,2,\ldots ,T$ do +3: for $i\in \{+1, - 1\}$ do +4: receive $p_{i,t}$ as suggested by $\mathcal{M}_i$ +5: sample $k_{i,t}$ from the distribution $p_{i,t}$ +6: end for +7: Play duel $(k_{+1,t},k_{-1,t})$ +8: Observe preference feedback $o_t(k_{+1,t},k_{-1,t})$ and set $o_t(k_{-1,t},k_{+1,t}) = 1 - o_t(k_{+1,t},k_{-1,t})$ +9: Feed $\mathcal{M}_i$ with loss $\ell_{i,t}(k)\coloneqq o_t(k_{-i,t},k_i,t)$ for $i\in$ $\{-1, + 1\}$ +10: end for + +the regret achieved by algorithm $\mathcal{M}_i$ . Then, the expected regret (1) of Algorithm 2 for dueling bandits can be decomposed as + +$$ +\mathbf {E} \left[ R _ {T} (k) \right] = \frac {1}{2} \mathbf {E} \left[ R _ {- 1, T} (k) + R _ {+ 1, T} (k) \right]. +$$ + +Proof. The proof follows from + +$$ +\begin{array}{l} \mathbf {E} \left[ \ell_ {- 1, t} (k) + \ell_ {+ 1, t} (k) \right] = \mathbf {E} \left[ o _ {t} \left(k _ {+ 1, t}, k\right) + o _ {t} \left(k _ {- 1, t}, k\right) \right] \\ = \mathbf {E} \left[ P _ {t} \left(k _ {+ 1, t}, k\right) + P _ {t} \left(k _ {- 1, t}, k\right) \right] \\ = 2 - \mathbf {E} \left[ P _ {t} \left(k, k _ {+ 1, t}\right) + P _ {t} \left(k, k _ {- 1, t}\right) \right] \\ \end{array} +$$ + +and + +$$ +\begin{array}{l} \mathbf {E} \left[ \ell_ {- 1, t} (k _ {+ 1, t}) + \ell_ {+ 1, t} (k _ {- 1, t}) \right] \\ = \mathbf {E} \left[ o _ {t} \left(k _ {+ 1, t}, k _ {- 1, t}\right) + o _ {t} \left(k _ {+ 1, t}, k _ {- 1, t}\right) \right] = 1. \\ \end{array} +$$ + +We conclude by summing over $t = 1, \dots, T$ both equations and by substituting them into the definition of the regret $R_{T}(k)$ in (1). + +Note that such a reduction can also be used to bound $R_{T}(k)$ directly rather than its expectation. Saha & Gupta (2022) indeed use this reduction to show a $O(\sqrt{KT})$ high-probability regret upper-bound for adversarial dueling bandit. They also obtain non-stationary regret bounds. + +The main message of this paper is that this reduction can be used to transpose many results from standard multi-armed bandit to general dueling bandits. For instance, applying a subroutine $\mathcal{M}_i$ which is robust to delays (Thune et al., 2019; Zimmert & Seldin, 2020, e.g.,), one directly obtains a dueling bandit with the same robustness guarantees. + +As we said, this reduction is not new. However, to date, it has only been considered in two specific contexts: the adversarial setting with worst-case regret bounds of order $O(\sqrt{KT})$ and the utility-based setting. Since the losses + +$\ell_{i,t} = o_t(k_{-i,t},k)$ are not i.i.d. but depend on an adaptive adversary which chooses $k_{-i,t}$ , one cannot use stochastic bandit algorithms. And theueling bandit community usually needs to resort to more sophisticated algorithms and arguments to obtain logarithmic regret bounds for Condorcet stochasticueling bandits. The only stochasticueling bandit for which such a reduction was considered (Ailon et al., 2014; Zimmert & Seldin, 2021, e.g.,) was the utility based-dueling bandits, which is overly restrictive in practice. That is, when the preference matrix of the form $P_{t}(k,k^{\prime}):(1 + u_{t}(k) + u_{t}(k^{\prime})) / 2$ for some sequence of utility vectors $(u_{t})_{t\geq 1}$ . Utility basedueling bandit are known to be easily reduced to two independent multi-armed bandit problems (Ailon et al., 2014). + +Our main contribution is to show that this reduction can in fact be easily extended to the much weaker Condorcet winner hypothesis. To do this, as we show in the next sections, we simply apply the reduction with a best-of-both-worlds multi-armed bandit algorithm. As we will see, this recovers and improves the best existing upper bounds on the Condorcet regret forueling bandits. + +# 5. Best-of-Both Dueling: Optimal Algorithm for Stochastic and Adversarial DB + +This section contains our main result, which extends the best-of-both-worlds result from Zimmert & Seldin (2021) to dueling bandits. Moreover, it allows us to improve the best existing upper bound on the regret for stochastic and corrupted dueling bandits. The main idea is to apply the "reduction idea" of Algorithm 2 with the multi-armed bandit algorithm (Online Mirror Descent with Tsallis regularizer) of Zimmert & Seldin (2021). + +Online Mirror Descent (or famously abbreviated as OMD) is essentially a follow the regularized leader (FTRL) type algorithm, for any general choice of regularizer (Srebro et al., 2011; Lattimore & Szepesvári, 2020). The famous exponential weight algorithm in online learning (Cesa-Bianchi & Lugosi, 2006; Arora et al., 2012) (or EXP3 algorithm in MAB (Auer et al., 2002b)) is a special instance of OMD algorithm for (-ve) entropy based regularizer. + +It is important to note that, our reduction analysis of Algorithm 3 (see proof of Theorem 3) indicates that we could have used any best-of-both algorithm of MAB as the underlying blackbox algorithm, instead of OMD with Tsallis regularizer (Zimmert & Seldin, 2021). For example, the EXP3 based approach of Bubeck & Slivkins (2012) could have been a potential MAB blackbox algorithm as well, but they do not give optimal regret guarantees due to the use of 'entropic-regularizers' which is not ideal for obtaining the optimal instance (gap)-dependent stochastic regret for MAB. Hence Zimmert & Seldin (2021) motivated the use + +of OMD based Tsallis-Inf algorithm for the best-of both MAB algorithm and our analysis of Theorem 3 shows that the same works for the best-of both DB analysis as well. + +Of course, as for the classical adversarial multi-armed bandits, the losses $\ell_{i,t}(k) = o_t(k_{-i,t},k)$ cannot be observed for all $k\in [K]$ . Therefore, they are estimated in the algorithm with the importance weight estimators + +$$ +\widehat {\ell} _ {i, t} (k) = \left\{ \begin{array}{l l} \ell_ {i, t} (k) / p _ {i, t} (k) & \text {i f} k = k _ {i, t} \\ 0 & \text {o t h e r w i s e} \end{array} . \right. \tag {3} +$$ + +The resulted algorithm is described in Algorithm 3. + +Algorithm 3 Versatile-DB (Best-of-Both DB) + +1: input: Arm set: $[K]$ , Regularizers: $(\Psi_{t})_{t = 1,2,\ldots}$ +2: init: $\widehat{L}_{i,0} \gets \mathbf{0}_K$ for $i \in \{+1, -1\}$ +3: for $t = 1,2,\ldots$ do +4: choose $p_{i,t} = \nabla (\Psi_t + \mathcal{I}_\Delta)^*(-\widehat{L}_{i,t - 1})$ (here $\Delta$ denotes the $K$ -simplex. Refer to Sec. 2 for other notations) +5: For $i\in \{+1, - 1\}$ , sample $k_{i,t}$ from the distribution $(p_{i,t}(1),\dots ,p_{i,t}(K))$ +6: Observe preference feedback $o_{t}(k_{+1,t}, k_{-1,t})$ +7: Compute $\widehat{\ell}_{i,t}(k)$ for $i\in \{+1, - 1\}$ and $k\in [K]$ using (3) +8: update $\widehat{L}_{i,t} = \widehat{L}_{i,t - 1} + \widehat{\ell}_{i,t}$ +9: end for + +Theorem 3 (Regret analysis of Versatile-DB (Alg. 3) for Adversarial and Stochastic Preferences). For any sequence of preference matrices $\mathbf{P}_t$ , the pseudo-regret of Algorithm 3 with $\Psi_t(w) = \sqrt{t} \sum_{k=1}^{K} \left( \frac{\sqrt{w_k} - w_k}{2} \right) / 8$ satisfies for any $T \geq 1$ + +$$ +\overline {{R}} _ {T} := \max _ {k \in [ K ]} \mathbf {E} \left[ R _ {T} (k) \right] \leq 4 \sqrt {K T} + 1. +$$ + +Furthermore, if there exists a gap vector $\Delta \in [0,1]^K$ with a unique zero coordinate $k^* \in [K]$ and $C \geq 0$ such that + +$$ +\bar {R} _ {T} \geq \frac {1}{2} \mathbf {E} \left[ \sum_ {t = 1} ^ {T} \sum_ {k \neq k ^ {*}} \left(p _ {+ 1, t} (k) + p _ {- 1, t} (k)\right) \Delta_ {k} \right] - C, \tag {4} +$$ + +the pseudo regret also satisfies + +$$ +\begin{array}{l} \bar {R} _ {T} \leq \sum_ {k \neq k ^ {*}} \frac {4 \log T + 1 2}{\Delta_ {k}} + 4 \log T + \frac {1}{\Delta_ {\min }} \\ + \frac {3}{2} \sqrt {K} + 8 + C. \\ \end{array} +$$ + +where $\Delta_{\mathrm{min}} = \min_{k\neq k^{*}}\Delta_{k}$ + +The proof is postponed to Appendix B. Note that the theorem largely follows from (and is itself highly similar to) + +the best-of-both worlds regret-bound of Zimmert & Seldin (2021, Theorem 1) for MAB. The proof is just a clever combination of their MAB analysis with our black box reduction (Theorem 2). But we believe that the simplicity of our approach is its strength that can benefit the community of dueling bandits. As we will see, several state-of-the-art results of dueling bandits can be simultaneously improved as a direct consequence of this theorem, including the order optimal regret bounds for stochastic DB against condorcet winner or DB with adversarial corruption, as discussed in Sec. 6.1 and 6.2 respectively. + +Note that for simplicity, we restricted ourselves to importance weighted estimators (3). By using more sophisticated variance reduced estimators, as in Zimmert & Seldin (2021), the multiplicative constants can be reduced. Furthermore, similar to Zimmert & Seldin (2021), the result holds only for the pseudo-regret and not for the true regret. Auer & Chiang (2016) have indeed proven that no optimal adversarial and stochastic high probability regret bounds can be obtained simultaneously for standard stochastic bandits. The learner must pay suboptimal logarithmic factors. The result can be extended toueling bandits. + +It is worth to emphasize that this is the first best-of-both worlds regret bound for general dueling bandits (the stochastic bound follows from the choice $C = 0$ , see Sec 6.1). Zimmert & Seldin (2021, Cor. 10) obtain a similar result for the very same algorithm but for utility based dueling bandits only. + +Remark 2. Note that a single sub-routine of OMD to optimize the weights is actually enough to get the same regret guarantee. To do so, one samples both $k_{-1,t}$ and $k_{+1,t}$ independently from the same distribution $\mathbf{p}_t = \nabla (\psi_t + \mathcal{I}_{\Delta})^* (-\widehat{L}_{t - 1})$ . Here, $\widehat{L}_t = \sum_{s = 1}^t\widehat{\ell}_s\in \mathbb{R}_+^K$ and the importance weight estimator are defined for all $k\in [K]$ by + +$$ +\widehat {\ell} _ {t} (k) = \frac {1}{2} \left(\widehat {\ell} _ {- 1, t} (k) + \widehat {\ell} _ {+ 1, t} (k)\right). +$$ + +Noting that $\mathbf{E}[\widehat{\ell}_t(k)] = \mathbf{E}\big[P_t(k_{-1,t},k) + P_t(k_{+1,t},k)\big] / 2$ and $\mathbf{E}\big[\sum_{k = 1}^{K}p_t(k)\widehat{\ell}_t(k)\big] = \mathbf{E}\big[P_t(k_{-1,t},k_{+1,t}) + P_t(k_{+1,t},k_{-1,t})\big] / 2 = 1 / 2,$ the proof follows similarly to the other one. Though the regret upper-bound is exactly the same, we believe that this version might lead to better performance because the two players share information. + +# 6. Improvements Over Existing Dueling Bandit Results + +Also our approach and analysis is rather simple, it allows to outperform the best existing regret-upper bounds for stochastic dueling bandits with or without corruption. We believe that the dueling bandit community will benefit from this reduction and that it may be applied to a wider scope such + +as to deal with non-stationarity, delays, or non-standard feedbacks (graphs) for which many results already exist in standard multi-armed bandits. + +# 6.1. Stochastic dueling bandits with Condorcet winner + +In stochastic dueling bandits, the preference matrices $\mathbf{P}_t$ are fixed over time $\mathbf{P}_t = \mathbf{P}$ for all $t\geq 1$ . Under the Condorcet winner assumption there exists $k^{(\mathrm{cw})}\in [K]$ such that $P(k^{(\mathrm{cw})},k) > \frac{1}{2}$ for all $k\neq k^{(\mathrm{cw})}$ . Then, the suboptimality gaps of all actions $k\in [K]$ are defined as $\Delta_k\coloneqq P(k^{(\mathrm{cw})},k) - \frac{1}{2}$ . Remarking that in this case the self-bounding assumption (4) is satisfied with $C = 0$ , since + +$$ +\begin{array}{l} \overline {{R}} _ {T} = \frac {1}{2} \sum_ {t = 1} ^ {T} \mathbf {E} \left[ P _ {t} \left(k ^ {\left(\mathrm {c w}\right)}, k _ {+ 1, t}\right) + P _ {t} \left(k ^ {\left(\mathrm {c w}\right)}, k _ {- 1, t}\right) - 1 \right] \\ = \frac {1}{2} \sum_ {t = 1} ^ {T} \mathbf {E} \left[ \Delta_ {k _ {+ 1, t}} + \Delta_ {k _ {- 1, t}} \right] \\ = \frac {1}{2} \sum_ {t = 1} ^ {T} \mathbf {E} \left[ \sum_ {k \neq k ^ {(c w)}} (p _ {- 1, t} + p _ {+ 1, t}) \Delta_ {k} \right], \\ \end{array} +$$ + +we get the following corollary from Theorem 3. + +Corollary 1 (Regret analysis of Versatile-DB (Alg. 3) for Stochastic Preferences against Condorcet Winner). For stochastic dueling bandits with Condorcet winner, the pseudo-regret of Algorithm 3 with well-chosen parameters satisfies + +$$ +\bar {R} _ {T} \leq \sum_ {k \neq k ^ {(c w)}} \frac {4 \log T + 1 2}{\Delta_ {k}} + 4 \log T + \frac {1}{\Delta_ {\min }} + \frac {3}{2} \sqrt {K} + 8. +$$ + +Note that the above bound is the first pseudo-regret upperbound for stochastic dueling bandit that does not suffer from a $\Delta_{\mathrm{min}}^{-2}$ dependence under the Condorcet winner assumption, without a quadratic dependence on the number of arms, $K$ which is a concern when it comes to dealing with largescale problems. For instance, RUCB (Zoghi et al., 2014a) satisfies a regret bound of order $O(K\log (T)\Delta_{\mathrm{min}}^{-2} + K^2)$ , MergeRUCB (Zoghi et al., 2015b) has linear dependence on $K$ but suffers $O(K\log (T)\Delta_{\mathrm{min}}^{-2})$ . Finally, RMED from (Komiyama et al., 2015) is asymptotically optimal when $T\to \infty$ but also suffers from large constant terms ( $K^2$ and $\Delta_{\mathrm{min}}^{-2}$ ) and is only valid for $K\to \infty$ . We refer the reader to (Bengs et al., 2021) for existing results on stochastic dueling bandits. + +# 6.2. Corrupted regime + +Here, we consider the stochastic dueling bandit problem in the presence of adversarial corruptions. The robustness to adversarial corruption has known recent progress in the MAB setting (Gupta et al., 2019; Lykouris et al., 2018; + +Zimmert & Seldin, 2021) and has recently been extended to the DB framework (Agarwal et al., 2021). The preference matrices are fixed $\mathbf{P}_t = \mathbf{P}$ for all $t \geq 1$ and we assume the existence of a Condorcet winner $k^{(cw)}$ . Furthermore, an adversary may corrupt the outcomes of some duels by replacing the results of the duels $o_t(k,k')$ with corrupted ones $\tilde{o}_t(k,k')$ . At the end of each round, the player only observes $\tilde{o}_t(k_{+1,t},k_{-1,t})$ . The objective of the player is to minimize the pseudo-regret $\bar{R}_T$ under a bounded total amount of corruption + +$$ +C := \sum_ {t = 1} ^ {T} \sum_ {k \neq k ^ {\left(\mathrm {c w}\right)}} \left| o _ {t} \left(k ^ {\left(\mathrm {c w}\right)}, k\right) - \tilde {o} _ {t} \left(k ^ {\left(\mathrm {c w}\right)}, k\right) \right|. +$$ + +We show here that similarly to what happens for standard Multi-armed bandits in Zimmert & Seldin (2021), this corrupted setting is a special case of the self-bounding assumption (4). Indeed, defining $\tilde{\mathbf{P}}_t$ the corrupted preference matrices by $\tilde{P}_t(k,k') = \mathbf{E}\big[\bar{o}_t(k,k')\big]$ and the corrupted pseudo-regret + +$$ +\widetilde {R} _ {T} (k) = \frac {1}{2} \mathbf {E} \left[ \sum_ {t = 1} ^ {T} \tilde {P} _ {t} (k, k _ {+ 1, t}) + P _ {t} (k, k _ {- 1, t}) - 1 \right], +$$ + +we have + +$$ +\begin{array}{l} \widetilde {R} _ {T} (k ^ {(c w)}) \\ = \frac {1}{2} \mathbf {E} \left[ \sum_ {t = 1} ^ {T} \tilde {o} _ {t} \left(k ^ {\left(\mathrm {c w}\right)}, k _ {+ 1, t}\right) + \tilde {o} _ {t} \left(k ^ {\left(\mathrm {c w}\right)}, k _ {- 1, t}\right) - 1 \right] \\ \geq \frac {1}{2} \mathbf {E} \left[ \sum_ {t = 1} ^ {T} o _ {t} \left(k ^ {\left(\mathrm {c w}\right)}, k _ {+ 1, t}\right) + o _ {t} \left(k ^ {\left(\mathrm {c w}\right)}, k _ {- 1, t}\right) - 1 \right] - C \\ = \bar {R} _ {T} - C \\ = \frac {1}{2} \sum_ {t = 1} ^ {T} \mathbf {E} \left[ \sum_ {k \neq k ^ {(c w)}} (p _ {- 1, t} + p _ {+ 1, t}) \Delta_ {k} \right] - C. \\ \end{array} +$$ + +Therefore, the corrupted regime satisfies the self-bounding assumption (4). Applying Theorem 3 on the corrupted regime and using that we also have $\overline{R}_T(k^{(cw)}) \leq \widetilde{R}_T(k^{(cw)}) + C$ , we get the following corollary. + +Corollary 2 ([Regret analysis of Versatile-DB (Alg. 3) for Stochastic Preferences against Condorcet Winner with a maximum adversarial Corruption $C$ ). For stochastic dueling bandits with Condorcet winner and adversarial corruptions (bounded by $C$ ), the pseudo-regret $\overline{R}_T$ Algorithm 3 is upper-bounded as + +$$ +\begin{array}{l} \bar {R} _ {T} \leq \sum_ {k \neq k ^ {(c w)}} \frac {4 \log T + 1 2}{\Delta_ {k}} + 4 \log T \\ + \frac {1}{\Delta_ {\operatorname* {m i n}}} + \frac {3}{2} \sqrt {K} + 8 + 2 C. \\ \end{array} +$$ + +Although Corollary 2 easily follows from Theorem 3 which itself easily follows from Theorem 1 of Zimmert & Seldin (2021), the latter result significantly improves upon the recent results onueling bandit with corruptions obtained by Agarwal et al. (2021). Indeed, the latter provide for the same setting and a significantly more sophisticated procedure a high-probability regret bound of order + +$$ +O \left(\frac {K ^ {2} C}{\Delta_ {\operatorname* {m i n}}} + \sum_ {k \neq k ^ {(c w)}} \frac {K ^ {2}}{\Delta_ {k} ^ {2}} \log \left(\frac {K}{\Delta_ {k}}\right) + \sum_ {k \neq k ^ {(c w)}} \frac {\log T}{\Delta_ {k}}\right). +$$ + +As often in theueling bandit literature, it suffers from both a quadratic dependence on the number of actions and $\Delta_{\mathrm{min}}^{-1}$ . Furthermore, our regret bound is sublinear in $T$ as soon as the corruption level is $o(T)$ while Agarwal et al. (2021) can only afford $o(\Delta_{\mathrm{min}}T / K^2)$ . + +Moreover, Zimmert & Seldin (2021) also provide an upper-bound for stochastic bandits with adversarial corruption. The latter is of order $O\left(\sum_{k \neq k^{(cw)}} \frac{\log T}{\Delta_k} + \sqrt{C \sum_{k \neq k^{(cw)}} \frac{\log T}{\Delta_k}}\right)$ , which seems to outperform our bound when $C$ is large. The difference is since they upper-bound the corrupted regret $\widetilde{R}_T(k^{(cw)})$ and not $\bar{R}_T$ . + +# 7. Experiments + +Algorithms. We compared the performances of the following algorithms: 1. VDB: Our proposed Versatile-DB (Alg. 3) algorithm. 2. RUCB: The algorithm proposed in Zoghi et al. (2014a) for K-armed stochastic dueling bandits for CW regret. (We set the algorithm parameter $\alpha = 0.6$ ). 3. RMED: Another algorithm for CW regret as proposed in Komiyama et al. (2015). (We set the algorithm parameter $f(K) = 0.3K^{1.01}$ as suggested in their experimental evaluation). 4. DTS: The double thompson sampling algorithm of Wu & Liu (2016). (Here again we set the similar algorithm parameter $\alpha = 0.5$ as used in the experiments of Wu & Liu (2016)). 5. REX3: As introduced in Gajane et al. (2015). Note that their suggested optimal tuning parameters, i.e. the uniform exploration rate $\gamma$ as well as the learning rate $\eta$ requires the knowledge of problem dependent parameters $\tau$ (see Thm. 1 of Gajane et al. (2015)) which are unknown to the learner. We used $T$ in place of $\tau$ henceforth. + +Performance Measures. We report the average cumulative regret (Eqn. (1)) of the algorithms averaged over 20 runs. + +# 7.1. Stochastic Preferences + +We compared their regret performance across the following stochastic environments: + +Constructing Preference Matrices (P). We use four different utility parameter $\pmb{\theta} = (\theta_{1},\dots,\theta_{K})$ based preference + +models where the underlying preference model is defined as $P(i,j) \coloneqq \frac{\theta_i}{\theta_i + \theta_j} \forall i, j \in [K]$ . The model is famously studied as BTL model or more generally Plackett-Luce model (Saha & Gopalan, 2019b; Chen et al., 2018; Negahban et al., 2017). Note this ensures $P$ to have total-ordering (Yue & Joachims, 2011; Falahatgar et al., 2017). + +In particular we consider the following choices of $\theta$ : 1. Trivial 2. Easy 3. Medium, and 4. Hard with their respective $\theta$ parameters are given by: 1. Trivial: $\theta(1) = 1$ , $\theta(2: K) = 0.5$ . 2. Easy: $\theta(1: \lfloor K/2 \rfloor) = 1$ , $\theta(\lfloor K/2 \rfloor + 1: K) = 0.5$ . 3. Medium: $\theta(1: \lfloor K/3 \rfloor) = 1$ , $\theta(\lfloor K/3 \rfloor + 1: \lfloor 2K/3 \rfloor) = 0.7$ , $\theta(\lfloor 2K/3 \rfloor + 1: K) = 0.4$ . 4. Hard: $\theta(i) = 1 - (i-1)/K$ , $\forall i \in [K]$ . Note for each instance the best-arm is arm-1 and the optimal ordering on the arms is $(1 > 2 > \ldots, K)$ . For the purpose of our experiments we set $K = 10$ . We also evaluated the algorithms on two general $10 \times 10$ preference matrices $Car$ and $Hurdy$ as also used in Niranjan & Rajkumar (2017); Saha & Gopalan (2018a). + +![](images/1f38e1edb5f73b4951280624d6d97035ba94f83f333373174f8a1724877fb03f.jpg) + +![](images/47974b3c17c9b1966f318bdf01d98416223db9dfc50882a611f9b021383d5222.jpg) + +![](images/56ed49ae22c287ea8db48cece7648cee596e57d6274852feb4a0e0ebcc7d9fe2.jpg) + +![](images/b30994f05d6a6be55996fe01e09b86218c96339abe1284aac95e86b8f876b40d.jpg) + +![](images/7a60378ddba866b9068d94a8b72b6d143668314b9f79d76ce1a70d5b526e0219.jpg) +Figure 1. Averaged cumulative regret over time + +![](images/9a40265dfb77b7a6dd88343ee73a1c226d8e352ccafa40f8790263272fb6cfb0.jpg) + +Regret vs Time. Fig. 1 shows the relative performances of different algorithms with time. As follows from the plots, in general VDB (Versatile-DB) outperforms the rest in all instances, with DTS being closely competitive in some cases. In terms of the problem hardness, as their names suggest too, the Trivial and Easy instances are easiest to learn as the best-vs-worst item preferences are well separated in these cases and the diversity of the item preferences across different groups are least. Consequently the algorithms yield slightly more regret on instance-Medium due to higher preference diversity, and the hardest instance being Hard where the algorithms require maximum time to converge, though VDB reaching the convergence fastest still. + +# 7.2. Corrupted Preferences + +We also evaluated the performances of algorithms in presence of corruption (Sec. 6.2). In particular, Fig. 2 and 3 respectively shows the relative performances of the algorithms + +![](images/7b329af286adac60ead11a5b8455e09c94f6322daaaf4c3f703bf6c97ec21638.jpg) +Figure 2. Averaged cumulative regret (20% corrupted feedback) + +![](images/05e033af7ef7cedc18e4238d5ba87a5fd9c192e3bce56017e827c84cd3fe111b.jpg) + +![](images/5662c791781bfb2dc4d0fb869e8820aff28451212e77b9e5fb47c5701c412eda.jpg) +Figure 3. Averaged cumulative regret (40% corrupted feedback) + +![](images/32992866ca96034fab4b701ced24f8b1d5ddc93681b46f630268d14be1f0c48a.jpg) + +with $20\%$ and $40\%$ corrupted feedback (at each round, we flip the winner feedback with that certain probability) respectively on Medium and Hard Plackett-Luce instances. As expected, the performances of all the algorithms decay significantly with increasing degree of feedback-corruption, however as before, VDB consistently performed best over all the baselines and tend to converge the fastest among all. + +# 7.3. Adversarial Preferences + +In Fig. 4, we also studied the case of adversarial preferences setup (as discussed in Thm. 3 or Sec. 5). The following two plots show the superior performance of VDB on two sequences of adversarial preferences for $K = 10$ (1). Switching Best-Arm [Switch(500)]: Here we tweaked $P_{t}$ s such that the best-arm changes after every 500 rounds, and Random-Walk [RW(0.01)]: Here we generated the sequences of preferences $P_{t}(i,j)$ for all pairs of arms $(i,j)$ as random walks with increment parameter $\pm 0.01$ . Any values that fall outside [0, 1] are truncated back to [0, 1]. Both these settings were considered in (Neu & Valko, 2014; Saha et al., 2020; 2021) for generating adversarial sequences (of rewards or preferences). + +![](images/d47f6cd33ee3e14f4a32f415657f65f36e30881c4ff1acfb7bc3758432c17af2.jpg) +Figure 4. Avg. Regret for Adversarial preferences $(K = 10)$ + +![](images/ee12397bbe92546133e74276dd53db4cb0bfaa9a699a1739ee08191a47976cf8.jpg) + +# 8. Discussions + +We studied the problem of Versatile Dueling Bandits, which gives the first 'best-of-both' world result for the problem of Dueling Bandits. The crux of our analyses relies on a novel idea of decomposing the Dueling bandit regret into multiarmed bandit (MAB) regret by interpreting theueling preference feedback as a certain realization of adversarial reward sequence. An important byproduct of our best-of-both Dueling analysis is, this gives the first order + +optimal gap-dependent regret bound for $K$ -armed stochastic dueling bandits, closing the decade-long open problem of tightness of 'Condorcet dueling bandit regret'. Further we also analyze the robustness of our algorithm under corrupted preference feedback setting, which provably improves over the state-of-the-art corrupted dueling bandits algorithms. + +Future Works. Proving the first best-of-both world result forueling bandits using our novel reduction idea is just a first step towards exploring the possibility of understanding how far this idea can be extended to apply existing multiarmed bandits results toueling bandits frameworks, instead of putting individual and isolated efforts in developingueling bandit algorithms, taking inspirations from existing MAB generalizations. Some such extensions could be to analyze dynamicueling bandit regret under nonstationary preferences (Wei & Luo, 2021; Chen et al., 2019; Besbes et al., 2015), item non-availability (Neu & Valko, 2014; Kanade et al., 2009), delayed feedback (Vernade et al., 2018; Pike-Burke et al., 2018; Thune et al., 2019), budget constraints (Immorlica et al., 2019; Zhou & Tomlin, 2018; Ding et al., 2013), or even the more general reinforcement learning (RL) scenarios (Auer et al., 2009; Talebi & Maillard, 2018; Ng et al., 2006), for which there are already well established theory of works with MAB framework. Also under what settings ofueling Bandits, its corresponding MAB counterpart based reductions are bound to fail? + +Finally it is worth mentioning that, an ambitious (and broad) objective along these line of thoughts is to understand the connection between different learning scenarios toueling bandits, e.g. feedback graphs (Alon et al., 2015; 2017), partial monitoring problems (Lattimore & Szepesvári, 2019; Mannor et al., 2014; Lin et al., 2014), markov games (Xie et al., 2020; Bai et al., 2020; Bai & Jin, 2020), etc. The obvious motivation being to understand how far we can reengineer the existing results from related learning literature to solve the online preference bandits problems. + +# Acknowledgement + +We thank the anonymous reviewers for their insightful suggestions to improve the paper. + +# References + +Agarwal, A., Agarwal, S., and Patil, P. Stochastic dueling bandits with adversarial corruption. In Algorithmic Learning Theory, pp. 217-248. PMLR, 2021. +Ailon, N., Karnin, Z., and Joachims, T. Reducing dueling bandits to cardinal bandits. In International Conference on Machine Learning, pp. 856-864. PMLR, 2014. +Alon, N., Cesa-Bianchi, N., Dekel, O., and Koren, T. Online learning with feedback graphs: Beyond bandits. In + +JMLR Workshop and Conference Proceedings, volume 40. Microtome Publishing, 2015. +Alon, N., Cesa-Bianchi, N., Gentile, C., Mannor, S., Mansour, Y., and Shamir, O. Nonstochastic multi-armed bandits with graph-structured feedback. SIAM Journal on Computing, 46(6):1785-1826, 2017. +Arora, S., Hazan, E., and Kale, S. The multiplicative weights update method: a meta-algorithm and applications. Theory of computing, 8(1):121-164, 2012. +Auer, P. and Chiang, C.-K. An algorithm with nearly optimal pseudo-regret for both stochastic and adversarial bandits. In Conference on Learning Theory, pp. 116-120. PMLR, 2016. +Auer, P., Cesa-Bianchi, N., and Fischer, P. Finite-time analysis of the multiarmed bandit problem. Machine learning, 47(2-3):235-256, 2002a. +Auer, P., Cesa-Bianchi, N., Freund, Y., and Schapire, R. E. The nonstochastic multiarmed bandit problem. SIAM journal on computing, 32(1):48-77, 2002b. +Auer, P., Jaksch, T., and Ortner, R. Near-optimal regret bounds for reinforcement learning. In Advances in neural information processing systems, pp. 89-96, 2009. +Bai, Y. and Jin, C. Provable self-play algorithms for competitive reinforcement learning. In International Conference on Machine Learning, pp. 551-560. PMLR, 2020. +Bai, Y., Jin, C., and Yu, T. Near-optimal reinforcement learning with self-play. In Advances in Neural Information Processing Systems, 2020. +Bengs, V., Busa-Fekete, R., El Mesaoudi-Paul, A., and Hüllermeier, E. Preference-based online learning with dueling bandits: A survey. J. Mach. Learn. Res., 22:7-1, 2021. +Besbes, O., Gur, Y., and Zeevi, A. Non-stationary stochastic optimization. Operations research, 63(5):1227-1244, 2015. +Brost, B., Seldin, Y., Cox, I. J., and Lioma, C. Multi-dueling bandits and their application to online ranker evaluation. CoRR, abs/1608.06253, 2016. +Bubeck, S. and Slivkins, A. The best of both worlds: Stochastic and adversarial bandits. In Conference on Learning Theory, pp. 42-1. JMLR Workshop and Conference Proceedings, 2012. +Busa-Fekete, R., Szorenyi, B., Cheng, W., Weng, P., and Hüllermeier, E. Top-k selection based on adaptive sampling of noisy preferences. In International Conference on Machine Learning, pp. 1094-1102, 2013. + +Busa-Fekete, R., Szörenyi, B., and Hüllermeier, E. PAC rank elicitation through adaptive sampling of stochastic pairwise preferences. In AAAI, pp. 1701-1707, 2014. +Cesa-Bianchi, N. and Lugosi, G. Prediction, learning, and games. Cambridge university press, 2006. +Chen, B. and Frazier, P. I. Dueling bandits with weak regret arXiv preprint arXiv:1706.04304, 2017. +Chen, X., Li, Y., and Mao, J. A nearly instance optimal algorithm for top-k ranking under the multinomial logit model. In Proceedings of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 2504-2522. SIAM, 2018. +Chen, Y., Lee, C.-W., Luo, H., and Wei, C.-Y. A new algorithm for non-stationary contextual bandits: Efficient, optimal, and parameter-free. In Proceedings of the 32nd Conference on Learning Theory, 99:1-30, 2019. +Ding, W., Qin, T., Zhang, X.-D., and Liu, T.-Y. Multiarmed bandit with budget constraint and variable costs. In Twenty-Seventh AAAI Conference on Artificial Intelligence, 2013. +Dudík, M., Hofmann, K., Schapire, R. E., Slivkins, A., and Zoghi, M. Contextual dueling bandits. In Conference on Learning Theory, pp. 563-587, 2015. +Falahatgar, M., Hao, Y., Orlitsky, A., Pichapati, V., and Ravindrakumar, V. Maxing and ranking with few assumptions. In Advances in Neural Information Processing Systems, pp. 7063-7073, 2017. +Falahatgar, M., Jain, A., Orlitsky, A., Pichapati, V., and Ravindrakumar, V. The limits of maxing, ranking, and preference learning. In International Conference on Machine Learning, pp. 1427-1436. PMLR, 2018. +Gajane, P., Urvoy, T., and Clerot, F. A relative exponential weighing algorithm for adversarial utility-based dueling bandits. In Proceedings of the 32nd International Conference on Machine Learning, pp. 218-227, 2015. +Gupta, A., Koren, T., and Talwar, K. Better algorithms for stochastic bandits with adversarial corruptions. In Conference on Learning Theory, pp. 1562-1578. PMLR, 2019. +Immorlica, N., Sankararaman, K. A., Schapire, R., and Slivkins, A. Adversarial bandits with knapsacks. In 2019 IEEE 60th Annual Symposium on Foundations of Computer Science (FOCS), pp. 202-219. IEEE, 2019. +Jamieson, K., Katariya, S., Deshpande, A., and Nowak, R. Sparse dueling bandits. In Artificial Intelligence and Statistics, pp. 416-424. PMLR, 2015. + +Kanade, V., McMahan, H. B., and Bryan, B. Sleeping experts and bandits with stochastic action availability and adversarial rewards. 2009. +Komiyama, J., Honda, J., Kashima, H., and Nakagawa, H. Regret lower bound and optimal algorithm in dueling bandit problem. In $COLT$ , pp. 1141-1154, 2015. +Komiyama, J., Honda, J., and Nakagawa, H. Copeland, dueling bandit problem: Regret lower bound, optimal algorithm, and computationally efficient algorithm. arXiv preprint arXiv:1605.01677, 2016. +Kumagai, W. Regret analysis for continuous dueling bandit. In Advances in Neural Information Processing Systems, 2017. +Lattimore, T. and Szepesvári, C. An information-theoretic approach to minimax regret in partial monitoring. In Conference on Learning Theory, pp. 2111-2139. PMLR, 2019. +Lattimore, T. and Szepesvári, C. Bandit algorithms. Cambridge University Press, 2020. +Lin, T., Abrahao, B., Kleinberg, R., Lui, J., and Chen, W. Combinatorial partial monitoring game with linear feedback and its applications. In International Conference on Machine Learning, pp. 901-909. PMLR, 2014. +Lykouris, T., Mirrokni, V., and Paes Leme, R. Stochastic bandits robust to adversarial corruptions. In Proceedings of the 50th Annual ACM SIGACT Symposium on Theory of Computing, pp. 114-122, 2018. +Mannor, S., Perchet, V., and Stoltz, G. Set-valued approachability and online learning with partial monitoring. The Journal of Machine Learning Research, 15(1):3247-3295, 2014. +Negahban, S., Oh, S., and Shah, D. Rank centrality: Ranking from pairwise comparisons. Operations Research, 65 (1):266-287, 2017. +Neu, G. and Valko, M. Online combinatorial optimization with stochastic decision sets and adversarial losses. In Advances in Neural Information Processing Systems, pp. 2780-2788, 2014. +Ng, A. Y., Coates, A., Diel, M., Ganapathi, V., Schulte, J., Tse, B., Berger, E., and Liang, E. Autonomous inverted helicopter flight via reinforcement learning. In Experimental robotics IX, pp. 363-372. Springer, 2006. +Niranjan, U. and Rajkumar, A. Inductive pairwise ranking: going beyond the n log (n) barrier. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 31, 2017. + +Pike-Burke, C., Agrawal, S., Szepesvari, C., and Grunewalder, S. Bandits with delayed, aggregated anonymous feedback. In International Conference on Machine Learning, pp. 4105-4113, 2018. +Ren, W., Liu, J., and Shroff, N. B. PAC ranking from pairwise and listwise queries: Lower bounds and upper bounds. arXiv preprint arXiv:1806.02970, 2018. +Saha, A. Optimal algorithms for stochastic contextual dueling bandits. In Advances in Neural Information Processing Systems, 2021. +Saha, A. and Gaillard, P. Dueling bandits with adversarial sleeping. Advances in Neural Information Processing Systems, 34, 2021. +Saha, A. and Gopalan, A. Battle of bandits. In Uncertainty in Artificial Intelligence, 2018a. +Saha, A. and Gopalan, A. Active ranking with subset-wise preferences. International Conference on Artificial Intelligence and Statistics (AISTATS), 2018b. +Saha, A. and Gopalan, A. Combinatorial bandits with relative feedback. In Advances in Neural Information Processing Systems, 2019a. +Saha, A. and Gopalan, A. PAC Battling Bandits in the Plackett-Luce Model. In Algorithmic Learning Theory, pp. 700-737, 2019b. +Saha, A. and Gopalan, A. From pac to instance-optimal sample complexity in the plackett-luce model. In International Conference on Machine Learning, pp. 8367-8376. PMLR, 2020. +Saha, A. and Gupta, S. Optimal and efficient dynamic regret algorithms for non-stationary dueling bandits. In International Conference on Machine Learning. PMLR, 2022. +Saha, A. and Krishnamurthy, A. Efficient and optimal algorithms for contextual dueling bandits under realizability arXiv preprint arXiv:2111.12306, 2021. +Saha, A., Gaillard, P., and Valko, M. Improved sleeping bandits with stochastic action sets and adversarial rewards In International Conference on Machine Learning, pp 8357-8366. PMLR, 2020. +Saha, A., Koren, T., and Mansour, Y. Adversarial dueling bandits. In International Conference on Machine Learning, pp. 9235-9244. PMLR, 2021. +Srebro, N., Sridharan, K., and Tewari, A. On the universality of online mirror descent. Advances in neural information processing systems, 24, 2011. + +Sui, Y., Zoghi, M., Hofmann, K., and Yue, Y. Advancements in dueling bandits. In *IJCAI*, pp. 5502-5510, 2018. +Szorenyi, B., Busa-Fekete, R., Paul, A., and Hullermeier, E. Online rank elicitation for plackett-luce: A dueling bandits approach. In Advances in Neural Information Processing Systems, pp. 604-612, 2015. +Talebi, M. S. and Maillard, O.-A. Variance-aware regret bounds for undiscounted reinforcement learning in mdps. arXiv preprint arXiv:1803.01626, 2018. +Thune, T. S., Cesa-Bianchi, N., and Seldin, Y. Nonstochastic multiarmed bandits with unrestricted delays. In Advances in Neural Information Processing Systems, pp. 6541-6550, 2019. +Vernade, C., Carpentier, A., Lattimore, T., Zappella, G., Ermis, B., and Brueckner, M. Linear bandits with stochastic delayed feedback. arXiv preprint arXiv:1807.02089, 2018. +Wei, C.-Y. and Luo, H. Non-stationary reinforcement learning without prior knowledge: An optimal black-box approach. In Proceedings of the 32nd International Conference on Learning Theory, 2021. +Wu, H. and Liu, X. Double Thompson sampling for dueling bandits. In Advances in Neural Information Processing Systems, pp. 649-657, 2016. +Xie, Q., Chen, Y., Wang, Z., and Yang, Z. Learning zero-sum simultaneous-move markov games using function approximation and correlated equilibrium. In Conference on Learning Theory, 2020. +Yue, Y. and Joachims, T. Interactively optimizing information retrieval systems as a dueling bandits problem. In Proceedings of the 26th Annual International Conference on Machine Learning, pp. 1201-1208. ACM, 2009. +Yue, Y. and Joachims, T. Beat the mean bandit. In Proceedings of the 28th International Conference on Machine Learning (ICML-11), pp. 241-248, 2011. +Yue, Y., Broder, J., Kleinberg, R., and Joachims, T. The $k$ -armed dueling bandits problem. Journal of Computer and System Sciences, 78(5):1538-1556, 2012. +Zhou, D. P. and Tomlin, C. J. Budget-constrained multiarmed bandits with multiple plays. In Thirty-Second AAAI Conference on Artificial Intelligence, 2018. +Zimmert, J. and Seldin, Y. An optimal algorithm for stochastic and adversarial bandits. In The 22nd International Conference on Artificial Intelligence and Statistics, pp. 467-475. PMLR, 2019. + +Zimmert, J. and Seldin, Y. An optimal algorithm for adversarial bandits with arbitrary delays. In International Conference on Artificial Intelligence and Statistics, pp. 3285-3294. PMLR, 2020. +Zimmert, J. and Seldin, Y. Tsallis-inf: An optimal algorithm for stochastic and adversarial bandits. J. Mach. Learn. Res., 22:28-1, 2021. +Zoghi, M., Whiteson, S., Munos, R., Rijke, M. d., et al. Relative upper confidence bound for the $k$ -armed dueling bandit problem. In JMLR Workshop and Conference Proceedings, number 32, pp. 10-18. JMLR, 2014a. +Zoghi, M., Whiteson, S. A., De Rijke, M., and Munos, R. Relative confidence sampling for efficient on-line ranker evaluation. In Proceedings of the 7th ACM international conference on Web search and data mining, pp. 73-82. ACM, 2014b. +Zoghi, M., Karnin, Z. S., Whiteson, S., and De Rijke, M. Copeland dueling bandits. In Advances in Neural Information Processing Systems, pp. 307-315, 2015a. +Zoghi, M., Whiteson, S., and de Rijke, M. Mergerucb: A method for large-scale online ranker evaluation. In Proceedings of the Eighth ACM International Conference on Web Search and Data Mining, pp. 17-26. ACM, 2015b. + +# Supplementary: Versatile Dueling Bandits: Best-of-both World Analyses for Online Learning from Relative Preferences + +# A. Regret analysis of Algorithm 1 + +Theorem 1 (Regret analysis of RR-DB (Alg. 1) for Stochastic Preferences against Condorcet Winner). Assume any instance of stochastic dueling bandit problem with Condorcet Winner $k^{(cw)} = 1$ . Let $\delta \in (0,1/2)$ , for any $T \geq 1$ , the regret of Algorithm 1 is upper-bounded with probability at least $1 - \delta$ as + +$$ +R _ {T} ^ {(c w)} \leq \frac {K ^ {2}}{2} + 4 \sum_ {i = 2} ^ {K} \frac {(i - 1) \log (K T / \delta)}{\Delta_ {i}}. +$$ + +Further, when $T \geq K^2$ , in the worst case (over the problem instance, i.e. $\Delta_2, \ldots, \Delta_K$ ), the regret of Algorithm 1 can be upper bounded as: + +$$ +R _ {T} ^ {(c w)} \leq 2 K \sqrt {T \log (K T / \delta)}. +$$ + +Proof of Theorem 1. Let us denote by + +$$ +u _ {i j} (t) := \widehat {p} _ {i j} (t) + c _ {i j} (t) +$$ + +for any pair $(i,j)$ and time $t$ , where + +$$ +c _ {i j} (t) := \sqrt {\frac {\log (K t / \delta)}{n _ {i j} (t)}}, +$$ + +and assume $\Delta_2 \leq \Delta_3 \leq \dots \leq \Delta_K$ without loss of generality. We will also assume the confidence bounds of Lem. 4 hold good for all $t \in [T]$ and all pairs $(i,j)$ , which is shown to hold good with probability at least $1 - \delta$ . In particular, this implies that the best arm cannot be eliminated, i.e., $1 \in \mathcal{A}_t$ for all $t \geq 1$ . + +We start by noting that if the worst arm $K$ (since $\Delta_K = \max_{i=2}^K \Delta_i$ , arm-K gets maximally beaten by the CW) is played at time $t$ , it means $u_{K1}(t) \geq \frac{1}{2}$ . However we also have, + +$$ +\begin{array}{l} u _ {K 1} (t) = \widehat {p} _ {K 1} (t) + c _ {K 1} (t) \\ \leq p _ {K 1} + 2 c _ {K 1} (t) = 1 / 2 - \Delta_ {K} + 2 c _ {K 1} (t), \\ \end{array} +$$ + +where the inequality holds due to Lem. 4 and the last equality holds by noting $p_{K1} = 1 - p_{1K} = 1 - (1/2 + \Delta_K) = 1/2 - \Delta_K$ . So $u_{K1}(t) > 1/2$ can only hold good if $c_{K1}(t) > \Delta_K / 2$ which implies, + +$$ +n _ {K 1} (t) \leq \frac {4 \log (K t / \delta)}{\Delta_ {K} ^ {2}}. \tag {5} +$$ + +But by the our algorithm design since all the pairs are drawn in a round robin fashion, at any round $t \in [T]$ , for any two distinct pairs $(i,j)$ and $(i',j')$ that are in $\mathcal{A}_t$ note that + +$$ +\left| n _ {i j} (t) - n _ {i ^ {\prime} j ^ {\prime}} (t) \right| \leq 1. \tag {6} +$$ + +Thus the total regret incurred by Alg. 1 at rounds where $K \in \{k_{+1,t}, k_{-1,t}\}$ , can be upper bounded as: + +$$ +\begin{array}{l} \sum_ {t = 1} ^ {T} \sum_ {k < K} \mathbf {1} (\{k _ {+ 1, t}, k _ {- 1, t} \} = \{k, K \}) \frac {\Delta_ {K} + \Delta_ {k}}{2} \\ \leq \sum_ {k = 1} ^ {K - 1} n _ {k K} (T) \Delta_ {K} \leq (K - 1) (1 + n _ {K 1} (T)) \Delta_ {K} \\ \end{array} +$$ + +$$ +\begin{array}{l} \leq (K - 1) \left(1 + \frac {4 \log (K t / \delta)}{\Delta_ {K} ^ {2}}\right) \Delta_ {K} \\ = (K - 1) \left(\Delta_ {k} + \frac {4 \log (K t / \delta)}{\Delta_ {K}}\right). \\ \end{array} +$$ + +Similarly, note for any $i \in \{2, 3, \dots, K - 1\}$ , we can upper bound the regret of rounds where $i$ was played in the duel as: + +$$ +\begin{array}{l} \sum_ {t = 1} ^ {T} \sum_ {k < i} \mathbf {1} \left(\left\{k _ {+ 1, t}, k _ {- 1, t} \right\} = \left\{k, i \right\}\right) \frac {\Delta_ {i} + \Delta_ {k}}{2} \\ \leq \sum_ {k = 1} ^ {i - 1} n _ {k i} (T) \Delta_ {i} \leq (i - 1) (1 + n _ {1 i} (T)) \Delta_ {i} \\ \leq (i - 1) \left(\Delta_ {i} + \frac {4 \log (K t / \delta)}{\Delta_ {i}}\right). \\ \end{array} +$$ + +Thus we can bound the total regret of Algorithm 1 as: + +$$ +\begin{array}{l} \sum_ {t = 1} ^ {T} \sum_ {i = 2} ^ {K} \sum_ {k = 1} ^ {i - 1} \mathbf {1} (\{k _ {+ 1, t}, k _ {- 1, t} \} = \{k, i \}) \frac {\Delta_ {i} + \Delta_ {k}}{2} \\ \leq \sum_ {i = 2} ^ {K} (i - 1) \left(\Delta_ {i} + \frac {4 \log (K t / \delta)}{\Delta_ {i}}\right) \\ \stackrel {(\Delta_ {i} \leq 1 / 2)} {\leq} \frac {K ^ {2}}{4} + 4 \sum_ {i = 2} ^ {K} (i - 1) \frac {\log (K t / \delta)}{\Delta_ {i}} \\ \end{array} +$$ + +which concludes the first half of the proof. Further, to show the second part of the claim (analyzing worst-case gap-independent regret bound of Algorithm 1), note that Eqn. (5) equivalently implies for any $i \in [K] \setminus \{1\}$ and for any $t \in [T]$ : + +$$ +\Delta_ {i} \leq \sqrt {\frac {4 \log (K t / \delta)}{n _ {i 1} (t)}}. +$$ + +Hence we can alternatively upper bound the regret as: + +$$ +\begin{array}{l} R _ {T} = \sum_ {i = 2} ^ {K} \sum_ {k = 1} ^ {i - 1} n _ {i k} (T) \frac {\Delta_ {i} + \Delta_ {k}}{2} \leq \sum_ {i = 2} ^ {K} \sum_ {k = 1} ^ {i - 1} n _ {i k} (T) \Delta_ {i} \\ \leq \sum_ {i = 2} ^ {K} \sum_ {k = 1} ^ {i - 1} n _ {i k} (T) \sqrt {\frac {4 \log (K T / \delta)}{n _ {i 1} (T)}} \\ \stackrel {(a)} {\leq} 2 \sum_ {i = 2} ^ {K} \sum_ {k = 1} ^ {i - 1} \sqrt {n _ {i k} (T) \log (K T / \delta)} \\ \stackrel {(b)} {\leq} 2 \sqrt {K ^ {2} \sum_ {i = 2} ^ {K} \sum_ {k = 1} ^ {i - 1} n _ {i k} (T) \log (K T / \delta)} \\ \leq 2 K \sqrt {T \log (K T / \delta)}, \\ \end{array} +$$ + +where $(a)$ follows from the observation of Eqn. (6) which implies $n_{i1}(T) \geq n_{ik}(T)$ when $T \geq K^2$ and $(b)$ from Jensen's inequality and $\sum_{i=2}^{K} (i - 1) \leq K^2 / 2$ . + +Lemma 4. For any $\delta \in (0,1 / 2)$ . Then, with probability at least $1 - \delta$ , for any pair $i,j \in [K]$ and any time $t \in [T]$ + +$$ +\widehat {p} _ {i j} (t) - c _ {i j} (t) \leq p _ {i j} \leq \widehat {p} _ {i j} (t) + c _ {i j} (t), \quad \forall t \in [ T ], +$$ + +where $c_{ij}(t)\coloneqq \sqrt{\frac{\log(Kt / \delta)}{n_{ij}(t)}}$ + +Proof. Let us denote by $u_{ij}(t) \coloneqq \widehat{p}_{ij}(t) + c_{ij}(t)$ and $\ell_{ij}(t) \coloneqq \widehat{p}_{ij}(t) - c_{ij}(t)$ . Note the inequality holds trivially at round $t$ , for any pair $(i,j)$ for which $n_{ij}(t) = 0$ since in these cases $\ell_{ij}(t) \leq 0$ and $u_{ij}(t) \geq 1$ . + +Now consider any pair $(i,j)$ and round $t\in [T]$ such that $n_{ij}(t) > 0$ . Note in this case by Hoeffding's Inequality: + +$$ +P r \left(\left| p _ {i j} - \widehat {p} _ {i j} (t) \right| > \sqrt {\frac {\ln (K t / \delta)}{n _ {i j} (t)}}\right) \leq 2 e ^ {- 2 n _ {i j} (t) \frac {\ln (K t / \delta)}{n _ {i j} (t)}} = \frac {2 \delta^ {2}}{K ^ {2} t ^ {2}} \leq \frac {\delta}{K ^ {2} t ^ {2}}. +$$ + +Taking union bound over all $\binom{K}{2}$ pairs and time $t\in [T]$ we get: + +$$ +\begin{array}{l} P r \left(\exists i, j \in [ K ], t \in [ T ] \text {s . t .} | p _ {i j} - \widehat {p} _ {i j} (t) | > \sqrt {\frac {\ln (K t / \delta)}{n _ {i j} (t)}}\right) \\ \leq \sum_ {t = 1} ^ {T} \sum_ {i = 2} ^ {K} \sum_ {j = 1} ^ {i} \frac {\delta}{K ^ {2} t ^ {2}} \leq \sum_ {t = 1} ^ {\infty} \frac {\delta}{2 t ^ {2}} \leq \frac {\delta \pi^ {2}}{1 2} \leq \delta , \\ \end{array} +$$ + +where in the second last inequality we used $\sum_{t=1}^{\infty} \frac{1}{t^2} < \frac{\pi^2}{6}$ . This concludes the claim. + +![](images/e9fc0d39ce80d0a1db5d02eeb05262b46bd79849223e1e70d5bff3df44889c89.jpg) + +# B. Regret Analysis of Alg. 3 + +Theorem 3 (Regret analysis of Versatile-DB (Alg. 3) for Adversarial and Stochastic Preferences). For any sequence of preference matrices $\mathbf{P}_t$ , the pseudo-regret of Algorithm 3 with $\Psi_t(w) = \sqrt{t}\sum_{k=1}^{K}(\sqrt{w_k} - w_k/2)/8$ satisfies for any $T \geq 1$ + +$$ +\overline {{R}} _ {T} := \max _ {k \in [ K ]} \mathbf {E} \bigl [ R _ {T} (k) \bigr ] \leq 4 \sqrt {K T} + 1. +$$ + +Furthermore, if there exists a gap vector $\Delta \in [0,1]^K$ with a unique zero coordinate $k^* \in [K]$ and $C \geq 0$ such that + +$$ +\bar {R} _ {T} \geq \frac {1}{2} \mathbf {E} \left[ \sum_ {t = 1} ^ {T} \sum_ {k \neq k ^ {*}} \left(p _ {+ 1, t} (k) + p _ {- 1, t} (k)\right) \Delta_ {k} \right] - C, \tag {4} +$$ + +the pseudo regret also satisfies + +$$ +\begin{array}{l} \bar {R} _ {T} \leq \sum_ {k \neq k ^ {*}} \frac {4 \log T + 1 2}{\Delta_ {k}} + 4 \log T + \frac {1}{\Delta_ {\min }} \\ + \frac {3}{2} \sqrt {K} + 8 + C. \\ \end{array} +$$ + +where $\Delta_{\mathrm{min}} = \min_{k\neq k^{*}}\Delta_{k}$ + +Proof of Theorem 3. The analysis follows from carefully combining our reduction (Theorem 2) with Theorem 1 of (Zimmert & Seldin, 2021) for MAB to both of the players. Indeed, for each player $i \in \{-1, 1\}$ , Algorithm 3 chooses $k_{i,t}$ by following the decisions of Tsallis-INF (Zimmert & Seldin, 2021, Alg. 1) with $\alpha = 1/2$ , symmetric regularization, learning rate $\eta_t = 4/\sqrt{t}$ and losses $\ell_{i,t}$ estimated in (3) with standard importance sampling (IW). + +Adversarial regime A direct application of Theorem 1 of (Zimmert & Seldin, 2021), upper-bounds the pseudo-regret for each player $i \in \{-1, 1\}$ as + +$$ +\max _ {k \in [ K ]} \mathbf {E} \left[ R _ {i, T} (k) \right] \leq 4 \sqrt {K T} + 1. +$$ + +Combining the about bounds with the reduction from MAB to DB (Theorem 2) yields the adversarial pseudo-regret upper-bound + +$$ +\mathbf {E} \big [ R _ {T} (k) \big ] = \frac {1}{2} \mathbf {E} \big [ R _ {- 1, T} (k) + R _ {+ 1, T} (k) \big ] \leq 4 \sqrt {K T} + 1. +$$ + +Adversarial regime with a self-bounding constraint Our self-bounding constraint is slightly different from that of (Zimmert & Seldin, 2021), since it involves both players simultaneously. This is necessary so that our gap vector $\Delta$ can recover the standard suboptimality gaps used in stochastic dueling bandits. Thus, we cannot directly combine their result with our black-box reduction in this case. However, the proof largely follows their analysis, except that the upper-bounds on the regret of both players must be combined in the middle of their analysis, just before they apply their self-bounding constraint assumption. Thus, we give here only the modification to the proof of their Theorem 1. + +Following their proof of Thm. 1 until their pseudo-regret bound at the top of p. 23, we get for each player $i \in \mathcal{I} := \{-1, +1\}$ : + +$$ +\mathbf {E} \left[ R _ {i, T} (k) \right] \leq \sum_ {k \neq k ^ {*}} \left(\sum_ {t = 1} ^ {T} \frac {\sqrt {\mathbf {E} [ p _ {i , t} (k) ]}}{\sqrt {t}} + \sum_ {t = T _ {0} + 1} ^ {T} \frac {\mathbf {E} [ p _ {i , t} (k) ]}{4 \sqrt {t}}\right) + M, +$$ + +where $M := \sqrt{T_0} + \frac{3}{4}\sqrt{K} + 15 + 14K\log(T)$ and $T_0 := \lceil \Delta_{\min}^{-2}/4 \rceil$ . Together with Theorem 2 and taking the max over $k$ , $\overline{R}_T$ is thus upper-bounded by + +$$ +\frac {1}{2} \sum_ {i \in \mathcal {I}} \sum_ {k \neq k ^ {*}} \left(\sum_ {t = 1} ^ {T} \frac {\sqrt {\mathbf {E} [ p _ {i , t} (k) ]}}{\sqrt {t}} + \sum_ {t = T _ {0} + 1} ^ {T} \frac {\mathbf {E} [ p _ {i , t} (k) ]}{4 \sqrt {t}}\right) + M. +$$ + +Now, applying the self-bounding property (4) we get for any $\lambda \in [0,1]$ + +$$ +\overline {{R}} _ {T} \leq \overline {{R}} _ {T} + \lambda \Bigg (\overline {{R}} _ {T} - \frac {1}{2} \mathbf {E} \bigg [ \sum_ {t = 1} ^ {T} \sum_ {k \neq k ^ {*}} \left(p _ {+ 1, t} (k) + p _ {- 1, t} (k)\right) \Delta_ {k} \bigg ] + C \Bigg) +$$ + +Thus, combined with the previous bound using $1 + \lambda \leq 2$ + +$$ +\begin{array}{l} \overline {{R}} _ {T} \leq \frac {1}{2} \sum_ {i \in \mathcal {I}} \sum_ {k \neq k ^ {*}} \left(\sum_ {t = 1} ^ {T} \left(\frac {2 \sqrt {\mathbf {E} [ p _ {i , t} (k) ]}}{\sqrt {t}} - \lambda \Delta_ {k} \mathbf {E} [ p _ {i, t} ]\right) + \sum_ {t = T _ {0} + 1} ^ {T} \frac {\mathbf {E} [ p _ {i , t} (k) ]}{2 \sqrt {t}}\right) + 2 M + \lambda C. \\ \leq \sum_ {k \neq k ^ {*}} \left(\sum_ {t = 1} ^ {T _ {0}} \max _ {z \geq 0} \left\{\frac {2 \sqrt {z}}{\sqrt {t}} - \lambda \Delta_ {k} z \right\} \sum_ {t = T _ {0} + 1} ^ {T} \max _ {z \geq 0} \left\{\frac {2 \sqrt {z} + \frac {1}{2} z}{\sqrt {t}} - \lambda \Delta_ {i} z \right\}\right) + 2 M + \lambda C \\ \end{array} +$$ + +Now, we are back with the same upper-bound (Zimmert & Seldin, 2021) have in the middle of their page 23. Following their analysis by solving the optimization problems, summing over $t$ , and optimizing $\lambda$ concludes. \ No newline at end of file diff --git a/versatileduelingbanditsbestofbothworldanalysesforlearningfromrelativepreferences/images.zip b/versatileduelingbanditsbestofbothworldanalysesforlearningfromrelativepreferences/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..5ec8ecd2b28184c3a58d8a42f7ae73835e42fe71 --- /dev/null +++ b/versatileduelingbanditsbestofbothworldanalysesforlearningfromrelativepreferences/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e3d8fcbe4037c664a2a510cf17b5f8f959d75d12248440cc77f3f0a5d3e0137a +size 587554 diff --git a/versatileduelingbanditsbestofbothworldanalysesforlearningfromrelativepreferences/layout.json b/versatileduelingbanditsbestofbothworldanalysesforlearningfromrelativepreferences/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..8899f433ff1f07893f7b4d4fa892cdf4a46250ad --- /dev/null +++ b/versatileduelingbanditsbestofbothworldanalysesforlearningfromrelativepreferences/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:788a4cfd52eb399cedb6be92e805196986eaf8020e683354632dfd17a90861c9 +size 804713 diff --git a/versatileofflineimitationfromobservationsandexamplesviaregularizedstateoccupancymatching/411e078c-8e6d-4bca-9eb6-7df45dc1202e_content_list.json b/versatileofflineimitationfromobservationsandexamplesviaregularizedstateoccupancymatching/411e078c-8e6d-4bca-9eb6-7df45dc1202e_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..b2ea5c83fde8085eea3341d3b4c43a84a46b0b67 --- /dev/null +++ b/versatileofflineimitationfromobservationsandexamplesviaregularizedstateoccupancymatching/411e078c-8e6d-4bca-9eb6-7df45dc1202e_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5257842eb6e5e3db3159dcc6089a4cc849d693ab7ea1312bf31e016269d95924 +size 176818 diff --git a/versatileofflineimitationfromobservationsandexamplesviaregularizedstateoccupancymatching/411e078c-8e6d-4bca-9eb6-7df45dc1202e_model.json b/versatileofflineimitationfromobservationsandexamplesviaregularizedstateoccupancymatching/411e078c-8e6d-4bca-9eb6-7df45dc1202e_model.json new file mode 100644 index 0000000000000000000000000000000000000000..1d69975492d1d04ede4ff9537170ce2564a31909 --- /dev/null +++ b/versatileofflineimitationfromobservationsandexamplesviaregularizedstateoccupancymatching/411e078c-8e6d-4bca-9eb6-7df45dc1202e_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:708a44bd1a4b054faf7f90be5c57e393e88dd65a34ee1033189ab93de678b612 +size 208788 diff --git a/versatileofflineimitationfromobservationsandexamplesviaregularizedstateoccupancymatching/411e078c-8e6d-4bca-9eb6-7df45dc1202e_origin.pdf b/versatileofflineimitationfromobservationsandexamplesviaregularizedstateoccupancymatching/411e078c-8e6d-4bca-9eb6-7df45dc1202e_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..09aa021840a2c444aeab6c0b3e79f455549fec6d --- /dev/null +++ b/versatileofflineimitationfromobservationsandexamplesviaregularizedstateoccupancymatching/411e078c-8e6d-4bca-9eb6-7df45dc1202e_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cbe8d826a23b7f1efc8d8b983210a20f3b041de61653bee8f193d94c8d72600d +size 2401634 diff --git a/versatileofflineimitationfromobservationsandexamplesviaregularizedstateoccupancymatching/full.md b/versatileofflineimitationfromobservationsandexamplesviaregularizedstateoccupancymatching/full.md new file mode 100644 index 0000000000000000000000000000000000000000..973683f15ef76f32e3d4ce4427b6172545f8417c --- /dev/null +++ b/versatileofflineimitationfromobservationsandexamplesviaregularizedstateoccupancymatching/full.md @@ -0,0 +1,939 @@ +# Versatile Offline Imitation from Observations and Examples via Regularized State-Occupancy Matching + +Yecheng Jason Ma1 Andrew Shen2 Dinesh Jayaraman1 Osbert Bastani1 + +# Abstract + +We propose State Matching Offline Distribution Correction Estimation (SMODICE), a novel and versatile regression-based offline imitation learning (IL) algorithm derived via state-occupancy matching. We show that the SMODICE objective admits a simple optimization procedure through an application of Fenchel duality and an analytic solution in tabular MDPs. Without requiring access to expert actions, SMODICE can be effectively applied to three offline IL settings: (i) imitation from observations (IfO), (ii) IfO with dynamics or morphologically mismatched expert, and (iii) example-based reinforcement learning, which we show can be formulated as a state-occupancy matching problem. We extensively evaluate SMODICE on both gridworld environments as well as on high-dimensional offline benchmarks. Our results demonstrate that SMODICE is effective for all three problem settings and significantly outperforms prior state-of-art. Project website: https://sites.google.com/view/smodice/home + +# 1. Introduction + +The offline reinforcement learning (RL) framework (Lange et al., 2012; Levine et al., 2020) aims to use pre-collected, reusable offline data—without further interaction with the environment—for sample-efficient, scalable, and practical data-driven decision-making. However, this assumes that the offline dataset comes with reward labels, which may not always be possible. To address this, offline imitation learning (IL) (Zolna et al., 2020; Chang et al., 2021; Kim et al., 2022) has recently been proposed as an alternative where the learning algorithm is provided with a small set of + +$^{1}$ Department of Computer and Information Science, University of Pennsylvania, Philadelphia, USA $^{2}$ University of Melbourne, Melbourne, Australia. Correspondence to: Yecheng Jason Ma . + +Proceedings of the $39^{th}$ International Conference on Machine Learning, Baltimore, Maryland, USA, PMLR 162, 2022. Copyright 2022 by the author(s). + +expert demonstrations and a separate set of offline data of unknown quality. The goal is to learn a policy that mimics the provided expert data while avoiding test-time distribution shift (Ross et al., 2011) by using the offline dataset. + +Expert demonstrations are often much more expensive to acquire than offline data; thus, offline IL benefits significantly from minimizing assumptions about the expert data. In this work, we aim to remove two assumptions about the expert data in current offline IL algorithms: (i) expert action labels must be provided for the demonstrations, and (ii) the expert demonstrations are performed with identical dynamics (same embodiment, actions, and transitions) as the imitator agent. These requirements preclude applications to important practical problem settings, including (i) imitation from observations, (ii) imitation with mismatched expert that obeys different dynamics or embodiment (e.g., learning from human videos), and (iii) learning only from examples of successful outcomes rather than full expert trajectories (Eysenbach et al., 2021). + +For these reasons, many algorithms for online IL have already sought to remove these assumptions (Torabi et al., 2018; 2019; Liu et al., 2019; Radosavovic et al., 2020; Eysenbach et al., 2021), but extending them to offline IL remains an open problem. + +We propose State Matching Offline Distribution Correction Estimation (SMODICE), a general offline IL framework that can be applied to all three problem settings described above. At a high level, SMODICE is based on a state-occupancy matching view of IL: + +$$ +\min _ {\pi} \mathrm {D} _ {\mathrm {K L}} \left(d ^ {\pi} (s) \| d ^ {E} (s)\right), \tag {1} +$$ + +which aims to minimize the KL-divergence of the state-occupancy $d$ between the imitator $\pi$ and the expert $E$ . This state-occupancy matching objective intuitively demands inferring the correct actions from the offline data in order to match the state-occupancy of the provided expert demonstrations. This formulation naturally enables imitation when expert actions are unavailable, and even when the expert's embodiment or dynamics are different, as long as there is a shared task-relevant state. Finally, we show that example-based RL (Eysenbach et al., 2021), where only examples of successful states are provided as supervision, can be for + +![](images/89ba7abc8e3c0fedad301b6c3e997d83b90e2bfe214600ea61877f3774f3a9f6.jpg) +Figure 1. Diagram of SMODICE. First, a state-based discriminator is trained using the offline dataset $d^{O}$ and expert observations (resp. examples) $d^{E}$ . Then, the discriminator is used to train the Lagrangian value function. Finally, the value function provides the importance weights for policy training, which outputs the learned policy $d^{*}$ . + +mulated as a state-occupancy matching problem between the imitator and a "teleporting" expert that is able to reach success states in one step. Hence, SMODICE can also be used as an offline example-based RL1 method without any modification. + +Despite its generality, naively optimizing the state-occupancy matching objective would result in an actor-critic style IL algorithm akin to prior work (Ho & Ermon, 2016; Kostrikov et al., 2018; 2020); however, these algorithms suffer from training instability in the offline regime (Kumar et al., 2019; Lee et al., 2021; Kim et al., 2022) due to the entangled nature of actor and critic learning, leading to erroneous value bootstrapping (Levine et al., 2020). SMODICE bypasses this issue by first introducing a $f$ -divergence regularized state-matching objective and then using its dual optimal solution to formulate a weighted regression policy objective that amounts to behavior cloning of the optimal policy. Specifically, leveraging the notion of Fenchel conjugacy (Rockafellar, 2015; Nachum & Dai, 2020), SMODICE reduces the dual problem of the proposed regularized state-occupancy matching problem to an unconstrained convex optimization problem over a value function (Step 2 in Figure 1). This unconstrained problem admits closed-form solutions in the tabular case and can be easily optimized using stochastic gradient descent (SGD) in the deep RL setting. Then, without any additional learning step, applying Fenchel duality to the optimal value function directly obtains the optimal primal solution, which recovers the optimal importance weights for weighted regression (Step 3 in Figure 1). Note that SMODICE does not optimize this policy objective until the value function has converged; despite forgoing direct minimization of the state-matching objective, this uninterleaved optimization is favorable in the offline setting due to its much improved training stability. + +Through extensive experiments, we show that SMODICE is effective for all three problem settings we consider and outperforms all state-of-art methods in each respective setting. We obtain all SMODICE results using a single set of hyper + +![](images/628fad81dbf53bde16da9bffc0b7e0eb059f29f37095b0f48f21061d0da6a307.jpg) +(a) Mismatched experts + +![](images/d4b2045a6bdbc5c01bb7bd67917dfb416bb4c5998ae5b96841ac91fa91ed905b.jpg) +(b) Offline IL from examples +Figure 2. Illustrations of tabular SMODICE for offline imitation learning from mismatched experts and examples. + +parameters, modulo a choice of $f$ -divergence which can be tuned offline. In contrast, prior methods suffer from much greater performance fluctuation across tasks and settings, validating the stated stability improvement of our optimization approach. Altogether, our proposed method SMODICE can serve as a versatile offline IL algorithm that is suitable for a wide range of assumptions on expert data. + +In summary, our contributions are: (i) SMODICE: a simple, stable, and versatile state-occupancy matching based offline IL algorithm for both tabular and high-dimensional continuous MDPs, (ii) a reduction of example-based reinforcement learning to state-occupancy matcjomg, and (iii) extensive experimental analysis of SMODICE in offline imitation from observations, mismatched experts, and examples; in all three, SMODICE outperforms competing methods. + +Pedagogical examples. To illustrate SMODICE's versatility, we have applied it to two gridworld tasks, testing offline IL from mismatched experts and examples, respectively. Figure 2(a) shows an expert agent that can move diagonally in any direction, whereas the imitator can only move horizontally or vertically. In Figure 2(b), only a success state (the star) is provided as supervision. An offline dataset collected by a random agent is given to SMODICE for training in both cases. As shown, SMODICE recovers an optimal policy (i.e. minimum state-occupancy divergence to that of the expert) in both cases. See Appendix D.2 for details. + +# 2. Preliminaries + +Markov decision processes. We consider a time-discounted Markov decision process (MDP) (Puterman, 2014) $\mathcal{M} = (S,A,R,T,\mu_0,\gamma)$ with state space $S$ , action space $A$ , deterministic rewards $R(s,a)$ , stochastic transitions $s' \sim T(s,a)$ , initial state distribution $\mu_0(s)$ , and discount factor $\gamma \in (0,1]$ . A policy $\pi : S \to \Delta(A)$ determines the action distribution conditioned on the state. + +The state-action occupancies (also known as stationary distribution) $d^{\pi}(s,a):\mathcal{S}\times \mathcal{A}\to [0,1]$ of $\pi$ is + +$$ +d ^ {\pi} (s, a) := (1 - \gamma) \sum_ {t = 0} ^ {\infty} \gamma^ {t} \Pr \left(s _ {t} = s, a _ {t} = a \right| \tag {2} +$$ + +$$ +s _ {0} \sim \mu_ {0}, a _ {t} \sim \pi (s _ {t}), s _ {t + 1} \sim T (s _ {t}, a _ {t})) +$$ + +which captures the relative frequency of state-action visitations for a policy $\pi$ . The state occupancies then marginalize over actions: $d^{\pi}(s) = \sum_{a} d^{\pi}(s, a)$ . The state-action occupancies satisfy the single-step transpose Bellman equation: + +$$ +d ^ {\pi} (s, a) = (1 - \gamma) \mu_ {0} (s) \pi (a | s) + \gamma \cdot \mathcal {T} _ {\star} ^ {\pi} d ^ {\pi} (s, a), \tag {3} +$$ + +where $\mathcal{T}_{\star}^{\pi}$ is the adjoint policy transition operator, + +$$ +\mathcal {T} _ {\star} ^ {\pi} d ^ {\pi} (s, a) := \pi (a \mid s) \sum_ {\tilde {s}, \tilde {a}} T (s \mid \tilde {s}, \tilde {a}) d (\tilde {s}, \tilde {a}) \tag {4} +$$ + +Divergences and Fenchel conjugates. Next, we briefly introduce $f$ -divergence and their Fenchel conjugates. + +Definition 1 ( $f$ -divergence). Given a continuous, convex function $f$ and two probability distributions $p, q \in \Delta(\mathcal{X})$ over a domain $\mathcal{X}$ , the $f$ -divergence of $p$ at $q$ is + +$$ +\mathrm {D} _ {f} (p \| q) = \mathbb {E} _ {x \sim q} \left[ f \left(\frac {p (x)}{q (x)}\right) \right] \tag {5} +$$ + +A common $f$ -divergence in machine learning is the KL-divergence, which corresponds to $f(x) = x\log x$ . Now, we introduce Fenchel conjugate for $f$ -divergences. + +Definition 2 (Fenchel conjugate). Given a vector space $\Omega$ with inner-product $\langle \cdot, \cdot \rangle$ , the Fenchel conjugate $f_{\star} : \Omega_{\star} \to \mathbb{R}$ of a convex and differentiable function $f : \Omega \to \mathbb{R}$ is + +$$ +f _ {\star} (y) := \max _ {x \in \Omega} \langle x, y \rangle - f (x) \tag {6} +$$ + +and any maximizer $x^{*}$ of $f_{\star}(y)$ satisfies $x^{*} = f_{\star}^{\prime}(y)$ . + +For an $f$ -divergence, under mild realizability assumptions (Dai et al., 2016) on $f$ , the Fenchel conjugate of $D_{f}(p\| q)$ at $y:\mathcal{X}\to \mathbb{R}$ is + +$$ +\begin{array}{l} \mathrm {D} _ {\star , f} (y) = \max _ {p \in \Delta (\mathcal {X})} \mathbb {E} _ {x \sim p} [ y (x) ] - \mathrm {D} _ {f} (p \| q) (7) \\ = \mathbb {E} _ {x \sim q} [ f _ {\star} (y (x)) ] (8) \\ \end{array} +$$ + +and any maximizer $p^*$ of $\mathrm{D}_{\star ,f}(y)$ satisfies + +$$ +p ^ {*} (x) = q (x) f _ {\star} ^ {\prime} (y (x)). \tag {9} +$$ + +This result can be seen as an application of the KKT conditions to problems involving $f$ -divergence regularization. + +Offline imitation learning. Many imitation learning approaches rely on minimizing the $f$ -divergence between the state-action occupancies of the imitator and the expert (Ho & Ermon, 2016; Ke et al., 2020; Ghasemipour et al., 2019): + +$$ +\min _ {\pi} \mathrm {D} _ {f} \left(d ^ {\pi} (s, a) \| d ^ {E} (s, a)\right) \tag {10} +$$ + +In imitation learning, we do not have $d^{E}$ ; instead, we are provided with expert demonstrations $\mathcal{D}^E \coloneqq \{(s^{(i)}, a^{(i)})\}_{i=1}^N$ . + +In offline imitation learning, the agent further cannot interact with the MDP $\mathcal{M}$ ; instead, they are given a static dataset of logged transitions $\mathcal{D}^O \coloneqq \{\tau_i\}_{i=1}^M$ , where each trajectory $\tau^{(i)} = (s_0^{(i)}, a_0^{(i)}, s_1^{(i)}, \ldots)$ with $s_0^{(i)} \sim \mu_0$ ; we denote the empirical state-action occupancies of $\mathcal{D}^O$ as $d^O(s, a)$ . + +# 3. The SMODICE Algorithm + +In this section, we derive the SMODICE algorithm. We begin by introducing our $f$ -divergence regularized offline state-matching objective (Section 3.1). Then, we describe the 3 disjoint training steps of SMODICE in order (Section 3.2-3.4). Finally, we present SMODICE tailored to tabular MDPs (Section 3.5). + +# 3.1. $f$ -Divergence Regularized State-Matching + +Recall that the state-occupancy matching objective takes the form + +$$ +\min _ {\pi} \mathrm {D} _ {\mathrm {K L}} \left(d ^ {\pi} (s) \| d ^ {E} (s)\right), \tag {11} +$$ + +which requires on-policy samples from $\pi$ , as the expectation is over $d^{\pi}$ . To enable offline optimization, we necessarily need to involve the offline dataset distribution $d^{O}$ in our objective. + +First, we assume expert coverage of the offline data: + +Assumption 1. $d^{O}(s) > 0$ whenever $d^{E}(s) > 0$ . + +This assumption ensures that the offline dataset has coverage over the expert state-marginal, and is necessary for imitation learning to succeed. Whereas prior offline RL approaches (Kumar et al., 2020; Ma et al., 2021a) assume full coverage of the state-action space, our assumption2 is considerably weaker since it only requires expert coverage. Given this assumption, we introduce our $f$ -divergence regularized state-matching objective, which follows from an + +upper bound on state-occupancy matching that incorporates the offline dataset distribution $d^{O}$ : + +Theorem 1. Given Assumption 1, we have + +$$ +\begin{array}{l} \mathrm {D} _ {\mathrm {K L}} \left(d ^ {\pi} (s) \| d ^ {E} (s)\right) \leq \\ \mathbb {E} _ {s \sim d ^ {\pi}} \left[ \log \left(\frac {d ^ {O} (s)}{d ^ {E} (s)}\right) \right] + \mathrm {D} _ {\mathrm {K L}} \left(d ^ {\pi} (s, a) \| d ^ {O} (s, a)\right) \tag {12} \\ \end{array} +$$ + +Furthermore, for any $f$ -divergence such that $\mathrm{D}_f \geq \mathrm{D}_{\mathrm{KL}}$ + +$$ +\begin{array}{l} \mathrm {D} _ {\mathrm {K L}} \left(d ^ {\pi} (s) \| d ^ {E} (s)\right) \leq \\ \mathbb {E} _ {s \sim d ^ {\pi}} \left[ \log \left(\frac {d ^ {O} (s)}{d ^ {E} (s)}\right) \right] + \mathrm {D} _ {f} \left(d ^ {\pi} (s, a) \| d ^ {O} (s, a)\right) \tag {13} \\ \end{array} +$$ + +We refer to the RHS of Equation (13) as the $f$ -divergence regularized state-occupancy matching objective. The proofs of this theorem and all other theoretical results are in Appendix A. Intuitively, the upper bound states that that offline state-occupancy matching can be achieved by matching states in the offline data that resemble expert states (the first term) with reward function $R(s) = \log \frac{d^{E}(s)}{d^{O}(s)}$ (we describe how to compute this reward below), while remaining in the support of the offline state-action distribution (the second term). Replacing KL-divergence with other $f$ -divergences can be useful since the conjugate of KL divergence involves a log-sum-exp, which has been found to be numerically unstable in many RL tasks (Zhu et al., 2020; Lee et al., 2021; Rudner et al., 2021). Now, we describe the three disjoint steps of SMODICE as presented in Figure 1. + +# 3.2. Discriminator training + +First, we discuss how to compute $R(s) = \log \frac{d^{E}(s)}{d^{O}(s)}$ . In the tabular case, $R(s)$ can be computed using empirical estimates of $d^{E}(s)$ and $d^{O}(s)$ . In the continuous case, we can train a discriminator $c: S \to (0,1)$ : + +$$ +\min _ {c} \mathbb {E} _ {s \sim d ^ {E}} [ \log c (s) ] + \mathbb {E} _ {s \sim d ^ {O}} [ \log 1 - c (s) ] \tag {14} +$$ + +The optimal discriminator is $c^{\star}(s) = \frac{d^{O}(s)}{d^{E}(s) + d^{O}(s)}$ (Goodfellow et al., 2014), so we can use $R(s) = -\log \left(\frac{1}{c^{\star}(s)} - 1\right)$ . + +# 3.3. Dual Value Function Training + +Note that (13) requires samples from $d^{\pi}$ , so it still cannot be easily optimized without online interaction. To address this, we first rewrite it as an optimization problem over the space of valid state-action occupancies (Puterman, 2014): + +$$ +\begin{array}{l} \left(\mathrm {P}\right) \quad \max _ {d (s, a) \geq 0} \mathbb {E} _ {s \sim d (s, a)} [ R (s) ] - \mathrm {D} _ {f} (d \| d ^ {O}) (15) \\ \sum_ {a} d (s, a) = (1 - \gamma) \mu_ {0} (s) + \gamma \mathcal {T} _ {\star} d (s), \forall s \in S (16) \\ \end{array} +$$ + +where $\mathcal{T}_{\star}d(s) = \sum_{\bar{s},\bar{a}}T(s\mid \bar{s},\bar{a})d(\bar{s},\bar{a})$ ; here, (16) ensures that $d$ is the occupancy distribution for some policy. We assume that (15) is strictly feasible. + +Assumption 2. There exists at least one $d(s, a)$ such that constraints (16) are satisfied and $\forall s \in S, d(s) > 0$ . + +This assumption is mild and can be satisfied in practice for any MDP for which every state is reachable from the initial state distribution. Next, we can form the dual of (15): + +$$ +\begin{array}{l} \left(\mathrm{D}\right) \max _ {d (s, a) \geq 0} \min _ {V (s) \geq 0} \mathbb {E} _ {s \sim d} [ R (s) ] - \mathrm {D} _ {f} (d \| d ^ {O}) \\ + \sum_ {s} V (s) \left((1 - \gamma) \mu_ {0} (s) + \gamma \mathcal {T} _ {\star} d (s) - \sum_ {a} d (s, a)\right) \tag {17} \\ \end{array} +$$ + +where $V(s)$ are the Lagrangian multipliers. Now, because $\mathcal{T}_{\star}$ is the adjoint of $\mathcal{T}$ , we have the following: + +$$ +\sum_ {s} V (s) \cdot \mathcal {T} _ {\star} d (s) = \sum_ {s, a} d (s, a) \cdot (\mathcal {T} V) (s, a) \tag {18} +$$ + +Using this equation, we can write (17) as + +$$ +\begin{array}{l} \max _ {d (s, a) \geq 0} \min _ {V (s) \geq 0} (1 - \gamma) \mathbb {E} _ {s \sim \mu_ {0}} [ V (s) ] \\ + \mathbb {E} _ {(s, a) \sim d} [ R (s) + \gamma \mathcal {T} V (s, a) - V (s) ] \tag {19} \\ - \mathrm {D} _ {f} (d (s, a) \| d ^ {O} (s, a)) \\ \end{array} +$$ + +We note that the original problem (15) is convex (Lee et al., 2021). By Assumption 2, it is strictly feasible, so by strong duality, we can change the order of optimization in (19): + +$$ +\begin{array}{l} \min _ {V (s) \geq 0} \max _ {d (s, a) \geq 0} (1 - \gamma) \mathbb {E} _ {s \sim \mu_ {0}} [ V (s) ] \\ + \mathbb {E} _ {(s, a) \sim d} \left[ (R (s) + \gamma \mathcal {T} V (s, a) - V (s)) \right] \tag {20} \\ - \mathrm {D} _ {f} (d (s, a) \| d ^ {O} (s, a)) \\ \end{array} +$$ + +Finally, using the Fenchel conjugate, (20) can be reduced to a single unconstrained optimization problem over $V: \mathcal{S} \to \mathbb{R}_{\geq 0}$ that depends on samples from only $d^{O}$ and not $d$ ; we also obtain the importance weight of the state-occupancy of the optimal policy with respect to the offline data. + +Theorem 2. The optimization problem (20) is equivalent to + +$$ +\begin{array}{l} \min _ {V (s) \geq 0} (1 - \gamma) \mathbb {E} _ {s \sim \mu_ {0}} [ V (s) ] \\ + \mathbb {E} _ {(s, a) \sim d ^ {\mathcal {O}}} [ f _ {\star} (R (s) + \gamma \mathcal {T} V (s, a) - V (s)) ] \tag {21} \\ \end{array} +$$ + +Furthermore, given the optimal solution $V^{*}$ , the optimal state-occupancy importance weights are + +$$ +\frac {d ^ {*} (s , a)}{d ^ {O} (s , a)} = f _ {\star} ^ {\prime} (R (s) + \gamma \mathcal {T} V ^ {*} (s, a) - V ^ {*} (s)) \tag {22} +$$ + +# Algorithm 1 SMODICE + +1: // Discriminator Learning +2: Train discriminator $c^* (s)$ using (14) and derive $R(s)$ . +3: // Value Learning +4: Train derived value function $V(s)$ using (21) +5: // Policy Learning +6: Derive optimal ratios $\xi^{*}(s,a)$ through (22) +7: Train policy $\pi$ using weighted BC (23) + +This result can be viewed as using Fenchel duality to generalize prior DICE-based offline approaches (Lee et al., 2021; Kim et al., 2022). In particular, the inner maximization problem in (20) is precisely the Fenchel conjugate of $D_{f}(d(s,a)\| d^{O}(s,a))$ at $R(s) + \gamma \mathcal{T}V(s,a) - V(s)$ (compare (20) to (7)). Similarly, (22) can be derived from leveraging the relationship between the optimal solutions of a pair of Fenchel primal-dual problems (Equation (9)). This generality allows us to choose problem-specific $f$ -divergences that improve stability during optimization. In Appendix C, we specialize the SMODICE objective for the KL- and $\chi^2$ -divergences, which we use in our experiments. + +# 3.4. Weighted-Regression Policy Training + +Finally, using the optimal importance weights, we can extract the optimal policy $\pi$ using weighted Behavior Cloning: + +$$ +\begin{array}{l} \min _ {\pi} - \mathbb {E} _ {(s, a) \sim d ^ {*}} [ \log \pi (a \mid s) ] \\ = \min _ {\pi} - \mathbb {E} _ {(s, a) \sim d ^ {o}} [ \xi^ {*} (s, a) \log \pi (a \mid s) ] \tag {23} \\ \end{array} +$$ + +where $\xi^{*}(s,a) = \frac{d^{*}(s,a)}{d^{O}(s,a)}$ . Here, $V(s)$ can be viewed as the value function—it is trained by minimizing a convex function of the Bellman residuals and the values of the initial states. Then, it can be used to inform policy learning. + +Putting everything together, SMODICE can achieve stable policy learning through a sequence of three disjoint supervised learning problems, summarized in Algorithm 1. The full pseudo-code is in Algorithm 3 in Appendix 3. + +# 3.5. SMODICE for Tabular MDPs. + +An appealing property of SMODICE is that it admits closed-form analytic solution in the tabular case. The proof is given in Appendix D. + +Theorem 3. Let $R(s) = \log \frac{d^{E}(s)}{d^{O}(s)} \in \mathbb{R}_{+}^{|S|}$ , and define $\mathcal{T} \in \mathbb{R}^{|S||\mathcal{A}|\times |S|}$ and $\mathcal{B} \in \mathbb{R}^{|S||\mathcal{A}|\times |S|}$ by $(\mathcal{T}V)(s,a) = \sum_{s'} T(s'|s,a)V(s')$ and $(\mathcal{B}V)(s,a) = V(s)$ . Additionally, denote $\mu_0 \in \Delta(|S|)$ and $D = \mathrm{diag}(d^{O}) \in \mathbb{R}^{|S||\mathcal{A}|\times |S||\mathcal{A}|}$ . Then, choosing the $\chi^2$ -divergence in (21), we have + +$$ +\begin{array}{l} V ^ {*} = \left(\left(\gamma \mathcal {T} - \mathcal {B}\right) ^ {\top} D (\gamma \mathcal {T} - \mathcal {B})\right) ^ {- 1} \tag {24} \\ \left(\left(\gamma - 1\right) \mu_ {0} + (\mathcal {B} - \gamma \mathcal {T}) ^ {\top} D (I + B R)\right) \\ \end{array} +$$ + +In Appendix D, we also derive a finite-sample performance guarantee of SMODICE in the tabular setting. + +# 4. Offline Imitation Learning from Examples + +Next, we describe how SMODICE can be applied to offline imitation learning from examples. Starting from the original problem objective from Eysenbach et al. (2021), we derive a state-occupancy matching objective, enabling us to apply SMODICE without any modification. + +Problem setting. We assume given success examples $S^{*} = \{s^{*} \sim p_{U}(s_{t} \mid e_{t} = 1)\}$ , where $e \in \{0,1\}$ indicates whether the current state is a success outcome, and offline data $\mathcal{D} = \{(s,a,s')\}$ . Here, $U$ is the state distribution of the "user" providing success examples. Then, Eysenbach et al. (2021) proposes the example-based RL objective + +$$ +\arg \max _ {\pi} \log p ^ {\pi} \left(e _ {t +} = 1\right) = \log \mathbb {E} _ {s \sim \mu_ {0}} \left[ p ^ {\pi} \left(e _ {t +} = 1 \mid s _ {0}\right) \right] \tag {25} +$$ + +That is, we want a policy that maximizes the probability of reaching success states in the future. To tackle this problem in the offline setting, our strategy is to convert (25) into an optimization problem over the state-occupancy space. + +Intuition. By parameterizing the problem in terms of state occupancies, a policy that reaches success states in the future is one that has non-zero occupancies at these states—i.e., $d^{\pi}(s)$ corresponds to a policy that reaches success states if $d^{\pi}(s) > 0$ for $s \in S^{*}$ . Furthermore, treating success states as absorbing states in the MDP, then $\sum_{s \in S^{*}} d^{\pi}(s)$ should ideally be much larger than $\sum_{s \notin S^{*}} d^{\pi}(s)$ (we validate this on gridworld; see Appendix D.2). + +Derivation. We first transform the problem into state-occupancy space—i.e., + +$$ +\max _ {\pi} \log \mathbb {E} _ {s \sim \mu_ {0}} \left[ p ^ {\pi} \left(e _ {t +} = 1 | s _ {0}\right) \right] = \max _ {d \geq 0} \log \mathbb {E} _ {s \sim d (s)} [ p (e | s) ] \tag {26} +$$ + +which is valid given that the original objective can be thought of as a regular RL problem with reward function $r(s) = p(e \mid s)$ (Eysenbach et al., 2021). + +Given this formulation, we can derive a tractable lower bound to (26) through Jensen's inequality and Bayes' rule: + +$$ +\begin{array}{l} \log \mathbb {E} _ {s \sim d (s)} \left[ p _ {U} (e \mid s) \right] \\ \geq \mathbb {E} _ {s \sim d (s)} [ \log p _ {U} (e \mid s) ] \\ = \mathbb {E} _ {s \sim d (s)} \left[ \log \frac {p _ {U} (s \mid e) p _ {U} (e)}{p _ {U} (s)} \right] \\ = \mathbb {E} _ {s \sim d (s)} \left[ \log \frac {p _ {U} (s \mid e)}{d (s)} \right] + \mathbb {E} _ {s \sim d (s)} \left[ \log \frac {d (s)}{p _ {U} (s)} \right] + \mathrm {c o n s t .} \\ = - \mathrm {D} _ {\mathrm {K L}} (d (s) \| p _ {U} (s \mid e)) + \mathrm {D} _ {\mathrm {K L}} (d (s) \| p _ {U} (s)) + \text {c o n s t}. \\ \geq - \mathrm {D} _ {\mathrm {K L}} (d (s) \| p _ {U} (s \mid e)) + \text {c o n s t .} \\ \end{array} +$$ + +We can optimize the original objective by maximizing this + +![](images/25f9ad76357d447b627f07e7569f9da2916135c6bf11bde920514910e725bdfc.jpg) +(a) Mujoco + +![](images/f6e272396e06db0f712bd3685b1800f0d7a0a312d7df2fac070ec620d3b49f5f.jpg) +(b) AntMaze + +![](images/167387c487bc514231f667cb698954aafa025e55955c852d16c1bee367a3ca2c.jpg) +(c) Franka Kitchen +Figure 3. Illustrations of the evaluation environments. + +lower bound. Doing so is equivalent to solving + +$$ +\min _ {d \geq 0} \mathrm {D} _ {\mathrm {K L}} (d (s) \| p _ {U} (s \mid e)), \tag {27} +$$ + +which is exactly in the form of the state-occupancy matching objective (11) in the scope of SMODICE. Furthermore, this objective admits an intuitive explanation from a purely imitation learning lens. We can think of $p_U(s \mid e)$ as the state-occupancy distribution of an expert agent who can "teleport" to any success state in one time-step. Therefore, we have shown that example-based RL can be understood as a state-occupancy minimization problem between a MDP-dynamics abiding imitator and a teleporting expert agent. Consequently, SMODICE can be used in the offline setting without any algorithmic modification. + +# 5. Related Work + +Offline imitation learning. The closest work is concurrent work, DEMODICE (Kim et al., 2022), a state-action based offline IL method, also using the DICE paradigm to estimates the occupancy ratio between the expert and the imitator; we overview the DICE literature in Appendix B. Due to its dependence on expert actions, DEMODICE cannot be applied to the three problem settings we study. At a technical level, a key limitation of DEMODICE is that it does not exploit the form of general Fenchel duality and only support the KL-divergence, forgoing other $f$ -divergences that can lead to more stable optimization (Ghasemipour et al., 2019; Ke et al., 2020; Zhu et al., 2020). Another related work is ORIL (Zolna et al., 2020), which adapts GAIL (Ho & Ermon, 2016) to the offline setting. Finally, there has been recent work learning a pessimistic dynamics model using the offline dataset and then performs imitation learning by minimizing the state-action occupancy divergence with respect to the expert inside this learned model (Chang et al., 2021). As with DEMODICE, this approach requires expert actions and cannot be applied to the settings we study. + +Imitation from observations, imitation with mismatched experts, and example-based RL All three of these problems have been studied in the online setting. IfO is often achieved through training an additional inverse dynamics model to infer the expert actions (Torabi et al., 2018; 2019; Liu et al., 2019; Radosavovic et al., 2020; Gangwani & Peng, 2020); in contrast, SMODICE matches the expert observations by identifying the correct actions supported in + +the offline data. To handle experts with dynamics mismatch, some work explicitly learns a correspondence between the expert and the imitator MDPs (Kim et al., 2020; Raychaudhuri et al., 2021); however, these approaches make much stronger assumptions on access to the expert MDP that are difficult to satisfy in the offline setting, such as demonstrations from auxiliary tasks. In contrast, SMODICE falls under the category of state-only imitation learning (Liu et al., 2019; Radosavovic et al., 2020), which overcomes expert dynamics differences by only matching the shared task-relevant state space (e.g., $xy$ coordinates for locomotion tasks). Finally, example-based RL was first studied in Eysenbach et al. (2021); they introduce a recursive-classifier based off-policy actor critic method to solve it. By casting this problem as state-occupancy matching between an imitator and a "teleporting" expert agent, SMODICE can solve the offline variant of this problem without modification. + +# 6. Experiments + +We experimentally demonstrate that SMODICE is effective for offline IL from observations, mismatched experts, and examples. We give additional experimental details in Appendices G, H, and I, and videos on the project website3. + +# 6.1. Offline Imitation Learning from Observations + +Datasets. We utilize the D4RL (Fu et al., 2021) offline RL dataset. The dataset compositions for all tasks are listed in Table 3 in Appendix G. We consider the following standard Mujoco environments: Hopper, Walker2d, HalfCheetah, and Ant. For each, we take a single expert trajectory from the respective "expert-v2" dataset as the expert dataset and omit the actions. For the offline dataset, following Kim et al. (2022), we use a mixture of small number of expert trajectories $(\leq 200$ trajectories) and a large number of low-quality trajectories from the "random-v2" dataset (we use the full random dataset, consisting of around 1 million transitions). This dataset composition is particularly challenging as the learning algorithm must be able to successfully distinguish expert from low-quality data in the offline dataset. + +We also include two more challenging environments from D4RL: AntMaze and Franka Kitchen. In AntMaze (Figure 3(b)), an Ant agent is tasked with navigating an U-shaped maze from one end to the other end (i.e., the goal region). The offline dataset (i.e., "antmaze-umaze-v2") consists of trajectories ( $\approx$ 300k transitions) of an Ant agent navigating to the goal region from initial states; The trajectories are not always successful; often, the Ant flips over to its legs before it reaches the goal. We visualize this dataset on the project website. As above, we additionally include 1 million random-action transitions to increase the task difficulty. We + +![](images/dc8faea84c9a0c949b1686384cc4a81e98f82f1b01a1246666be0c58954c62c9.jpg) + +![](images/394eae4d32d9884570e0987ac157bc74b19fcc9a218296e270e1ddd019e064a5.jpg) + +![](images/a145060283a9c21a640e81bec14c64a306b8a16ac98620f56f60d7f961c2bfe2.jpg) + +![](images/82425d843a60b9c858a37bbf0a79cac1f4be0d611ec27d5810a541ed033c3ccb.jpg) +Figure 4. Offline imitation learning from observations results. + +![](images/7e56f76c61240ce01f3ea71371b09502363fd8b2f29949d83c24cb6cae596124.jpg) + +![](images/7f70c573b8ef4ca9421805f75d99c2297cebe1d113dd700a9503649c067aac45.jpg) + +take one trajectory from the offline dataset that successfully reaches the goal to be the expert trajectory. Franka Kitchen (Figure 3(c)), introduced by Gupta et al. (2019), involves controlling a 9-DoF Franka robot to manipulate common household kitchen objects (e.g., microwave, kettle, cabinet) sequentially to achieve a pre-specified configuration of objects. The dataset (i.e., "kitchen-mixed-v0") consists of undirected human teleoperated demonstrations, meaning that each trajectory only solves a subset of the tasks. Together, these six tasks (illustrated in Figure 3) require scalability to high-dimensional state-action spaces and robustness to different dataset compositions. + +Method and baselines. We use SMODICE with $\chi^2$ -divergence for all tasks (in other problem settings as well) except Hopper, Walker, and Halfcheetah, where we find SMODICE with KL-divergence to perform better; in Appendix E.2, we explain how to choose the appropriate $f$ -divergence offline by monitoring SMODICE's policy loss. For comparisons, we consider both IfO and regular offline IL methods, which make use of expert actions. For the former, we compare against (i) SAIL-TD3-BC, which combines a state-of-art state-matching based online IL algorithm (SAIL) (Liu et al., 2019) with a state-of-art offline RL algorithm (TD3-BC) (Fujimoto & Gu, 2021), (ii) Offline Reinforced Imitation Learning (ORIL) (Zolna et al., 2020), which adapts GAIL (Ho & Ermon, 2016) to the offline setting by using an offline RL algorithm for policy optimization; we implement ORIL using the same state-based discriminator as in SMODICE, and TD3-BC as the offline RL algorithm. For the latter, we consider the state-of-art DEMODICE (Kim et al., 2022) as well as Behavior Cloning (BC). We train all algorithms for 1 million gradient steps and keep track of the normalized score (i.e., 100 is expert performance, 0 is random-action performance) during training; the normalized score is averaged over 10 independ + +dent rollouts. All methods are evaluated over 3 seeds, and one standard-deviation confidence intervals are shaded. + +Results. As shown in Figure 4, only SMODICE achieves stable and good performance in all six tasks. It achieves (near) expert performance in all the Mujoco environments, performing on-par with DEMODICE and doing so without the privileged information of expert actions. SMODICE's advantage over DEMODICE is more apparent in AntMaze and Kitchen. In the former, SMODICE outperforms BC, while DEMODICE cannot; in the latter, DEMODICE quickly collapses due to its use of KL-divergence, which may be numerically unstable in high-dimensional environments. Furthermore, we adapt DEMODICE to the state-only setting by training a state-based discriminator; in Appendix G.2, we report the results and find DEMODICE to significantly underperform in the most challenging tasks across three settings. + +BC is a strong baseline for tasks where the offline dataset contains (near) expert data (i.e., AntMaze and Kitchen); however, as the dataset becomes more diverse, BC's performance drops significantly. SAIL-TD3-BC and ORIL both fail to learn in some environments and otherwise converge to a worse policy than SMODICE. The only exception is AntMaze; however, in Appendix G.2, we show that both methods collapse with a more diverse version of the AntMaze offline dataset, indicating that unlike SMODICE, these methods are highly sensitive to the composition of the offline dataset, and work best with task-aligned offline data. The sub-par performances of SAIL and ORIL highlight the challenges of adapting online IL methods to the offline setting; we hypothesize that it is not sufficient to simply equip the original methods (i.e., SAIL and GAIL) with a strong base offline RL algorithm. Together, these results demonstrate that SMODICE is stable, scalable, and robust, and significantly outperforms prior methods. Finally, in Appendix G.2, we ablate SMODICE by zeroing out its + +discriminator-based reward to validate that SMODICE's empirical performance comes from its ability to discriminate expert data in the offline dataset. + +# 6.2. Offline IL from Mismatched Experts + +Datasets and baselines. We compare SMODICE to SAIL-TD3-BC and ORIL, which are both state-based offline IL methods; in particular, we note that SAIL is originally designed to be robust to mismatched experts. We consider only tasks in which both SAIL-TD3-BC and ORIL obtained non-trivial performance, including HalfCheetah, Ant, and AntMaze. Then, for each environment, we train a mismatched expert and collect one expert trajectory, replacing the original expert trajectory used in Section 6.1. The mismatched experts for the respective tasks are (i) "HalfCheetah-Short", where the torso of the cheetah agent is halved in length, (ii) "Ant-Disabled", where the front legs are shrank by a quarter in length, and (iii) a 2D PointMass agent operating in the same maze configuration. The mismatched experts are illustrated in Figure 11 in Appendix H and the project website. For the first two, we train an expert policy using SAC (Haarnoja et al., 2018) and collect one expert trajectory. The latter task is already in D4RL; thus, we take one trajectory from "maze2d-umaze-v0" as the expert trajectory. Because Ant and PointMass have different state spaces, following Liu et al. (2019), we train the discriminator on the shared $xy$ -coordinates of the two state spaces. The offline datasets are identical to the ones in Section 6.1. + +Results. The training curves are shown in Figure 5; we illustrate the original maximum performance attained by each method (i.e., using the original expert trajectory, Section 6.1) using dashed lines as points of reference. As can be seen, SMODICE is significantly more robust to mismatched experts than either SAIL-TD3-BC or ORIL. On AntMaze, the task where SAIL-TD3-BC and ORIL originally outperform SMODICE, learning from a PointMass expert significantly deteriorates their performances, and the learned policies are noticeably worse than that of SMODICE, which has the smallest performance drop. The other two tasks exhibit similar trends; SMODICE is able to learn an expert level policy for the original Ant embodiment using a disabled Ant expert, and is the only method that shows any progress on the hardest HalfCheetah-Short task. Despite using the same discriminator for reward supervision, SMODICE is substantially more robust than ORIL, likely due to the occupancy-constraint $\mathrm{D}_f(d(s,a)\| d^O (s,a))$ term in its objective (13), which ensures that the learned policy is supported by the offline data as it attempts to match the expert states. On the project website, we visualize SMODICE and ORIL policies on all tasks. In Appendix H.2, we provide additional quantitative analysis of Figure 5. + +# 6.3. Offline Imitation Learning from Examples + +Tasks. We use the AntMaze and Kitchen environments and create example-based task variants. For AntMaze, we replace the full demonstration with a small set of success states (i.e., Ant in the goal region) extracted from the offline data. For Kitchen, we consider two subtasks in the environment: Kettle and Microwave. and define task success to be only whether the specified object is correctly placed (instead of all objects as in the original task); the success states are extracted from the offline data accordingly. Examples of the success states are illustrated in Figure 13 in Appendix I. Note that the kitchen dataset contains many trajectories where the kettle is moved first. Thus, the kettle task is easy even for Behavior Cloning (BC), since cloning the offline data can lead to success. This is not the case for the microwave task, making it much more difficult to solve using only success examples. In addition, we introduce the PointMass-4Direction environment. Here, a 2D PointMass agent is tasked with navigating to the middle point of a specified edge of the square that encloses the agent (see Figure 13(a)). The offline dataset is generated using a waypoint navigator controlling the agent to each of the four possible goals and contains equally many trajectories for each goal; we visualize this dataset on the project website. At training and evaluation time, we set the left edge to be the desired edge and collect success states from the offline data accordingly. This task is low-dimensional but consists of multi-task offline data, making it challenging for algorithms such as BC that do not solve the example-based RL objective. + +Approaches. We make no modification to SMODICE; the only difference is that the discriminator is trained using success states instead of full expert state trajectories. Our main comparison is RCE-TD3-BC, which + +![](images/ad2ac2458d90853af2e953e604281ca8c9bd6f81e7391373a2f0da5c140d4ebe.jpg) +Figure 7. SMODICE weights. + +combines RCE (Eysenbach et al., 2021), the state-of-art online example-based RL method, and TD3-BC. We also compare against ORIL (Zolna et al., 2020), using the same architecture as in Section 6.1. Finally, we also include BC. + +Results. As shown in Figure 6, SMODICE is the best performing method on all four tasks and is the only one that can solve the Microwave task; we visualize all methods' policies on all tasks on the project website. RCE-TD3-BC is able to solve the first three tasks, but achieves worse solutions and exhibits substantial performance fluctuation during training; we posit that the optimization for RCE, which requires alternate updates to a recursive classifier and a policy, is + +![](images/f52b32ad83513d2d8bc43659a0e8a5d4a4f24dd8b96a41725c49a6bc2c924975.jpg) +Figure 5. Offline imitation learning from mismatched experts results. + +![](images/d9eb87b8e1c029202b8cc43f37fa0febf74032c70b69b50b427364efa5ecb3d7.jpg) + +![](images/1fb1e9210e80adeb3fe417e425eabca12e731fadb8fefd7636400d61d0127ee0.jpg) + +![](images/246432e2ade71153d64dff09689521a674d1d6280610a5df971620621ff21206.jpg) +Figure 6. Offline imitation learning from examples results. + +![](images/54827b87e242b07940c2937137b123059c45ddff9bd2c1202328df84e7f4f4be.jpg) + +![](images/d24465cc3f554f1d16b80b098077802b4f1ea6f0ff0ca3982674a4f0cf1aa63e.jpg) + +![](images/558f37e702f015977ec004c984864ab9164384e7d15f168bc8fc742a75d7a9a4.jpg) + +substantially more difficult than that of SMODICE. ORIL is unstable and fails to make progress in most tasks. Interestingly, as in the mismatched expert setting, on AntMaze, ORIL's performance is far below that of SMODICE, despite attaining better results originally (Figure 4). This comparison demonstrates the versatility of SMODICE afforded by its state-occupancy matching objective; in contrast, ORIL treats offline IL from examples as an offline RL task with discriminator-based reward and cannot solve the task. + +To better understand SMODICE, on PointMass-4Direction, we visualize the importance weights $\xi(s, a)$ it assigns to the offline dataset. As shown in Figure 7, SMODICE assigns much higher weights to transitions along the correct path from the initial state region to the success examples. Interestingly, the weights progressively decrease along this path, indicating that SMODICE has learned that it must pay more attention transitions at the beginning of the path, since making a mistake there is more likely to derail progress towards the goal. This behavior occurs automatically via SMODICE's state-matching objective without any additional bias. + +# 7. Conclusion + +We have proposed SMODICE, a simple, stable, and versatile algorithm for offline imitation learning from observations, mismatched experts, and examples. Leveraging Fenchel duality, SMODICE derives the optimal dual value function to the state-occupancy matching objective, and obtains an uninterleaved optimization procedure for its value and policy networks that is favorable in the offline setting. Through extensive experiments, we have shown that SMODICE significantly outperforms prior state-of-art methods in all three settings. We believe that the generality of SMODICE's op + +timization procedure invites many future work directions, including offline model-based RL (Yu et al., 2020; Kidambi et al., 2020), safe RL (Ma et al., 2021b), and extending it to visual domains. + +# Acknowledgement + +We thank members of Perception, Action, and Learning group at UPenn for their feedback. This work is funded in part by an Amazon Research Award, gift funding from NEC Laboratories America, NSF Award CCF-1910769, NSF Award CCF-1917852 and ARO Award W911NF-20-1-0080. The U.S. Government is authorized to reproduce and distribute reprints for Government purposes notwithstanding any copyright notation herein. + +# References + +Baird, L. Residual algorithms: Reinforcement learning with function approximation. In Machine Learning Proceedings 1995, pp. 30-37. Elsevier, 1995. +Boyd, S., Boyd, S. P., and Vandenberghe, L. Convex optimization. Cambridge university press, 2004. +Chang, J. D., Uehara, M., Sreenivas, D., Kidambi, R., and Sun, W. Mitigating covariate shift in imitation learning via offline data without great coverage, 2021. +Dai, B., He, N., Pan, Y., Boots, B., and Song, L. Learning from conditional distributions via dual embeddings, 2016. +Dai, B., Nachum, O., Chow, Y., Li, L., Szepesvári, C., and Schuurmans, D. Coindex: Off-policy confidence interval estimation. arXiv preprint arXiv:2010.11652, 2020. +Eysenbach, B., Levine, S., and Salakhutdinov, R. Replacing rewards with examples: Example-based policy search via recursive classification. In Thirty-Fifth Conference on Neural Information Processing Systems, 2021. URL https://openreview.net/forum?id=VXeoK3fJZhW. +Fu, J., Kumar, A., Nachum, O., Tucker, G., and Levine, S. D4rl: Datasets for deep data-driven reinforcement learning, 2021. +Fujimoto, S. and Gu, S. S. A minimalist approach to offline reinforcement learning. arXiv preprint arXiv:2106.06860, 2021. +Gangwani, T. and Peng, J. State-only imitation with transition dynamics mismatch. arXiv preprint arXiv:2002.11879, 2020. +Ghasemipour, S. K. S., Zemel, R., and Gu, S. A divergence minimization perspective on imitation learning methods, 2019. +Goodfellow, I. J., Pouget-Abadie, J., Mirza, M., Xu, B., Warde-Farley, D., Ozair, S., Courville, A., and Bengio, Y. Generative adversarial networks, 2014. +Gupta, A., Kumar, V., Lynch, C., Levine, S., and Hausman, K. Relay policy learning: Solving long-horizon tasks via imitation and reinforcement learning. arXiv preprint arXiv:1910.11956, 2019. +Haarnoja, T., Zhou, A., Abbeel, P., and Levine, S. Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor, 2018. +Harris, C. R., Millman, K. J., van der Walt, S. J., Gommers, R., Virtanen, P., Cournaepau, D., Wieser, E., Taylor, J., Berg, S., Smith, N. J., Kern, R., Picus, M., Hoyer, S., van + +Kerkwijk, M. H., Brett, M., Haldane, A., del Río, J. F., Wiebe, M., Peterson, P., Gérard-Marchant, P., Sheppard, K., Reddy, T., Weckesser, W., Abbasi, H., Gohlke, C., and Oliphant, T. E. Array programming with NumPy. Nature, 585(7825):357-362, September 2020. doi: 10.1038/s41586-020-2649-2. URL https://doi.org/10.1038/s41586-020-2649-2. +Ho, J. and Ermon, S. Generative adversarial imitation learning, 2016. +Ke, L., Choudhury, S., Barnes, M., Sun, W., Lee, G., and Srinivasa, S. Imitation learning as $f$ -divergence minimization, 2020. +Kidambi, R., Rajeswaran, A., Netrapalli, P., and Joachims, T. Morel: Model-based offline reinforcement learning. arXiv preprint arXiv:2005.05951, 2020. +Kim, G.-H., Seo, S., Lee, J., Jeon, W., Hwang, H., Yang, H., and Kim, K.-E. DemoDICE: Offline imitation learning with supplementary imperfect demonstrations. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id=BrPdX1bDZkQ. +Kim, K., Gu, Y., Song, J., Zhao, S., and Ermon, S. Domain adaptive imitation learning. In International Conference on Machine Learning, pp. 5286-5295. PMLR, 2020. +Kingma, D. P. and Ba, J. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. +Kostrikov, I., Agrawal, K. K., Dwibedi, D., Levine, S., and Tompson, J. Discriminator-actor-critic: Addressing sample inefficiency and reward bias in adversarial imitation learning. arXiv preprint arXiv:1809.02925, 2018. +Kostrikov, I., Nachum, O., and Tompson, J. Imitation learning via off-policy distribution matching. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id=Hyg-JC4FDr. +Kumar, A., Fu, J., Tucker, G., and Levine, S. Stabilizing off-policy q-learning via bootstrapping error reduction. arXiv preprint arXiv:1906.00949, 2019. +Kumar, A., Zhou, A., Tucker, G., and Levine, S. Conservative q-learning for offline reinforcement learning. arXiv preprint arXiv:2006.04779, 2020. +Lange, S., Gabel, T., and Riedmiller, M. Batch reinforcement learning. In Reinforcement learning, pp. 45-73. Springer, 2012. +Lee, J., Jeon, W., Lee, B.-J., Pineau, J., and Kim, K.-E. Optidice: Offline policy optimization via stationary distribution correction estimation. arXiv preprint arXiv:2106.10783, 2021. + +Levine, S., Kumar, A., Tucker, G., and Fu, J. Offline reinforcement learning: Tutorial, review, and perspectives on open problems. arXiv preprint arXiv:2005.01643, 2020. +Liu, F., Ling, Z., Mu, T., and Su, H. State alignment-based imitation learning. arXiv preprint arXiv:1911.10947, 2019. +Ma, Y., Jayaraman, D., and Bastani, O. Conservative offline distributional reinforcement learning. Advances in Neural Information Processing Systems, 34, 2021a. +Ma, Y. J., Shen, A., Bastani, O., and Jayaraman, D. Conservative and adaptive penalty for model-based safe reinforcement learning. arXiv preprint arXiv:2112.07701, 2021b. +Nachum, O. and Dai, B. Reinforcement learning via fenchel-rockafellar duality, 2020. +Nachum, O., Chow, Y., Dai, B., and Li, L. Dualdice: Behavior-agnostic estimation of discounted stationary distribution corrections. arXiv preprint arXiv:1906.04733, 2019a. +Nachum, O., Dai, B., Kostrikov, I., Chow, Y., Li, L., and Schuurmans, D. Algaedice: Policy gradient from arbitrary experience, 2019b. +Puterman, M. L. Markov decision processes: discrete stochastic dynamic programming. John Wiley & Sons, 2014. +Radosavovic, I., Wang, X., Pinto, L., and Malik, J. Stateonly imitation learning for dexterous manipulation, 2020. +Raychaudhuri, D. S., Paul, S., van Baar, J., and Roy-Chowdhury, A. K. Cross-domain imitation from observations, 2021. +Rockafellar, R. T. Convex Analysis. Princeton University Press, 2015. ISBN 9781400873173. doi: doi: 10.1515/9781400873173. URL https://doi.org/ 10.1515/9781400873173. +Ross, S., Gordon, G. J., and Bagnell, J. A. A reduction of imitation learning and structured prediction to no-regret online learning, 2011. +Rudner, T. G. J., Lu, C., Osborne, M., Gal, Y., and Teh, Y. W. On pathologies in KL-regularized reinforcement learning from expert demonstrations. In Beygelzimer, A., Dauphin, Y., Liang, P., and Vaughan, J. W. (eds.), Advances in Neural Information Processing Systems, 2021. URL https://openreview.net/forum?id=sS8rRmgAatA. +Torabi, F., Warnell, G., and Stone, P. Behavioral cloning from observation, 2018. + +Torabi, F., Warnell, G., and Stone, P. Generative adversarial imitation from observation, 2019. +Yang, C., Ma, X., Huang, W., Sun, F., Liu, H., Huang, J., and Gan, C. Imitation learning from observations by minimizing inverse dynamics disagreement. arXiv preprint arXiv:1910.04417, 2019. +Yu, T., Thomas, G., Yu, L., Ermon, S., Zou, J., Levine, S., Finn, C., and Ma, T. Mopo: Model-based offline policy optimization. arXiv preprint arXiv:2005.13239, 2020. +Zhang*, R., Dai*, B., Li, L., and Schuurmans, D. Gendice: Generalized offline estimation of stationary values. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id=Hkx1cnVFwB. +Zhu, Z., Lin, K., Dai, B., and Zhou, J. Off-policy imitation learning from observations. Advances in Neural Information Processing Systems, 33, 2020. +Zolna, K., Novikov, A., Konyushkova, K., Gulcehre, C., Wang, Z., Aytar, Y., Denil, M., de Freitas, N., and Reed, S. Offline learning from demonstrations and unlabeled experience. arXiv preprint arXiv:2011.13885, 2020. + +# A. Proofs + +# A.1. Technical Lemmas + +Lemma 1. We have + +$$ +\mathrm {D} _ {\mathrm {K L}} \left(d ^ {\pi} (s) \| d ^ {E} (s)\right) \leq \mathrm {D} _ {\mathrm {K L}} \left(d ^ {\pi} (s, a) \| d ^ {E} (s, a)\right) +$$ + +Proof. We first state and prove a related lemma, which first appeared in (Yang et al., 2019). + +Lemma 2. + +$$ +\mathrm {D} _ {\mathrm {K L}} \left(d ^ {\pi} (s, a, s ^ {\prime}) \| d ^ {E} (s, a, s ^ {\prime})\right) = \mathrm {D} _ {\mathrm {K L}} \left(d ^ {\pi} (s, a) \| d ^ {E} (s, a)\right). +$$ + +Proof. + +$$ +\begin{array}{l} \mathrm {D} _ {\mathrm {K L}} \left(d ^ {\pi} (s, a, s ^ {\prime}) \| d ^ {E} (s, a, s ^ {\prime})\right) \\ = \int_ {\mathcal {S} \times \mathcal {A} \times \mathcal {S}} d ^ {\pi} (s, a, s ^ {\prime}) \log \frac {d ^ {\pi} (s , a) \cdot T \left(s ^ {\prime} \mid s , a\right)}{d ^ {E} (s , a) \cdot T \left(s ^ {\prime} \mid s , a\right)} d s ^ {\prime} d a d s \\ = \int_ {\mathcal {S} \times \mathcal {A} \times \mathcal {S}} d ^ {\pi} (s, a, s ^ {\prime}) \log \frac {d ^ {\pi} (s , a)}{d ^ {E} (s , a)} d s ^ {\prime} d a d s \\ = \int_ {\mathcal {S} \times \mathcal {A}} d ^ {\pi} (s, a) \log \frac {d ^ {\pi} (s , a)}{d ^ {E} (s , a)} d a d s \\ = \mathrm {D} _ {\mathrm {K L}} \left(d ^ {\pi} (s, a) \| d ^ {E} (s, a)\right) \\ \end{array} +$$ + +Using this result, we can show the desired upper bound: + +$$ +\begin{array}{l} \mathrm {D} _ {\mathrm {K L}} \left(d ^ {\pi} (s, a) \| d ^ {E} (s, a)\right) \\ = \mathrm {D} _ {\mathrm {K L}} \left(d ^ {\pi} (s, a, s ^ {\prime}) \| d ^ {E} (s, a, s ^ {\prime})\right) \\ = \int_ {\mathcal {S} \times \mathcal {A} \times \mathcal {S}} d ^ {\pi} (s, a, s ^ {\prime}) \log \frac {d ^ {\pi} (s , a) \cdot T \left(s ^ {\prime} \mid s , a\right)}{d ^ {E} (s , a) \cdot T \left(s ^ {\prime} \mid s , a\right)} d s ^ {\prime} d a d s \\ = \int_ {\mathcal {S} \times \mathcal {A} \times \mathcal {S}} d ^ {\pi} (s) \pi (a \mid s) T \left(s ^ {\prime} \mid s, a\right) \log \frac {d ^ {\pi} (s , a) \cdot T \left(s ^ {\prime} \mid s , a\right)}{d ^ {E} (s , a) \cdot T \left(s ^ {\prime} \mid s , a\right)} d s ^ {\prime} d a d s \\ = \int d ^ {\pi} (s) \pi (a \mid s) T \left(s ^ {\prime} \mid s, a\right) \log \frac {d ^ {\pi} (s)}{d ^ {E} (s)} d s ^ {\prime} d a d s + \int d ^ {\pi} (s) \pi (a \mid s) T \left(s ^ {\prime} \mid s, a\right) \log \frac {\pi (a \mid s) T \left(s ^ {\prime} \mid s , a\right)}{\pi^ {E} (a \mid s) T \left(s ^ {\prime} \mid s , a\right)} d s ^ {\prime} d a d s \\ = \int d ^ {\pi} (s) \log \frac {d ^ {\pi} (s)}{d ^ {E} (s)} d s + \int d ^ {\pi} (s) \pi (a \mid s) \log \frac {\pi (a \mid s)}{\pi^ {E} (a \mid s)} d a d s \\ = \mathrm {D} _ {\mathrm {K L}} \left(d ^ {\pi} (s) \| d ^ {E} (s)\right) + \mathrm {D} _ {\mathrm {K L}} \left(\pi (a | s) \| \pi^ {E} (a | s)\right) \\ \geq \mathrm {D} _ {\mathrm {K L}} \left(d ^ {\pi} (s) \| d ^ {E} (s)\right) \\ \end{array} +$$ + +# A.2. Proof of Theorem 1 + +Proof. + +$$ +\begin{array}{l} D _ {\mathrm {K L}} \left(d ^ {\pi} (s) \| d ^ {E} (s)\right) \\ = \int d ^ {\pi} (s) \log \frac {d ^ {\pi} (s)}{d ^ {E} (s)} \cdot \frac {d ^ {O} (s)}{d ^ {O} (s)} d s, \quad \text {w e a s s u m e t h a t} d ^ {O} (s) > 0 \text {w h e n e v e r} d ^ {E} (s) > 0. \\ = \int d ^ {\pi} (s) \log \frac {d ^ {O} (s)}{d ^ {E} (s)} d s + \int d ^ {\pi} (s) \log \frac {d ^ {\pi} (s)}{d ^ {O} (s)} d s \\ \leq \mathbb {E} _ {s \sim d ^ {\pi}} \left[ \log \frac {d ^ {O} (s)}{d ^ {E} (s)} \right] + \mathrm {D} _ {\mathrm {K L}} \left(d ^ {\pi} (s, a) \| d ^ {E} (s, a)\right) \\ \end{array} +$$ + +![](images/6acdd7f237f88d9f366b63ff5def68eefc6ec713762e3f32a3a6ad11388f00ee.jpg) + +where the last step follows from Lemma 1. Then, for any $\mathrm{D}_f\geq \mathrm{D}_{\mathrm{KL}}$ , we have that + +$$ +D _ {\mathrm {K L}} \left(d ^ {\pi} (s) \| d ^ {E} (s)\right) \leq \mathbb {E} _ {s \sim d ^ {\pi}} \left[ \log \frac {d ^ {O} (s)}{d ^ {E} (s)} \right] + \mathrm {D} _ {f} \left(d ^ {\pi} (s, a) \| d ^ {E} (s, a)\right) +$$ + +# A.3. Proof of Theorem 2 + +Proof. We begin with + +$$ +\min _ {V (s) \geq 0} \max _ {d (s, a) \geq 0} (1 - \gamma) \mathbb {E} _ {s \sim \mu_ {0}} [ V (s) ] + \mathbb {E} _ {(s, a) \sim d} \left[ \left(R (s) + \gamma \mathcal {T} V (s, a) - V (s)\right) \right] - D _ {f} (d (s, a) \| d ^ {O} (s, a)) \tag {28} +$$ + +We have that + +$$ +\begin{array}{l} \min _ {V (s) \geq 0} \max _ {d (s, a) \geq 0} (1 - \gamma) \mathbb {E} _ {s \sim \mu_ {0}} [ V (s) ] + \mathbb {E} _ {(s, a) \sim d} \left[ \left(R (s) + \gamma \mathcal {T} V (s, a) - V (s)\right) \right] - \mathrm {D} _ {f} (d (s, a) \| d ^ {O} (s, a)) (29) \\ = \min _ {V (s) \geq 0} (1 - \gamma) \mathbb {E} _ {s \sim \mu_ {0}} [ V (s) ] + \max _ {d (s, a) \geq 0} + \mathbb {E} _ {(s, a) \sim d} \left[ \left(R (s) + \gamma \mathcal {T} V (s, a) - V (s)\right) \right] - \mathrm {D} _ {f} (d (s, a) \| d ^ {O} (s, a)) (30) \\ = \min _ {V (s) \geq 0} (1 - \gamma) \mathbb {E} _ {s \sim \mu_ {0}} [ V (s) ] + \mathbb {E} _ {(s, a) \sim d ^ {O}} \left[ f _ {\star} (R (s) + \gamma \mathcal {T} V (s, a) - V (s)) \right] (31) \\ \end{array} +$$ + +where the last step follows from recognizing that the inner-maximization is precisely the Fenchel conjugate of $D_{f}(d(s,a)\| d^{O}(s,a))$ at $R(s) + \gamma \mathcal{T}V(s,a) - V(s)$ . + +To show the relationship among $V^{\star}$ and $\xi^{\star}$ , we recognize that (31) and (15) are a pair of Fenchel primal-dual problems. + +# Lemma 3. + +$$ +\min _ {V (s) \geq 0} (1 - \gamma) \mathbb {E} _ {s \sim \mu_ {0}} [ V (s) ] + \mathbb {E} _ {(s, a) \sim d ^ {O}} \left[ f _ {\star} (R (s) + \gamma \mathcal {T} V (s, a) - V (s)) \right] +$$ + +is the Fenchel dual to + +$$ +\max _ {d (s, a) \geq 0} \mathbb {E} _ {s \sim d} \left[ \log \left(\frac {d ^ {E} (s)}{d ^ {O} (s)}\right) \right] - \mathrm {D} _ {f} (d (s, a) \| d ^ {O} (s, a)) \tag {32} +$$ + +$$ +s. t. \sum_ {a} d (s, a) = (1 - \gamma) \mu_ {0} (s) + \gamma \mathcal {T} _ {\star} d (s), \forall s \in S \tag {33} +$$ + +Proof. We define the indicator function $\delta_{\mathcal{X}}(x)$ as + +$$ +\delta_ {\mathcal {X}} (x) = \left\{ \begin{array}{l l} 0 & x \in \mathcal {X} \\ \infty & \text {o t h e r w i s e} \end{array} \right. +$$ + +Then, we define $g: \mathbb{R}^{|S|} \to \mathbb{R}$ as $g(\cdot) \coloneqq \delta_{\{(1 - \gamma)\mu_0\}}(\cdot)$ . Then, it can be shown that the Fenchel conjugate of $g$ is $g_\star(\cdot) = (1 - \gamma)\mathbb{E}_{\mu_0}[\cdot]$ . In addition, we denote $h(\cdot) \coloneqq \mathrm{D} + f(\cdot \| d^{\mathcal{O}})$ ; then, $h_\star(\cdot) = \mathbb{E}_{(s,a) \sim d^{\mathcal{O}}}[f_\star(\cdot)]$ . Finally, define matrix operator $A \coloneqq \gamma T_\star - I$ . Using these notations, we can write (31) as + +$$ +\min _ {V} g _ {\star} (V) + h _ {\star} \left(A _ {\star} V + R\right) \tag {34} +$$ + +Then, we proceed to derive the Fenchel dual of (34): + +$$ +\begin{array}{l} \min _ {V} g _ {\star} (V) + h _ {\star} \left(A _ {\star} V + R\right) (35) \\ = \min _ {V} \max _ {d} g _ {\star} (V) + \langle d, A _ {\star} V + R \rangle - h (d) (36) \\ = \min _ {V} \max _ {d} g _ {\star} (V) + \langle d, A _ {\star} V \rangle + \langle d, R \rangle - h (d) (37) \\ = \max _ {d} \left(\min _ {V} g _ {\star} (V) + \langle d, A _ {\star} V \rangle\right) + \langle d, R \rangle - h (d) (38) \\ = \max _ {d} \left(\min _ {V} g _ {\star} (V) + \langle A d, V \rangle\right) + \langle d, R \rangle - h (d) (39) \\ = \max _ {d} \left(\max _ {V} - g _ {\star} (V) + \langle - A d, V \rangle\right) + \langle d, R \rangle - h (d) (40) \\ = \max _ {d} g (- A d) + \langle d, R \rangle - h (d) (41) \\ \end{array} +$$ + +where (36) follows applying Fenchel conjugacy to $h_{\star}$ , (38) follows from strong duality, (39) follows from the property of an adjoint operator, and (41) follows from applying Fenchel conjugacy to $g_{\star}$ . Here, we recognize that (41) is precisely the optimization problem (32)-(33), where we have moved the constraint (33) to the objective as the indicator function $g(-Ad)$ : + +$$ +\begin{array}{l} g (- A d) = \delta_ {\left\{\left(1 - \gamma\right) \mu_ {0} \right\}} (d - \gamma \mathcal {T} _ {\star} d) \\ \Leftrightarrow \sum_ {a} d (s, a) = (1 - \gamma) \mu_ {0} (s) + \gamma \mathcal {T} _ {\star} d (s), \forall s \in S \\ \end{array} +$$ + +![](images/5570bcaa2de21dc8740853e3004543d754bd3a2b0cee4d3670b180a2a5f906b3.jpg) + +Giving Lemma 3, we use the fact that $d^{*}$ and $V^{*}$ admit the following relationship: + +$$ +d ^ {*} = h _ {\star} ^ {\prime} \left(- A _ {\star} V ^ {*} + R\right) \tag {42} +$$ + +This follows from the characterization of the optimal solutions for a pair of Fenchel primal-dual problems with convex $g, h$ and linear operator $A$ (Nachum & Dai, 2020). In this case, assuming that we can exchange the order of expectation and derivative (e.g., conditions of Dominated Convergence Theorem hold), we have + +$$ +d ^ {*} = \mathbb {E} _ {(s, a) \sim d ^ {o}} \left[ f _ {\star} \left(\left(R (s) + \gamma \mathcal {T} V (s, a) - V (s)\right) \right], \right. \tag {43} +$$ + +or equivalently, + +$$ +d ^ {*} (s, a) = f _ {\star} \left(R (s) + \gamma \mathcal {T} V (s, a) - V (s)\right) \cdot d ^ {O} (s, a), \forall s, a \in \mathcal {S} \times \mathcal {A}, \tag {44} +$$ + +as desired. + +![](images/96370de9e327be33332f9e40e550da7f6c683659893bfce48bd48515ffe9c259.jpg) + +# B. Extended Related Work + +Stationary distribution correction estimation. Estimating the optimal policy's stationary distribution using off-policy data was introduced by (Nachum et al., 2019a) as the DICE trick. This technique has been shown to be effective for off-policy evaluation (Nachum et al., 2019a; Zhang* et al., 2020; Dai et al., 2020), policy optimization (Nachum et al., 2019b; Lee et al., 2021), online imitation learning (Kostrikov et al., 2020; Zhu et al., 2020), and concurrently, offline imitation learning (Kim et al., 2022). Within the subset of DICE-based policy optimization methods, none has tackled state-occupancy matching or directly apply Fenchel Duality to its full generality to arrive at the form of value function objective we derive. + +# C. SMODICE with common $f$ -divergences + +Example 1 (SMODICE with $\chi^2$ -divergence). Suppose $f(x) = \frac{1}{2}(x - 1)^2$ , corresponding to $\chi^2$ -divergence. Then, we can show that $f_{\star}(x) = \frac{1}{2}(x + 1)^2$ and $f_{\star}'(x) = x + 1$ . Hence, the SMODICE objective amounts to + +$$ +\min _ {V (s) \geq 0} (1 - \gamma) \mathbb {E} _ {s \sim \mu_ {0}} [ V (s) ] + \frac {1}{2} \mathbb {E} _ {(s, a) \sim d ^ {\circ}} \left[ (R (s) + \gamma \mathcal {T} V (s, a) - V (s) + 1) ^ {2} \right] \tag {45} +$$ + +and + +$$ +\xi^ {*} (s, a) = \frac {d ^ {*} (s , a)}{d ^ {O} (s , a)} = \max (0, R (s, a) + \gamma \mathcal {T} V ^ {*} (s, a) - V ^ {*} (s) + 1) \tag {46} +$$ + +Example 2 (SMODICE with KL-divergence). We have $f(x) = x \log x$ . Using the fact that the conjugate of the negative entropy function, restricted to the probability simplex, is the log-sum-exp function (Boyd et al., 2004), it follows that $\mathrm{D}_{\star ,f}(y) = \log \mathbb{E}_{x\sim q}[\exp y(x)]$ . Hence, the KL-divergence SMODICE objective is + +$$ +\min _ {V (s) \geq 0} (1 - \gamma) \mathbb {E} _ {s \sim \mu_ {0}} [ V (s) ] + \log \mathbb {E} _ {(s, a) \sim d ^ {o}} [ \exp (R (s) + \gamma \mathcal {T} V (s, a) - V (s)) ] \tag {47} +$$ + +and + +$$ +\xi^ {*} (s, a) = \frac {d ^ {*} (s , a)}{d ^ {O} (s , a)} = \operatorname {s o f t m a x} \left(R + \gamma \mathcal {T} V ^ {*} (s, a) - V ^ {*} (s)\right) \tag {48} +$$ + +# D. SMODICE for Tabular MDPs + +In this section, we derive the closed-form expression of SMODICE for tabular MDPs. For simplicity, we assume that the expert state occupancies are given, $d^{E}(s)\in \Delta (|S|)$ . A behavior policy $\pi_{b}$ is used to collect the offline dataset $\mathcal{D}^O$ . Then, we can construct a surrogate MDP $\hat{\mathcal{M}}$ using maximum likelihood estimation (i.e., $\hat{T} (s,a,s^{\prime}) = \frac{n(s,a,s^{\prime})}{n(s,a)}$ ). Using $\hat{\mathcal{M}}$ , we can extract the empirical estimate of the behavior policy occupancies $d^{O}\in \Delta (|S||\mathcal{A}|)$ using linear programming. Then, we can define the reward vector $R\in \mathbb{R}_{+}^{|\mathcal{S}|}$ as $R(s) = \log \frac{d^{E}(s)}{d^{O}(s)}$ . Using the $\chi^2$ -divergence version of SMODICE, we can write down the objective for $V(s)\in \mathbb{R}_{+}^{|\mathcal{S}|}$ : + +$$ +\min _ {V (s) \geq 0} (1 - \gamma) \mathbb {E} _ {s \sim \mu_ {0}} [ V (s) ] + \frac {1}{2} \mathbb {E} _ {(s, a) \sim d ^ {\circ}} \left[ (R (s) + \gamma \mathcal {T} V (s, a) - V (s) + 1) ^ {2} \right] \tag {49} +$$ + +We rewrite this expression in vector-matrix form to derive the closed-form solution. To this end, we define $\mathcal{T} \in \mathbb{R}^{|S||\mathcal{A}|\times|S|}$ and $\mathcal{B} \in \mathbb{R}^{|\mathcal{S}||\mathcal{A}|\times|\mathcal{S}|}$ such that $(\mathcal{T}V)(s,a) = \sum_{s'} T(s'|s,a)V(s')$ and $(\mathcal{B}V)(s,a) = V(s)$ . Additionally, we denote $\mu_0 \in \Delta(|\mathcal{S}|)$ and $D = \mathrm{diag}(d^O) \in \mathbb{R}^{|\mathcal{S}||\mathcal{A}|\times|\mathcal{S}||\mathcal{A}|}$ . Then, we can rewrite (49): + +$$ +\begin{array}{l} \min _ {V (s) \geq 0} (1 - \gamma) \mathbb {E} _ {s \sim \mu_ {0}} [ V (s) ] + \frac {1}{2} \mathbb {E} _ {(s, a) \sim d ^ {O}} \left[ (R (s) + \gamma \mathcal {T} V (s, a) - V (s) + 1) ^ {2} \right] \\ \Rightarrow \min _ {V (s)} (1 - \gamma) \mu_ {0} ^ {\top} V + \frac {1}{2} \mathbb {E} _ {(s, a) \sim d ^ {O}} \left[ \left(\underbrace {\mathcal {B} R (s , a) + \gamma \mathcal {T} V (s , a) - \mathcal {B} V (s , a)} _ {r _ {V} (s, a)} + 1\right) ^ {2} \right] \tag {50} \\ \Rightarrow \min _ {V (s)} (1 - \gamma) \mu_ {0} ^ {\top} V + \frac {1}{2} (r _ {V} + I) ^ {\top} D (r _ {V} + I) \\ \end{array} +$$ + +where $r_V \in \mathbb{R}^{|S||\mathcal{A}|}$ and $I$ is the all-one vector in $\mathbb{R}^{|S||\mathcal{A}|}$ . Denoting $J(V) \coloneqq (1 - \gamma)\mu_0^\top V + \frac{1}{2}(r_V + I)^\top D(r_V + I)$ , it is clear that $J(V)$ is a convex program in $V$ . Therefore, we can find its optimal solution by solving the first-order stationary point. We have: + +$$ +\begin{array}{l} \frac {\partial J (V)}{\partial V} = \frac {\partial}{\partial V} \left((1 - \gamma) \mu_ {0} ^ {\top} V + \frac {1}{2} (r _ {V} + I) ^ {\top} D (r _ {V} + I)\right) \\ = \frac {\partial}{\partial V} \left((1 - \gamma) \mu_ {0} ^ {\top} V + \frac {1}{2} r _ {V} ^ {\top} D r _ {V} + r _ {V} ^ {\top} D I + I ^ {\top} D I\right) \\ = (1 - \gamma) \mu_ {0} + (\gamma \mathcal {T} - \mathcal {B}) ^ {\top} D r _ {V} + (\gamma \mathcal {T} - \mathcal {B}) ^ {\top} D I \\ = (1 - \gamma) \mu_ {0} + (\gamma \mathcal {T} - \mathcal {B}) ^ {\top} D (\mathcal {B} R + (\gamma \mathcal {T} - \mathcal {B}) V) + (\gamma \mathcal {T} - \mathcal {B}) ^ {\top} D I \\ \end{array} +$$ + +Then, by setting this expression to zero and solving for $V$ gives the optimal $V^{*}$ : + +$$ +\begin{array}{l} (\gamma \mathcal {T} - \mathcal {B}) ^ {\top} D (\gamma \mathcal {T} - \mathcal {B}) V = (\gamma - 1) \mu_ {0} + (\mathcal {B} - \gamma \mathcal {T}) ^ {\top} D (I + B R) \\ \Rightarrow V ^ {*} = \left(\left(\gamma \mathcal {T} - \mathcal {B}\right) ^ {\top} D \left(\gamma \mathcal {T} - \mathcal {B}\right)\right) ^ {- 1} \left(\left(\gamma - 1\right) \mu_ {0} + \left(\mathcal {B} - \gamma \mathcal {T}\right) ^ {\top} D (I + B R)\right) \tag {51} \\ \end{array} +$$ + +and we can recover $\xi^{*}(s,a) = \frac{d^{*}(s,a)}{d^{O}(s,a)}$ : + +$$ +\xi^ {*} (s, a) = \mathcal {B} R (s, a) + \gamma \mathcal {T} V ^ {*} (s, a) - \mathcal {B} V ^ {*} (s, a) + 1 \tag {52} +$$ + +Pythonic pseudo-code using NumPy (Harris et al., 2020) is given in Algorithm 2. + +# D.1. Performance Guarantee + +The closed-form solution of $V^{*}$ assumes knowledge of the true transition $\mathcal{T}$ . When the empirical transition function $\hat{\mathcal{T}}$ is estimated from samples (i.e., $\hat{\mathcal{T}}(s' \mid s, a) \coloneqq \frac{n(s, a, s')}{n}$ ), we can obtain the following finite-sample performance guarantee: + +Theorem 4. Let $R_{\mathrm{max}} = \max_s \log \frac{d^E(s)}{d^O(s)}$ , $D_{\mathrm{min}} = \min_{s,a} d^O (s,a)$ , and $\hat{\mathcal{T}}(s' \mid s,a) := \frac{n(s,a,s')}{n}$ . Assume that $\left\| (A^\top DA)^{-1} \right\|_{\infty} \leq \frac{1}{(1 - \gamma)^2 D_{\mathrm{min}}}$ . Then, for any $\delta \in \mathbb{R}_{>0}$ , with probability $\geq 1 - \delta$ , we have + +$$ +\left\| V ^ {*} - \hat {V} \right\| _ {\infty} \leq \left(\frac {2 (2 + R _ {\mathrm {m a x}}) (2 + \gamma) \gamma}{(1 - \gamma) ^ {4} D _ {\mathrm {m i n}} ^ {2}}\right) \sqrt {\frac {2 S}{n} \log \frac {4 S A}{\delta}} +$$ + +Proof. We begin by reiterating the expressions for $V^{*}$ and $\hat{V}$ : + +$$ +\begin{array}{l} V ^ {*} = \left((\gamma \mathcal {T} - \mathcal {B}) ^ {\top} D (\gamma \mathcal {T} - \mathcal {B})\right) ^ {- 1} \left((\gamma - 1) \mu_ {0} + (\mathcal {B} - \gamma \mathcal {T}) ^ {\top} D (I + B R)\right) \\ \hat {V} = \left(\left(\gamma \hat {\mathcal {T}} - \mathcal {B}\right) ^ {\top} D \left(\gamma \hat {\mathcal {T}} - \mathcal {B}\right)\right) ^ {- 1} \left(\left(\gamma - 1\right) \mu_ {0} + \left(\mathcal {B} - \gamma \hat {\mathcal {T}}\right) ^ {\top} D (I + B R)\right) \tag {53} \\ \end{array} +$$ + +For notational simplicity, we let $A \coloneqq \gamma \mathcal{T} - B$ and $\hat{A} \coloneqq \gamma \hat{\mathcal{T}} - B$ . Then, we have + +$$ +\begin{array}{l} V ^ {*} - \hat {V} = \left(A ^ {\top} D A\right) ^ {- 1} \left((\gamma - 1) \mu_ {0} - A ^ {\top} D (I + B R)\right) - \left(\hat {A} ^ {\top} D \hat {A}\right) ^ {- 1} \left((\gamma - 1) \mu_ {0} - \hat {A} ^ {\top} D (I + B R)\right) (54) \\ = \left(A ^ {\top} D A\right) ^ {- 1} (\gamma - 1) \mu_ {0} (55) \\ - \left(A ^ {\top} D A\right) ^ {- 1} A ^ {\top} D (I + B R) - \left(\hat {A} ^ {\top} D \hat {A}\right) ^ {- 1} (\gamma - 1) \mu_ {0} + \left(\hat {A} ^ {\top} D \hat {A}\right) ^ {- 1} \hat {A} ^ {\top} D (I + B R) (56) \\ \end{array} +$$ + +Now, we can bound the $\| \cdot \|_{\infty}$ + +$$ +\begin{array}{l} \left\| V ^ {*} - \hat {V} \right\| _ {\infty} = \| \left(A ^ {\top} D A\right) ^ {- 1} (\gamma - 1) \mu_ {0} - \left(A ^ {\top} D A\right) ^ {- 1} A ^ {\top} D (I + B R) - \left(\hat {A} ^ {\top} D \hat {A}\right) ^ {- 1} (\gamma - 1) \mu_ {0} (57) \\ + \left(\hat {A} ^ {\top} D \hat {A}\right) ^ {- 1} \hat {A} ^ {\top} D (I + B R) \| _ {\infty} (58) \\ \leq \left\| \left(A ^ {\top} D A\right) ^ {- 1} (\gamma - 1) \mu_ {0} - \left(\hat {A} ^ {\top} D \hat {A}\right) ^ {- 1} (\gamma - 1) \mu_ {0} \right\| _ {\infty} (59) \\ + \left\| \left(\hat {A} ^ {\top} D \hat {A}\right) ^ {- 1} \hat {A} ^ {\top} D (I + B R) - \left(A ^ {\top} D A\right) ^ {- 1} A ^ {\top} D (I + B R) \right\| _ {\infty} (60) \\ \leq (1 - \gamma) \left\| \left(A ^ {\top} D A\right) ^ {- 1} - \left(\hat {A} ^ {\top} D \hat {A}\right) ^ {- 1} \right\| _ {\infty} (61) \\ + \left\| \left(\hat {A} ^ {\top} D \hat {A}\right) ^ {- 1} \hat {A} ^ {\top} D (I + B R) - \left(A ^ {\top} D A\right) ^ {- 1} A ^ {\top} D (I + B R) \right\| _ {\infty} (62) \\ = (1 - \gamma) \left\| \left(A ^ {\top} D A\right) ^ {- 1} - \left(\hat {A} ^ {\top} D \hat {A}\right) ^ {- 1} \right\| _ {\infty} (63) \\ + \left\| \left(\hat {A} ^ {\top} D \hat {A}\right) ^ {- 1} \hat {A} ^ {\top} D (I + B R) - \left(A ^ {\top} D A\right) ^ {- 1} \hat {A} ^ {\top} D (I + B R) \right\| _ {\infty} (64) \\ + \left\| \left(A ^ {\top} D A\right) ^ {- 1} \hat {A} ^ {\top} D (I + B R) - \left(A ^ {\top} D A\right) ^ {- 1} A ^ {\top} D (I + B R) \right\| _ {\infty} (65) \\ \leq (1 - \gamma) \left\| \left(A ^ {\top} D A\right) ^ {- 1} - \left(\hat {A} ^ {\top} D \hat {A}\right) ^ {- 1} \right\| _ {\infty} (66) \\ + \left\| \left(\hat {A} ^ {\top} D \hat {A}\right) ^ {- 1} - \left(A ^ {\top} D A\right) ^ {- 1} \right\| _ {\infty} \left\| \hat {A} ^ {\top} D (I + B R) \right\| _ {\infty} (67) \\ + \left\| \left(A ^ {\top} D A\right) ^ {- 1} \right\| _ {\infty} \left\| (\hat {A} - A) ^ {\top} D (I + B R) \right\| _ {\infty} (68) \\ \end{array} +$$ + +Since induced norm is submultiplicative, we have + +$$ +\left\| \hat {A} ^ {\top} D (I + B R) \right\| _ {\infty} \leq \left\| \hat {A} ^ {\top} D \right\| _ {\infty} \| (I + B R) \| _ {\infty} \leq \left(1 + R _ {\max }\right) \tag {69} +$$ + +$$ +\left\| (\hat {A} - A) ^ {\top} D (I + B R) \right\| _ {\infty} \leq \left\| (\hat {A} - A) ^ {\top} D \right\| _ {\infty} \| (I + B R) \| _ {\infty} \leq \left\| (\hat {A} - A) ^ {\top} D \right\| _ {\infty} \left(1 + R _ {\max }\right) \tag {70} +$$ + +The first inequality follows because + +$$ +\left\| \hat {A} ^ {\top} D \right\| _ {\infty} = \max _ {s ^ {\prime}} \sum_ {s, a} \left| (\gamma \hat {\mathcal {T}} (s ^ {\prime} \mid s, a) - \mathbf {1} (s ^ {\prime} = s)) D (s, a) \right| \leq \max _ {s ^ {\prime}, s, a} \left| \gamma \hat {\mathcal {T}} (s ^ {\prime} \mid s, a) - \mathbf {1} (s ^ {\prime} = s) \right| = 1 \tag {71} +$$ + +which uses the fact that $\sum_{s,a}D(s,a) = 1$ + +Plugging this back in gives + +$$ +\begin{array}{l} \left\| V ^ {*} - \hat {V} \right\| _ {\infty} \leq \left((1 - \gamma) + \left(1 + R _ {\max }\right)\right) \left\| \left(\hat {A} ^ {\top} D \hat {A}\right) ^ {- 1} - \left(A ^ {\top} D A\right) ^ {- 1} \right\| _ {\infty} \tag {72} \\ + \left(1 + R _ {\max }\right) \left\| \left(A ^ {\top} D A\right) ^ {- 1} \right\| _ {\infty} \left\| \left(\hat {A} - A\right) ^ {\top} D \right\| _ {\infty} \\ \end{array} +$$ + +Now, we note that + +$$ +\begin{array}{l} \left\| (\hat {A} - A) ^ {\top} D \right\| _ {\infty} (73) \\ = \gamma \left\| (\hat {\mathcal {T}} - \mathcal {T}) ^ {\top} D \right\| _ {\infty} (74) \\ = \gamma \max _ {s ^ {\prime}} \sum_ {s, a} \left| \left(\hat {\mathcal {T}} \left(s ^ {\prime} \mid s, a\right) - \mathcal {T} \left(s ^ {\prime} \mid s, a\right)\right) D (s, a) \right| (75) \\ \leq \gamma \max _ {s ^ {\prime}, s, a} \left| \left(\hat {\mathcal {T}} \left(s ^ {\prime} \mid s, a\right) - \mathcal {T} \left(s ^ {\prime} \mid s, a\right)\right) \right| (76) \\ \leq \gamma \max _ {s, a} \left\| \hat {\mathcal {T}} (\cdot | s, a) - \mathcal {T} (\cdot | s, a) \right\| _ {1} (77) \\ \end{array} +$$ + +and + +$$ +\begin{array}{l} \left\| \left(\hat {A} ^ {\top} D \hat {A}\right) ^ {- 1} - \left(A ^ {\top} D A\right) ^ {- 1} \right\| _ {\infty} (78) \\ = \left\| \left(A ^ {\top} D A\right) ^ {- 1} \left(A ^ {\top} D A - \hat {A} ^ {\top} D \hat {A}\right) \left(\hat {A} ^ {\top} D \hat {A}\right) ^ {- 1} \right\| _ {\infty} (79) \\ \leq \left\| \left(A ^ {\top} D A\right) ^ {- 1} \right\| _ {\infty} \left\| A ^ {\top} D A - \hat {A} ^ {\top} D \hat {A} \right\| _ {\infty} \left\| \left(\hat {A} ^ {\top} D \hat {A}\right) ^ {- 1} \right\| _ {\infty} (80) \\ \leq \left\| \left(A ^ {\top} D A\right) ^ {- 1} \right\| _ {\infty} ^ {2} \left\| A ^ {\top} D A - \hat {A} ^ {\top} D \hat {A} \right\| _ {\infty} (81) \\ = \left\| \left(A ^ {\top} D A\right) ^ {- 1} \right\| _ {\infty} ^ {2} \left\| A ^ {\top} D A - A ^ {\top} D \hat {A} + A ^ {\top} D \hat {A} - \hat {A} ^ {\top} D \hat {A} \right\| _ {\infty} (82) \\ = \left\| \left(A ^ {\top} D A\right) ^ {- 1} \right\| _ {\infty} ^ {2} \left(\left\| A ^ {\top} D (A - \hat {A}) \right\| _ {\infty} + \left\| (A - \hat {A}) ^ {\top} D \hat {A} \right\| _ {\infty}\right) (83) \\ \leq \left\| (A ^ {\top} D A) ^ {- 1} \right\| _ {\infty} ^ {2} \left(\left\| A ^ {\top} D \right\| _ {\infty} \left\| A - \hat {A} \right\| _ {\infty} + \left\| (A - \hat {A}) ^ {\top} D \right\| _ {\infty} \left\| \hat {A} \right\| _ {\infty}\right) (84) \\ \leq \left\| \left(A ^ {\top} D A\right) ^ {- 1} \right\| _ {\infty} ^ {2} \left(\gamma \max _ {s, a} \left\| \mathcal {T} (\cdot \mid s, a) - \hat {\mathcal {T}} (\cdot \mid s, a) \right\| _ {1} + (1 + \gamma) \gamma \max _ {s, a} \left\| \mathcal {T} (\cdot \mid s, a) - \hat {\mathcal {T}} (\cdot \mid s, a) \right\| _ {1}\right) (85) \\ = \left\| \left(A ^ {\top} D A\right) ^ {- 1} \right\| _ {\infty} ^ {2} \left((2 + \gamma) \gamma \max _ {s, a} \left\| \mathcal {T} (\cdot | s, a) - \hat {\mathcal {T}} (\cdot | s, a) \right\| _ {1}\right) (86) \\ \end{array} +$$ + +where we have used the fact that $\left\| A - \hat{A}\right\|_{\infty} = \gamma \max_{s,a}\left\| T(\cdot \mid s,a) - \hat{\mathcal{T}} (\cdot \mid s,a)\right\|_{1}$ and that + +$$ +\left\| A \right\| _ {\infty} = \max _ {s, a} \sum_ {s ^ {\prime}} | \gamma \mathcal {T} \left(s ^ {\prime} \mid s, a\right) - \mathbf {1} \left(s ^ {\prime} = s\right) | \leq \max _ {s, a} \sum_ {s ^ {\prime} \neq s} | \gamma \mathcal {T} \left(s ^ {\prime} \mid s, a\right) | + 1 \leq 1 + \gamma \tag {87} +$$ + +Plugging these back into (72) gives + +$$ +\begin{array}{l} \left\| V ^ {*} - \hat {V} \right\| _ {\infty} \leq \left((1 - \gamma) + \left(1 + R _ {\max }\right)\right) (2 + \gamma) \gamma \left\| \left(A ^ {\top} D A\right) ^ {- 1} \right\| _ {\infty} ^ {2} \max _ {s, a} \left\| \mathcal {T} (\cdot | s, a) - \hat {\mathcal {T}} (\cdot | s, a) \right\| _ {1} \tag {88} \\ + (1 + R _ {\max }) \gamma \left\| (A ^ {\top} D A) ^ {- 1} \right\| _ {\infty} \max _ {s, a} \left\| \mathcal {T} (\cdot \mid s, a) - \hat {\mathcal {T}} (\cdot \mid s, a) \right\| _ {1} \\ \end{array} +$$ + +For any $\delta \in [0,1)$ , with probability $1 - \delta /2$ , we have + +$$ +\left. \max _ {s, a} \left\| \mathcal {T} (\cdot \mid s, a) - \hat {\mathcal {T}} (\cdot \mid s, a) \right\| _ {1} \leq \sqrt {\frac {2 S}{n} \ln \frac {4 S A}{\delta}} \right. \tag {89} +$$ + +Then, leveraging our assumption that + +$$ +\left\| \left(A ^ {\top} D A\right) ^ {- 1} \right\| _ {\infty} = \frac {1}{\inf _ {\| x \| = 1} \| \left(A ^ {\top} D A\right) x \| _ {\infty}} \leq \frac {1}{(1 - \gamma) ^ {2} D _ {\min }} \tag {90} +$$ + +we have, with probability $1 - \delta$ + +$$ +\begin{array}{l} \left\| V ^ {*} - \hat {V} \right\| _ {\infty} \leq \left(\frac {(2 + R _ {\max }) (2 + \gamma) \gamma}{(1 - \gamma) ^ {4} D _ {\min } ^ {2}} + \frac {(1 + R _ {\max }) \gamma}{(1 - \gamma) ^ {2} D _ {\min }}\right) \sqrt {\frac {2 S}{n} \ln \frac {4 S A}{\delta}} (91) \\ \leq \left(\frac {2 (2 + R _ {\max }) (2 + \gamma) \gamma}{(1 - \gamma) ^ {4} D _ {\min } ^ {2}}\right) \sqrt {\frac {2 S}{n} \ln \frac {4 S A}{\delta}} (92) \\ \end{array} +$$ + +![](images/edb8a99e6fc38de5e7fdbe09f35e3c3835311a9170c56a23712ede682bb06de0.jpg) + +# D.2. Gridworld Experiments + +In this subsection, we provide more experimental details and analysis of the tabular SMODICE experiments shown in Figure 1. + +To generate the offline dataset, a random policy (i.e., a policy that chooses each action with equal probabilities) is executed in the MDP for 10000 episodes. We use this dataset to compute the approximate MDP. Then, this MDP is used as an input to SMODICE (see Algorithm 2). The data collection procedure for the offline imitation learning from examples setting is identical. + +Offline IL from mismatched experts. In this task, we consider an expert agent that can move one grid cell diagonally in any direction, whereas the imitator is only able to move one grid cell horizontally or vertically. The expert policy is shown in black in Figure 2(a). Using purely an offline dataset collected by a random agent, we compute the closed-form tabular SMODICE solution (24) using Algorithm 2 and obtain the zig-zagging policy shown in blue. Indeed, this solution is one of the two correct solutions that minimize the state-occupancy divergence (the other one mirrors this path along the expert demo), while being feasible under the imitator dynamics. + +Offline IL from examples. We arbitrarily select a state to be the success state denoted by the green star in Figure 2(b). In this case, the expert's state occupancies is simply a one-hot vector with weight 1 at the success state. Then, we again use the tabular version of SMODICE to compute the policy whose state occupancies is as close to this one-hot vector as possible; the solution is illustrated in blue. As can be seen, this policy successfully reaches the goal. Furthermore, it is easy to see that in this task, a policy that minimizes state-occupancy divergence to the expert (i.e., the one-hot vector) is one that reaches the goal with the fewest steps. The policy learned by SMODICE is indeed among the set of optimal policies. + +Furthermore, we compute the state occupancies of all states in the gridworld. For the success state, $d(s) \approx 0.915$ , whereas the second largest state occupancy is 0.01. This validates the intuition that $\sum_{s \in S^*} d^\pi(s) \gg \sum_{s \notin S^*} d^\pi(s)$ . + +# E. SMODICE with Deep Neural Networks + +For high-dimensional MDP with continuous state and action spaces, we instantiate SMODICE using deep neural networks. In particular, we parameterize $V_{\theta}$ and $\pi_{\phi}$ using DNNs with weights $\theta$ and $\phi$ , respectively. + +Remark. We note that the sample-based estimation of Equation (21) (Line 9) is biased because $\mathcal{T}V$ is itself an expectation that is inside a (non-linear) convex function $f$ (Baird, 1995); however, as in several prior works (Nachum et al., 2019b; Nachum & Dai, 2020; Lee et al., 2021), we do not find this biased estimate to impact empirical performance and keep it for simplicity. + +# E.1. Hyperparameters and Architecture + +We use the same hyperparameters for all SMODICE experiments in this paper modulo the choice of $f$ -divergences (explained in the next section). In terms of architecture, we use a simple 2-layer ReLU network with hidden size 256 to parameterize + +the value network. For the policy network, we use the same architecture to parameterize a Gaussian output distribution; the mean and the log standard deviation are outputs of two separate heads. In addition, we use an tanh function on the Gaussian samples to enforce bounded actions, as in (Haarnoja et al., 2018). The discriminator uses the same architecture. Table 1 summarizes the hyperparameters as well as the architecture. + +Table 1. SMODICE Hyperparameters. + +
HyperparameterValue
SMODICE HyperparametersOptimizerAdam (Kingma & Ba, 2014)
Critic learning rate3e-4
Discriminator learning rate3e-4
Actor learning rate3e-5
Mini-batch size256
Discount factor0.99
Actor Mean Clipping(-7.24, 7.24)
Actor Log Std. Clipping(-5,2)
ArchitectureDiscriminator hidden dim256
Discriminator hidden layers2
Discriminator activation functionTanh
Critic hidden dim256
Critic hidden layers2
Critic activation functionReLU
Actor hidden dim256
Actor hidden layers2
Actor activation functionReLU
+ +# E.2. Choosing $f$ -Divergence in Practice + +In our experiments, SMODICE is implemented using $\chi^2$ -divergence for all tasks except Hopper, Walker2d, and HalfCheetah. Here, we show that a suitable choice of $f$ -divergence can be chosen offline by observing the initial direction of the SMODICE policy loss on the offline dataset. More specifically, on the environments in which SMODICE exhibited largest performance discrepancies between using KL-divergence or $\chi^2$ -divergence, we have found that SMODICE returns are negatively correlated with the policy loss. As shown in Figure 8, the poor performing variant of SMODICE always has a policy loss that initially jumps and vice-versa. This makes intuitive sense given the composition of the offline datasets, which is a mix of small amount of expert data with a large amount of poor quality data (see Appendix G for more details). When SMODICE fails to pick out the expert data, which is often narrowly distributed, then it must have assigned relatively higher importance weights to the lower quality data, which is more diverse. This creates a more difficult supervised learning task, leading to higher training loss for the policy. Therefore, in practice, we recommend monitoring SMODICE's initial policy loss direction to determine whether the current $f$ -divergence will lead to good performance and make changes accordingly. + +# F. Baselines + +TD3-BC. Many of our baselines are implemented using TD3-BC as their offline policy optimizer. We use the default hyperparameters for TD3-BC provided by Fujimoto & Gu (2021), shown in Table 2. + +Implementation Details. We use the official PyTorch implementation of TD3-BC, publicly available at https: //github.com/sfujim/TD3_BC. For DEMODICE, because the code is not public available, we implement it using PyTorch, adapting from https://github.com/security/optidice; we use the hyperparameters reported in the paper. Note that DEMODICE shares many architectures with SMODICE. For example, DEMODICE uses a state-action discriminator, and we implement it by simply changing the input space of the state-based discriminator used in our SMODICE implementation. For SAIL, we use the official PyTorch implementation (https://github.com/FangchenLiu/SAIL) and combine it with TD3-BC. We implement RCE using PyTorch, adapting from the official TensorFlow implementation https://github.com/google-research/google-research/tree/master/rce. + +![](images/7aa66b6ee9315f6b87ac204d80c732960083125e385ba18c22ce4d2c9db03283.jpg) +Figure 8. SMODICE returns are negatively correlated with the direction of its policy losses. + +# G. Offline IL from Observations Experimental Details + +# G.1. Datasets + +For Hopper, Walker2d, HalfCheetah, Ant, and AntMaze, we construct the offline datasets by combining a small amount of expert data and a large amount of low quality random data. For the first four tasks, we leverage the respective "expert-v2" and "random-v2" datasets in the D4RL benchmark. For AntMaze, we use trajectories from "antmaze-umaze-v2" as the expert data; for the random data, we simulate the antmaze environment for 1M steps using random actions and take the resulting transitions. For the kitchen environment, we use the full "kitchen-mixed-v0" dataset as the offline dataset without further augmentation. See Table 3 for dataset breakdown. + +# G.2. Additional Results + +In this section, we present some additional results as well as ablation experiments. + +Diverse AntMaze. In Section 6.1, we have found that two of the baselines (SAIL-TD3-BC and ORIL) outperform SMODICE on the AntMaze benchmark. To investigate their sources of empirical gain, we have designed a diverse version of the AntMaze dataset to test how different approaches are robust to the dataset composition on the same task. To this end, we take the AntMaze offline dataset (explained above) and reverse half of the trajectories in their directions. In other words, these reversed trajectories would navigate from the original goal to the initial state. This procedure is easy to do because the U-shaped maze is symmetric. Then, using this dataset, we have trained all approaches in Section 6.1 again. As shown in Figure 10(a), on this dataset, both SAIL-TD3-BC and ORIL quickly collapse, indicating that these methods are very brittle to the dataset composition. In contrast, SMODICE remains the best performing algorithm, despite overall drop in all methods' performances. + +SMODICE with Zero Reward. We compare SMODICE with SMODICE-Zero, which simply assigns every transition zero reward (i.e., $R(s) = 0$ ) regardless of its similarity to an expert state. Then, we compare the ratio of the importance weights (i.e., $\xi(s, a)$ ) assigned to the offline expert data and the offline random data by the two SMODICE methods, respectively. As shown in Figure 9, SMODICE assigns much higher relative weights to the expert data and consequently significantly outperforms SMODICE-Zero. These results demonstrate that SMODICE's empirical performance comes from its superior ability to discriminate the offline expert data, which is a by-product of its optimization procedure. + +Table 2. TD3+BC Hyperparameters. This table is reproduced from Fujimoto & Gu (2021) directly. + +
HyperparameterValue
TD3 HyperparametersOptimizerAdam (Kingma & Ba, 2014)
Critic learning rate3e-4
Actor learning rate3e-4
Mini-batch size256
Discount factor0.99
Target update rate5e-3
Policy noise0.2
Policy noise clipping(-0.5, 0.5)
Policy update frequency2
ArchitectureCritic hidden dim256
Critic hidden layers2
Critic activation functionReLU
Actor hidden dim256
Actor hidden layers2
Actor activation functionReLU
TD3+BC Hyperparametersα2.5
+ +Table 3. Offline Dataset Compositions. + +
TaskState DimExpert DatasetExpert Data SizeRandom Data Size
Hopper11hopper-expert-v2193430999999
Walker2d17walker2d-expert-v299900999999
HalfCheetah17halfcheetah-expert-v2199800999000
Ant27ant-expert-v2192409999427
AntMaze29antmaze-umaze-v2349687999000
Kitchen60kitchen-mixed-v01369370
+ +# DEMODICE with State-Based Discriminator. + +We replace DEMODICE's state-action based discriminator with a state-based one to make it compatible with the problem settings we consider in this paper. We compare this version of DEMODICE (DEMODICE+SD) to SMODICE in Table 4, showing performance at convergence. SMODICE significantly outperforms DEMODICE+SD, which suffers from training instability due to optimizing the KL conjugate. Thus, naively adapting DEMODICE to state matching is insufficient; our generalized $f$ -divergence based algorithm is crucial for enabling learning from challenging expert observations (e.g., mismatched dynamics or examples). + +Table 4. SMODICE vs. DEMODICE with State-Discriminator + +
AlgorithmAntMaze-PointMassAntMaze-ExamplePointMass-4DKettleMicrowave
DEMODICE+SD19.832.70.00.00.1
SMODICE34.347.380.0100.060.3
+ +# H. Offline IL from mismatched Expert Experimental Details + +# H.1. Continuous Control Experiments + +Mismatched Experts. The mismatched experts are illustrated in Figure 11. + +Comparison between PointMass and Ant experts for AntMaze. The trajectories of PointMass and Ant experts are illustrated in Figure 12. As can be seen, the PointMass trajectory is more regular and smooth due to its simpler dynamics and the use of a waypoint controller. In contrast, the ant trajectory is much less well-behaved because solving the maze task using the Ant agent is intrinsically a difficult task; consequently, it is difficult to provide an Ant demonstration. This example serves as a strong motivating problem for offline imitation learning with mismatched experts. + +![](images/f62beab8fa9711878cbaa2a46131974c96a6c1999119058ca4d4fafd5f2e6f41.jpg) + +![](images/19360480fb38134e79ace56df2258ff3ef6528ff1e7048dc80544b487bc11460.jpg) + +![](images/1ec6cfc3a2c6c2eda61aca478e91c0cb90a3f4e1248b6f674eb5a11d112e2622.jpg) + +![](images/c389597cc3601fb170305f41cfe06c244ea1f63d1c2eef521be6b8a505830c33.jpg) + +![](images/20466f2518b3512a7d6c207f6c79ca596a7983bbdb8d7741a9668864f31387bb.jpg) +Figure 9. SMODICE vs. SMODICE-Zero. Using the discriminator-based reward, SMODICE assigns much higher weights to expert-quality data. + +![](images/3cba3a55c02232fb0ca226cfc6fef69376f7fff518fcca31c5a5134615bf4bf1.jpg) + +![](images/7cf9268939276f17989fb043baed255daf0705c42f0a1290bc04b38db15d0e96.jpg) + +![](images/ca4bc0117ebc2df576855c5114d109a21b5c1b42417c300e689fe7de10c06777.jpg) + +![](images/8e9f19672a63d90d811824e31e13ce551526d65fb4a03172661f129df4238dee.jpg) +Figure 10. Offline imitation learning results on AntMaze-Reverse. SMODICE is still among the best performing methods, while both SAIL-TD3-BC and ORIL collapse, demonstrating their sensitivity to the offline dataset composition. + +# H.2. Quantitative Analysis of Figure 5 + +We quantitatively measure the percentage drop-in-performance for each method in Figure 5, computed as $\frac{\text{max-original} - \text{max_mismatched}}{\text{max-original}}$ . Note that this metric favors the baselines as taking the maximum value advantages methods that are more unstable. Nevertheless, as shown in Table 5, SMODICE is still by far the most robust method overall and in each individual task. As expected, ORIL does the worst as it is not designed to handle mismatched dynamics; this shows that using a state-based discriminator in itself is not sufficient. + +# I. Offline IL from Examples Experimental Details + +# I.1. Datasets + +We collect 300 success-state examples for each of the tasks. The examples are randomly sampled from the subset of the offline dataset that achieves the task. Task success is verified through a pre-defined sparse reward function (e.g., distance threshold function). + +![](images/3bf0f5b238d0de038450accd17ae2b34b47790311c476f6f4e1fece86fd86191.jpg) +(a) HalfCheetah-Short + +![](images/c0210aa7ebb02496e4d9a049dc62df901d88c167217a075fa940fe4207e828b5.jpg) +(b) Ant-Disabled + +![](images/9f17cc5930e744b4493bd878b63fda25155528ed80174f6df4909a4de4fc6005.jpg) +(c) PointMass-Maze + +![](images/d8ef19cd947ba07498d4f4b921445705ad176dea689d62895e528c7eee7f34fe.jpg) +Figure 11. Illustrations of the mismatched experts. +(a) PointMass Expert +Figure 12. Trajectory visualizations of AntMaze experts. + +![](images/f8e3fa2bb73bfbe36106424423fb063f125bf5b61e79418a460f73918cb3a7d0.jpg) +(b) Ant Expert + +# I.2. Environments. + +PointMass-4Direction. This environment is adapted from the "maze2d-umaze-v0" environment in D4RL by changing the map configuration. The environment termination condition is triggered when the agent successfully comes within a small radius of the specified goal. + +AntMaze-Example. This environment is identical to the environments used in previous two settings. + +Kettle and Microwave. These environments are adapted from the "kitchen-mixed-v0" environment in D4RL. The environments are identical as the original except the termination conditions. Both of these tasks terminate when the Franka robot places the specified object within a small radius of the desired configuration. + +# I.3. Examples of Success States + +All success states are extracted from the offline dataset used for policy training. We illustrate one representative example from each task in Figure 13. + +Table 5. Relative performance drop with mismatched experts. + +
AlgorithmHalfCheetahAntAntMazeAverage
SMODICE70.7%3.3%29.7%34.5%
SAIL-TD3-BC88.9%6.8%50.6%48.8%
ORIL91.8%42.2%72.7%68.9%
+ +![](images/0c38c749244cafedc55183912e468c86b5c4ed3954eab1134edba28b4625ceee.jpg) +(a) PointMass-4Direction + +![](images/ce16a2bce1768d3d31c0318aa228cfc2adc0829f9dff9f0667465dfbb2dfc1e9.jpg) +(b) AntMaze + +![](images/4a0dbfd42ba30560acdfde34a5f34d8cfd4a2ea6670c68f9208209578a46b911.jpg) +(c) Kettle + +![](images/ee4a1d26df2b83269f3534ba3ae7ad414e5f3874c5791c62e7b2c4908711e40c.jpg) +(d) Microwave +Figure 13. Illustrations of success examples. + +Algorithm 2 SMODICE with $\chi^2$ -divergence for Tabular MDPs +```python +d_E: the expert state occupancies, |S| +# mdp: the empirical MDP learned using offline data +# pi_b: the behavior policy, |S||A| +def SMODICE(mdp, d_E, pi_b): + d_O(sa = compute_policy_occupancies(mdp, pi_b) # |S||A| + d_O = d_O(sa.reshape(mdp.S, mdp.A).sum(axis=1) # |S|) + # compute reward function + R = np.log(d_E/d_O) # |S| + # define and reshape matrices + T = mdp.T.reshape(mdp.S * mdp.A, mdp.S) # |S||A| x |S| + B = np-repeat(np.eye(mdp.S), mdp.A, axis=0) # |S||A| x |S| + I = np.ones(mdp.S * mdp.A) # |S||A| + D = np.diag(d_O(sa) # |S||A| x |S||A| + # compute optimal V + H = (mdp.gamma * P - B).T @ D @ (mdp.gamma * T - B) # |S| x |S| + y = -((1 - mdp.gamma) * p0 + (mdp.gamma * P - B).T @ D @ (I + B @ R)) # |S| + V_star = np.linalg.pinv(H) @ y # |S| + # compute optimal occupancy ratios + xi_star = B @ R + (mdp.gamma * P - B) @ V_star + 1 # |S||A| + m = np.array(xi_star >= 0, dtype=np.float) + xi_star = xi_star * m + # weighted BC + pi_star = (xi_star * d_O).reshape(mdp.S, mdp.A) # |S||A| + pi_star /= np.sum(pi_star, axis=1, keepdims=True) + f_divergence = d.dot(0.5 * (w_star ** 2)) + return pi_star, f_divergence, V_star +``` + +# Algorithm 3 SMODICE for Continuous MDPs + +1: Require: Expert demonstration(s) $\mathcal{D}^E$ , offline dataset $\mathcal{D}^O$ , choice of $f$ -divergence $f$ +2: Randomly initialize discriminator $c_{\psi}$ , value function $V_{\theta}$ , and policy $\pi_{\phi}$ . +3: // Train Expert (resp. Example) Discriminator +4: Train $c_{\psi}$ using $\mathcal{D}^E$ and $\mathcal{D}^O$ using Equation (14) +5: // Train Lagrangian Value Function +6: for number of iterations do +7: Sample minibatch of offline data $\{s_t^i, a_t^i, s_{t+1}^i\}_{i=1}^N \sim \mathcal{D}^O$ , $\{s_0^i\}_{i=1}^M \sim \mathcal{D}^O(\mu_0)$ +8: Obtain reward: $R_{i} = c_{\theta}(s_{t}^{i}), i = 1, \dots, N$ +9: Compute value objective $\mathcal{L}(\theta)\coloneqq (1 - \gamma)\frac{1}{M}\sum_{i = 1}^{M}V_{\theta}(s_0^i) + \frac{1}{N} f_\star \left(R^i +\gamma V(s_{t + 1}^i) - V(s_t^i)\right)$ +10: Update $V_{\theta}$ using SGD: $V_{\theta} \gets V_{\theta} - \eta_V \nabla \mathcal{L}(\theta)$ +11: end for +12: // Policy Learning +13: for number of iterations do +14: Sample minibatch of offline data $\{s_t^i,a_t^i,s_{t + 1}^i\}_{i = 1}^N\sim \mathcal{D}^O$ +15: // Compute Optimal Importance Weights +16: Compute $\xi^{*}(s^{i},a^{i}) = f_{\star}^{\prime}\left(R(s^{i}) + \gamma V(s_{t + 1}^{i}) - V(s_{t}^{i})\right),i = 1,\dots,N$ +17: // Weighted Behavior Cloning +18: Update $\pi_{\psi}$ using Equation (23) +19: end for \ No newline at end of file diff --git a/versatileofflineimitationfromobservationsandexamplesviaregularizedstateoccupancymatching/images.zip b/versatileofflineimitationfromobservationsandexamplesviaregularizedstateoccupancymatching/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..20676553813ddb18b61abda2e97ce1d8fc35ea56 --- /dev/null +++ b/versatileofflineimitationfromobservationsandexamplesviaregularizedstateoccupancymatching/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:10054cf3a550c1ec936cace249dce5b2406abe7fe6baa1bbe6ef37b37b2a5c39 +size 1816102 diff --git a/versatileofflineimitationfromobservationsandexamplesviaregularizedstateoccupancymatching/layout.json b/versatileofflineimitationfromobservationsandexamplesviaregularizedstateoccupancymatching/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..89cc5add45132642e5bdc28c9174cb83d30a40f7 --- /dev/null +++ b/versatileofflineimitationfromobservationsandexamplesviaregularizedstateoccupancymatching/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:520819742d6624598bc837cd3367a7207b913f7863b3bb3cd4cedb8f72cc7262 +size 916695 diff --git a/virtualhomogeneitylearningdefendingagainstdataheterogeneityinfederatedlearning/c06f7e0d-ff3f-43fc-9f72-570e35137ed5_content_list.json b/virtualhomogeneitylearningdefendingagainstdataheterogeneityinfederatedlearning/c06f7e0d-ff3f-43fc-9f72-570e35137ed5_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..e2c2b7b693fc64cb87a9b96f98d54c8f86e7312a --- /dev/null +++ b/virtualhomogeneitylearningdefendingagainstdataheterogeneityinfederatedlearning/c06f7e0d-ff3f-43fc-9f72-570e35137ed5_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd5fe2b254557ce299a80e438f0c0f02fd7b0e526c890a37db76838757a62db1 +size 161325 diff --git a/virtualhomogeneitylearningdefendingagainstdataheterogeneityinfederatedlearning/c06f7e0d-ff3f-43fc-9f72-570e35137ed5_model.json b/virtualhomogeneitylearningdefendingagainstdataheterogeneityinfederatedlearning/c06f7e0d-ff3f-43fc-9f72-570e35137ed5_model.json new file mode 100644 index 0000000000000000000000000000000000000000..31fd89710bc6201d46fe533142ebfc58cec31e4a --- /dev/null +++ b/virtualhomogeneitylearningdefendingagainstdataheterogeneityinfederatedlearning/c06f7e0d-ff3f-43fc-9f72-570e35137ed5_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:184a97e92a9a1699a9f7f0e0c864806b55f78b9b2e29b4e7805449091f1eff0c +size 200570 diff --git a/virtualhomogeneitylearningdefendingagainstdataheterogeneityinfederatedlearning/c06f7e0d-ff3f-43fc-9f72-570e35137ed5_origin.pdf b/virtualhomogeneitylearningdefendingagainstdataheterogeneityinfederatedlearning/c06f7e0d-ff3f-43fc-9f72-570e35137ed5_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..494549e327507dcb9ad76be8c5283ed7c2bf384f --- /dev/null +++ b/virtualhomogeneitylearningdefendingagainstdataheterogeneityinfederatedlearning/c06f7e0d-ff3f-43fc-9f72-570e35137ed5_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9c359ae638b920bda7fdfc9a4db895664f6631c29988f4e769691f9587274dac +size 5828336 diff --git a/virtualhomogeneitylearningdefendingagainstdataheterogeneityinfederatedlearning/full.md b/virtualhomogeneitylearningdefendingagainstdataheterogeneityinfederatedlearning/full.md new file mode 100644 index 0000000000000000000000000000000000000000..9ed6ee8533bc9baf45211f6e7a254a7fc650e1af --- /dev/null +++ b/virtualhomogeneitylearningdefendingagainstdataheterogeneityinfederatedlearning/full.md @@ -0,0 +1,742 @@ +# Virtual Homogeneity Learning: Defending against Data Heterogeneity in Federated Learning + +Zhenheng Tang $^{*1}$ Yonggang Zhang $^{*1}$ Shaohuai Shi $^{2}$ Xin He $^{1}$ Bo Han $^{1}$ Xiaowen Chu $^{3,2,1}$ + +# Abstract + +In federated learning (FL), model performance typically suffers from client drift induced by data heterogeneity, and mainstream works focus on correcting client drift. We propose a different approach named virtual homogeneity learning (VHL) to directly "rectify" the data heterogeneity. In particular, VHL conducts FL with a virtual homogeneous dataset crafted to satisfy two conditions: containing no private information and being separable. The virtual dataset can be generated from pure noise shared across clients, aiming to calibrate the features from the heterogeneous clients. Theoretically, we prove that VHL can achieve provable generalization performance on the natural distribution. Empirically, we demonstrate that VHL endows FL with drastically improved convergence speed and generalization performance. VHL is the first attempt towards using a virtual dataset to address data heterogeneity, offering new and effective means to FL. + +# 1. Introduction + +Federated learning (FL) (McMahan et al., 2017) has emerged as an important paradigm that enables decentralized data collection and model training. In the FL scenario, a large number of clients collaboratively train a shared model without sharing their natural (or private) data (Kairouz et al., 2021), enabling various real-world applications (Yang et al., 2018; Hsu et al., 2020; Luo et al., 2019). However, FL faces heterogeneity challenges caused by Non-IID data distributions from different clients as well as their diversity of computing and communication capabilities (Li et al., 2020a; + +$^{*}$ Equal contribution $^{1}$ Department of Computer Science, Hong Kong Baptist University $^{2}$ Department of Computer Science and Engineering, The Hong Kong University of Science and Technology $^{3}$ Data Science and Analytics Thrust, The Hong Kong University of Science and Technology (Guangzhou). Correspondence to: Xiaowen Chu . + +Proceedings of the $39^{th}$ International Conference on Machine Learning, Baltimore, Maryland, USA, PMLR 162, 2022. Copyright 2022 by the author(s). + +Zhao et al., 2018; Hsu et al., 2020). Severe heterogeneity can easily cause client drift (Karimireddy et al., 2020), leading to unstable convergence (Li et al., 2020b) and poor model performance (Wang et al., 2020; Zhao et al., 2018). + +To tackle federated heterogeneity, the first FL algorithm, FedAvg (McMahan et al., 2017), proposes to conduct more local computations and fewer communications during training. Though FedAvg addresses the diversity of computing and communication, the client drift induced by the Non-IID data distribution (data heterogeneity) has significant negative impact on FedAvg (Li et al., 2020a; Karimireddy et al., 2020; Li et al., 2020b; Wang et al., 2020; Luo et al., 2021). To address client drift, many efforts have been devoted to designing new learning paradigms, either on the client side, e.g., local training strategy (Li et al., 2020a; Karimireddy et al., 2020), or on the server side, e.g., model aggregation strategy (Yurochkin et al., 2019; Chen & Chao, 2020). However, a recent benchmark work (Li et al., 2021a) shows that FedAvg can outperform its variants in many experimental settings. This reveals that it is challenging for a single method to address the client drift problem in multiple scenarios, reflecting the notoriety and subtlety of client drift. Therefore, addressing client drift remains a fundamental challenge of FL (Kairouz et al., 2021). + +Another exciting direction is to directly "rectify" the cause of client drift, i.e., data heterogeneity. Specifically, sharing a small portion of private data (Zhao et al., 2018) or the private statistical information (Shin et al., 2020; Yoon et al., 2021) can make data located in different clients more homogeneous. Nonetheless, the data sharing approach exposes FL to the danger of privacy leakage. Although differential privacy is a competitive candidate for avoiding privacy leakage, employing differential privacy can cause performance degradation (Tramer & Boneh, 2021). All these challenges motivate the following fundamental question: + +Is it possible to defend against data heterogeneity in FL systems by sharing data containing no private information? + +In this work, we provide an affirmative answer to the question by proposing a novel approach, called virtual homogeneity learning (VHL). The key insight of VHL is that introducing more homogeneous data shared across clients can + +reduce the data heterogeneity (Jeong et al., 2018). Specifically, VHL constructs a new rectified dataset for each client by sharing a virtual homogeneous dataset among all clients, which is independent of the natural datasets. + +The key challenge of VHL is how to generate the virtual dataset to benefit model performance. Intuitively, combining an out-of-distribution dataset with the original data may sacrifice the generalization performance in different aspects such as distribution shift (Pan & Yang, 2009; Ben-David et al., 2010), noisy labels (Frenay & Verleysen, 2013), and garbage data (Polyzotis et al., 2017). In practice, it is challenging to sample data from the natural distribution for constructing a virtual dataset. Hence, introducing much virtual data drawn from a different distribution will cause the training distribution different from the test distribution, i.e., distribution shift, leading to poor generalization performance on the test set (Pan & Yang, 2009; Ben-David et al., 2010). Thus, the distribution shift is one crucial detrimental impact of introducing virtual datasets. + +Fortunately, we can access both the labeled virtual dataset, i.e., source domain, and the labeled natural dataset, i.e., target domain, so that we can mitigate the distribution shift through the lens of domain adaptation (DA) (Pan & Yang, 2009; Ben-David et al., 2007; Ganin et al., 2016). In particular, we propose matching the conditional distribution of the source and target domains. Our theoretical analysis shows that matching the virtual and natural distributions conditioned on label information can achieve provable generalization performance. Moreover, this can be instantiated by pulling natural and virtual data features from the same class together, as depicted in Figure 1. To show the efficacy of VHL, we apply VHL in several popular FL algorithms including FedAvg, FedProx, SCAFFOLD, and FedNova on four datasets. Our experimental results show that VHL can boost the generalization ability and the convergence speed. + +Our main contributions include: + +1. We raise a fundamental question to explore how to reduce data heterogeneity in FL by sharing data that contains no private information. +2. To answer the question, we propose virtual homogeneity learning (VHL), making the first attempt to use virtual datasets to defend against data heterogeneity. To avoid the distribution shift induced by virtual datasets, VHL calibrates natural data features with that of virtual data, inspired by the rationale of domain adaptation. +3. Through comprehensive experiments1, we demonstrate that VHL can drastically benefit the convergence speed and the generalization performance of FL models. + +![](images/c2b356fbd185a9a40db044c9fd5e88b517e62165efcece532c27a70933d0b916.jpg) +Before Calibration + +![](images/088c74923886199577bf1c6ed7ec17e1f6a2dea9e58bd6dc039de106a2e46b07.jpg) +After Calibration + +![](images/fe595590aa10ee092982120eec49df57476043a34dd3165bbb49e9f0e295783e.jpg) +Figure 1. Feature distribution of different clients. Circle and triangle points represent data on client A and B, respectively. Points surrounded by a dotted circle represent the virtual data. Different colors represent data of different labels. After local training (left), the features of private natural data of the same label on different clients are far away from others, but features of shared virtual data of the same label are close to others. Figure 2 in section 5 shows the experimental observation of this Figure. + +# 2. Preliminaries + +# 2.1. Federated Learning + +Federated learning aims to collaboratively train a global model parameterized by $w$ while omitting the need to access private data distributed over many clients (McMahan et al., 2017; Kairouz et al., 2021). Formally, FL aims to minimize a global objective function $J(w)$ : + +$$ +\min _ {w} J (w) \triangleq \sum_ {k = 1} ^ {K} p _ {k} J _ {k} (w), \tag {1} +$$ + +where $K$ stands for the total number of clients, $p_k \geq 0$ is the weight of the $k$ -th client such that $\sum_{k=1}^{K} p_k = 1$ , and $J_k(w)$ is the local objective defined as: + +$$ +J _ {k} (w) \triangleq \mathbb {E} _ {(x, y) \sim \mathcal {P} _ {k} (x, y)} \ell (f (x; w), y). \tag {2} +$$ + +Here, we denote $\mathcal{P}_k(x,y)$ as the joint distribution of data in client $k$ , $\ell(\cdot,\cdot)$ as the loss function, e.g., cross-entropy loss, and $f = \phi \circ \rho$ as the prediction with $\phi$ being the feature extractor as well as $\rho$ the predictor, e.g., classifier for classification tasks. + +A common optimization strategy proceeds through the communication between clients and the server round-by-round. In particular, the central server broadcasts the model $w^r$ to all selected clients $S^r$ at round $r$ and then each client performs $E$ ( $E \geq 1$ ) local updates, e.g., for the $k$ -th client: + +$$ +w _ {k, j + 1} ^ {r} \gets w _ {k, j} ^ {r} - \eta_ {k, j} \nabla J _ {k} (w _ {k, j} ^ {r}), j = 0, 1, \dots , E - 1, +$$ + +where $w_{k,j}^{r}$ represents the $j$ -th updates, i.e., $w_{k,0}^{r} = w^{r}$ , and $\eta_{k,j}$ is the learning rate. In the end of round $r$ , all selected clients send the optimized parameter back to the server, and the central server performs a certain aggregation operation: + +$$ +w ^ {r + 1} \leftarrow \operatorname {A G G R E G A T E} \left(\cup_ {k \in \mathcal {S} ^ {r}} w _ {k, E - 1} ^ {r}\right), \tag {3} +$$ + +where the AGGREGATE operation is typically instantiated in a simple yet effective averaging manner (McMahan et al., 2017): + +$$ +w ^ {r + 1} \gets \sum_ {k \in \mathcal {S} ^ {r}} p _ {k} w _ {k, E - 1} ^ {r}, p _ {k} = \frac {n _ {k}}{\sum_ {i \in \mathcal {S} ^ {r}} n _ {i}}, +$$ + +with $n_k$ being the number of samples on the $k$ -th client. + +# 2.2. Domain Adaptation + +Domain adaptation approaches aim to solve the problem where the training and test data are drawn from different distributions (Pan & Yang, 2009). To perform domain adaptation, three assumptions are imposed on how distributions change across domains, i.e., distribution shifts stem from: $\mathcal{P}(x)$ , i.e., covariate shift (Ben-David et al., 2010; Pan et al., 2010), $\mathcal{P}(y|x)$ , i.e., conditional shift (Zhang et al., 2013; Gong et al., 2016), or both, i.e., dataset shift (Quinonero-Candela et al., 2008; Long et al., 2013). + +One widely adopted strategy is to minimize the distribution discrepancy between the source distribution $\mathcal{P}_S$ and the target distribution $\mathcal{P}_T$ by finding a feature extractor $\phi$ , such that the source and target domains have similar distributions in the learned feature space (Ganin et al., 2016; Zhao et al., 2019; Long et al., 2017). For the covariate shift assumption, the marginal distribution discrepancy is minimized for reducing generalization risk on the target domain (Ganin et al., 2016): + +$$ +d \left(\mathcal {P} _ {S} (\phi (x)), \mathcal {P} _ {T} (\phi (x))\right), +$$ + +where $d$ is a measure of distribution discrepancy. For the conditional shift assumption, the distribution discrepancy is usually conditioned on the label (Gong et al., 2016): + +$$ +d \left(\mathcal {P} _ {S} (\phi (x) | y), \mathcal {P} _ {T} (\phi (x) | y)\right), +$$ + +where $y$ denotes the label. For the most challenging dataset shift, the joint distribution discrepancy is usually employed: + +$$ +d \left(\mathcal {P} _ {S} (\phi (x), y), \mathcal {P} _ {T} (\phi (x), y)\right). +$$ + +In this paper, we regard the virtual distribution as the source domain and the natural distribution as the target domain. + +# 3. Virtual Homogeneity Learning + +This section gives a detailed description of how virtual heterogeneity learning (VHL) promotes federated learning (FL) by mitigating data heterogeneity with a virtual dataset. + +# 3.1. Heterogeneity Mitigation + +Clients in FL systems usually collect data independently, where the data distribution can vary with clients (Kairouz + +et al., 2021). Hence, data heterogeneity stems from the discrepancy in the data held by the clients. A straightforward solution to mitigate data heterogeneity is to send an extra common dataset to each client and minimize the local objective with both the local data and the shared data. + +Unfortunately, the underlying assumption of data sharing is that these extra data are drwan from the natural distribution, because using arbitrary noisy or garbage data to train models produces poor generalization performance (Frenay & Verleysen, 2013; Polyzotis et al., 2017). However, it is not realistic due to the privacy concern. That is, collecting and sharing data from the natural distribution are challenging and will expose FL to the danger of privacy leakage. + +To address the challenge, we propose introducing a virtual dataset to reduce data heterogeneity such that the shared virtual data contains no private information and avoids the performance degradation of FL models on the natural dataset. Specifically, we first introduce a dataset collected independently of the natural data to bypass the private information concerns. Then, we expect that models learned from the virtual dataset can perform well on the natural distribution. + +# 3.2. Feature Calibration + +The key to promoting FL with a virtual dataset is calibrating the natural feature distribution and the virtual feature distribution. It is effortless to collect data independent of the natural data. For example, the virtual dataset can be generated from pure noise, e.g., Gaussian noise and structural noise drawn from untrained style-GAN (Karras et al., 2019). Thus, the critical challenge is how to ensure that the knowledge learned from the virtual dataset can be transferred to the natural dataset. Drawing inspiration from domain adaptation, we consider the virtual dataset as the source domain and the natural dataset as the target domain and perform domain adaptation to reduce the generalization risk of natural distribution. Built upon the rationale of domain adaptation, we thus propose calibrating these two distributions in the feature space. + +The virtual data are crafted independent of the natural data, leading to dataset shift (Quinonero-Candela et al., 2008; Long et al., 2013) rather than covariate shift (Ben-David et al., 2010) or conditional shift (Zhang et al., 2013). Note that, the virtual data (domain) is different from the heterogeneous domain studied in (Liu et al., 2020), because the virtual dataset is arbitrarily constructed, e.g., pure noise. To tackle the challenging dataset shift, advanced methods (Long et al., 2013; 2017; Lei et al., 2021) follow the rational of domain adaptation to match the joint distribution. Inspired by these approaches, we propose matching the virtual and natural distributions conditioned on the label information to mitigate the adverse impact induced by distribution shift. Thanks to the flexibility of constructing virtual + +dataset, we can collect virtual data such that the virtual and natural distribution have the same label distributions. Consequently, the joint distribution discrepancy minimization is reduced to the problem of conditional distribution minimization. Specifically, we introduce a conditional distribution mismatch penalty to alleviating the dataset shift: + +$$ +\begin{array}{l} \mathbb {E} _ {(x, y) \sim \mathcal {P} _ {k}} \ell (\rho \circ \phi (x), y) + \mathbb {E} _ {(x, y) \sim \mathcal {P} _ {v}} \ell (\rho \circ \phi (x), y) \\ + \lambda \mathbb {E} _ {y} d \left(\mathcal {P} _ {k} (\phi (x) | y), \mathcal {P} _ {v} (\phi (x) | y)\right), \tag {4} \\ \end{array} +$$ + +where $\mathcal{P}_v$ denotes the virtual distribution, e.g., a Gaussian distribution, $\rho \circ \phi = f$ stands for the local model, $\mathcal{P}_k(\phi(x)|y)$ is the feature distribution obtained by applying the feature extractor $\phi$ to a random variable $x \sim \mathcal{P}_k(x|y)$ given label $y$ , and $\lambda$ is a hyperparameter. Similarly, $\mathcal{P}_v(\phi(x)|y)$ is the feature distribution obtained on $x \sim \mathcal{P}_v(x|y)$ . The penalty $d(\mathcal{P}_k(\phi(x)|y), \mathcal{P}_v(\phi(x)|y))$ encourages the feature extractor to make the data sampled from different distributions, i.e., $\mathcal{P}_k$ and $\mathcal{P}_v$ , having the same conditional feature distribution. + +# 3.3. Analysis + +The insight of VHL is depicted in Figure 1. After local training of each round, the features of natural data in each category on different clients are far away from others, but the features of virtual data in each category are relatively close to others. Thus, pulling the natural feature towards the virtual feature with the same label can contribute to local models having similar features for each category, which is consistent with our empirical observation shown in Figure 2. + +To provide a theoretical justification on the effectiveness of the proposed local objective function with distribution mismatch penalty, we analyze the relationship between the generalization performance and the misalignment between domains theoretically for classification tasks. To the best of our knowledge, we are the first to study the relationship for classification tasks. For example, the theoretical conclusions derived in (Lei et al., 2021) are mainly focused on regression problems and only empirical supports are given in (Long et al., 2013; 2017). + +In light of the margin theory (Koltchinskii & Panchenko, 2002) that maximizing the margin between data points and the decision boundary achieves strong generalization performance, we first introduce the definition of statistical margin to measure the generalization performance before stating the main theorem. + +Definition 3.1. (Statistical margin.) We define statistical margin for a classifier $f$ on a distribution $\mathcal{P}$ with a distance metric $m$ : $SM_{m}(f,\mathcal{P}) = \mathbb{E}_{(x,y)\sim \mathcal{P}}\inf_{f(x^{\prime})\neq y}m(x^{\prime},x)$ . + +The defined statistical margin quantifies the degree of generalization performance. Hence, we can use it to quantify models' generalization performance on the target distribution, where the models are learned from the virtual dataset. In particular, the problem of achieving strong generalization performance is rephrased to maximizing the statistical margin: + +$$ +\mathbb {E} _ {f := V H L \left(\mathcal {P} _ {v} (x, y)\right)} S M _ {m} (f, \mathcal {P} (x, y)), \tag {5} +$$ + +where $f \coloneqq VHL(\mathcal{P}_v(x,y))$ means that the model $f$ is learned on the distribution $\mathcal{P}_v(x,y)$ using Eq. 4, $SM_{m}(f,\mathcal{P}(x,y))$ represents that the generalization performance of $f$ is evaluated on the distribution $\mathcal{P}(x,y)$ . + +Built upon Definition 3.1 and Eq. 5, we are ready to state the following theorem (proof can be found in Appendix A). + +Theorem 3.2. Let $f = \phi \circ \rho$ be a neural network decompose of a feature extractor $\phi$ and a classifier $\rho$ , $\mathcal{P}(x,y)$ and $\mathcal{P}_v(x,y)$ are two separable distributions with identical label distributions. Then, learning $f$ with the proposed distribution mismatch penalty, i.e., Eq. 4 elicits an model with bounded statistical margin, i.e., Definition 3.1. + +Remark 3.3. Theorem 3.2 shows that models learned with Eq. 4 can bound the statistical margin, learning to provable generalization performance. Moreover, larger statistical margin of the virtual distribution $\mathcal{P}_v$ will further provide a tighter bound of the statistical margin of the natural distribution, according to the proof of Theorem 3.2 (details can be found in Appendix A). + +Theorem 3.2 matches the underlying insights of previous effective methods (Long et al., 2013; 2017) that aligning the joint distribution between the source and target domains can guarantee the generalization performance on target domains. + +# 3.4. Overview + +To perform VHL, we first craft a virtual dataset independent of the natural dataset and being separable. The conclusion is drawn from Theorem 3.2. Details can be found in Appendix A. In particular, we use an untrained style-GAN to generate noise for each category. Visualization can be found in Appendix C.3. We also explore other methods (i.e., with a simple generative model and up-sampling with pure Gaussian noises) to generate virtual datasets in Sec. 5.4. Then, we train local models with the local objective function Eq. 4. + +Algorithm 1 summarizes the training procedure of applying VHL to FedAvg, highlighting modifications to FedAvg. The server works almost the same as FedAvg, except that it sends the virtual dataset to all selected clients at the beginning. Different from FedAvg, clients optimize its local model based on both natural data and virtual data. Since only the utilized training data and the objective function are modified, other federated learning algorithms, e.g., FedProx, + +Algorithm 1 FedAvg with VHL +client $k$ 's input: local epochs $E$ +```txt +server input: initial $w^0$ , maximum communication round $R$ +``` + +Initialization: server distributes the initial model $w^0$ to all clients, as well as the virtual dataset $\tilde{D}$ . + +Server_Executes: +```txt +for each round $r = 0,1,\dots ,R$ do server samples a set of clients $\mathcal{S}_r\subseteq \{1,\ldots ,K\}$ server communicates $w_{r}$ to all clients $k\in S$ for each client $k\in S^r$ in parallel do do $w_{k,E - 1}^{r + 1}\gets \mathrm{ClientUpdate}(k,w^r)$ end for $w^{r + 1}\gets \sum_{k = 1}^{K}p_{k}w_{k,E - 1}^{r}$ +end for +``` + +Client_Training $(k,w)$ .. +```txt +for each local epoch $j$ with $j = 0,\dots ,E - 1$ do $w_{k,j + 1}\gets w_{k,j} - \eta_{k,j}\nabla_w\bar{J}_k(w)$ , i.e., Eq.4 +end for +Return $w$ to server +``` + +SCAFFOLD, could be effortlessly combined with VHL. + +# 4. Related Work + +We merely introduce the most related works in this section due to the limited space and leave more detailed discussion and literature review in Appendix B. + +Mitigating Client Drift. A series of works focus on adding regularization to calibrate the optimization direction of local models, restricting local models from being too far away from the server model, including FedProx (Li et al., 2020a), FedDyn (Acar et al., 2021), SCAFFOLD (Karimireddy et al., 2020), MOON (Li et al., 2021b), and FedIR (Hsu et al., 2020). From the optimization point of view, some methods propose to correct the updates from clients, accelerating and stabilizing the convergence, like FedNova (Wang et al., 2020), FedAvgM (Hsu et al., 2019), FedAdaGrad, FedYogi, and FedAdam (Reddi et al., 2021). + +Sharing Data. Some works propose to utilize GANs (Jeong et al., 2018; Long et al., 2021) or adversarial learning (Goetz & Tewari, 2020) to generate synthetic data based on the information of the raw data. Nonetheless, all above methods could expose the information of the raw data at some degree, i.e. intermediate features, statistic information, raw data. + +The statistical information of the raw data (Yoon et al., 2021; Shin et al., 2020) is also employed to learn and share synthetic data. The profiles of the raw images could be still seen from the synthetic images, exposing the raw data infor + +mation at a degree. Thus, the intermedia activations (Hao et al., 2021) or logits (Li & Wang, 2019; Chang et al., 2019; Luo et al., 2021) of the raw data are exploited to enhance FL. However, these methods may expose the accurate high-level semantic information of raw data, making clients under the risks of exposing the private data. Specifically, the raw data may be reconstructed by feature inversion methods (Zhao et al., 2021). Table 7 in Appendix B summarizes these sharing data approach, but we omitted the comparison with works because of the above privacy concerns. + +# 5. Experimental Studies + +# 5.1. Experiment Setup + +Federated Datasets and Models. To verify the effectiveness of VHL, we exploit a popular FedML framework (He et al., 2020) to conduct experiments over various datasets including CIFAR-10 (Krizhevsky & Hinton, 2009), FMNIST (Xiao et al., 2017), SVHN (Netzer et al., 2011), and CIFAR-100 (Krizhevsky & Hinton, 2009). We use ResNet18 (He et al., 2016) for CIFAR-10, FMNIST and SVHN, and ResNet-50 for CIFAR-100. To emulate data distribution in FL, we partition the datasets with a commonly used Non-IID partition method, Latent Dirichlet Sampling (Hsu et al., 2019). Following existing works (Li et al., 2021b; Luo et al., 2021), each dataset is partitioned with two different Non-IID degrees using $a = 0.1$ and $a = 0.05$ . + +Moreover, to verify the effect of VHL on other kinds of Non-IID data distributions, we conduct experiments on CIFAR10 with 10 clients using another two kinds of Non-IID partition methods: (1) 2-classes partition (McMahan et al., 2017): each client only has 500 data samples of 2 classes; (2) subset partition (Zhao et al., 2018): all clients have data of all 10 classes, but each client has one dominant class with 4950 samples, and each of the remaining classes has 5 or 6 samples, which is an extremely imbalanced distribution. + +Baselines. We conduct FedAvg (McMahan et al., 2017) and recent effective FL algorithms that are proposed to address the client drift problem, including FedProx (Li et al., 2020a), SCAFFOLD (Karimireddy et al., 2020), and FedNova (Wang et al., 2020), with or without VHL. The detailed hyper-parameters of each algorithm in each setting are reported in Appendix C. + +Generating Virtual Datasets. We use an un-pretrained StyleGAN-v2 (Karras et al., 2020) without using any training data to generate the virtual dataset. Specifically, the server uses the StyleGAN to generate images with different latent styles and noises which are sampled from different Gaussian Distributions. We show these virtual noise in Figure 4 and 5 in Appendix C.3. The generated virtual images are then distributed to all clients at the beginning of training. We also explore other methods (i.e., generated with a sim + +![](images/fb7d41a1c550f65b314d19a07c177c5bc7f1fc2d580257dc19d87cc2124b169a.jpg) +(a) FedAvg without VHL + +![](images/d2529431ec4349b2b29237d2e83789facb15c0e14a2589234daff044c0cb5245.jpg) +(b) FedAvg with Naive VHL +Figure 2. The t-SNE Visualization of empirical feature distribution of 3 different clients training with FedAvg, at 299-th communication round. Different colors represent different classes of data, different shapes represent different clients, and the dotted circle means the virtual data. The Naive VHL means training with both the private natural and shared virtual data without feature calibration. + +![](images/fbd51d2d540b5777635844bfed1b4d725ff533f4e9c2b0b94b04671707c52ce8.jpg) +(c) FedAvg with VHL + +ple generative model and up-sampling with pure Gaussian noises) to generate virtual datasets in section 5.4. More generation details of virtual datasets are listed in Appendix C.3. + +# 5.2. Experimental Results + +Main Results. We use two metrics, the best accuracy during training and the number of communication rounds to achieve target accuracy, to compare the performance of different algorithms. The target accuracy is set as the best accuracy of FedAvg. The results on CIFAR-10, FMNIST, SVHN, and CIFAR-100 are shown in Tables 1, 2, 4, and 5, respectively. We also compare the convergence speed in Figure 3 (a) on CIFAR- $10^{3}$ . The results show that VHL not only improves the generalization ability, but also accelerates the convergence. We also measure the client drift (Karimireddy et al., 2020), $\frac{1}{|\mathcal{S}^r|}\sum_{i\in \mathcal{S}^r}\| \bar{w} -w_i\|$ , in Figure 3 (b), where we report the client drift for the first 500 rounds as the early stage of training has obvious client drift problems. Note that we exclude FedNova from comparison as its client drift is very severe. The Figure 3 (b) show that VHL could greatly alleviate client drift, thus accelerating convergence. + +Impacts of Non-IID Degree. As shown in Tables 1, 2, 4, and 5, for all datasets with high Non-IID degree ( $a = 0.05$ ), the VHL gains more performance improvement than the case of lower Non-IID degree ( $a = 0.1$ ), which verifies that VHL could effectively defend against data heterogeneity. + +Different Non-IID Partition Methods. The experiment results of another two kinds of Non-IID partition methods are listed in Table 3. Compared with LDA partition with $a = 0.1$ , these two kinds of Non-IID distribution make the generalization performance of FL drops much more. For these more difficult tasks, VHL gains much more performance improvement than other algorithms, which demonstrates that VHL + +could well defend different kinds of data heterogeneity. + +Different Number of Clients. The 10-client setting simulates the cross-silo FL in which clients have larger dataset, and the 100-client setting simulates cross-device FL in which clients have smaller dataset. As shown in Tables 1, 2, 4, and 5, VHL boosts the generalization performance and significantly reduces the communication cost to achieve the target accuracy in both scenarios. + +Different Local Epochs. Results in Tables 1, 2, 4, and 5 show that when increasing local training epochs, VHL also benefits FL. However, as shown in Table 5, for CIFAR-100 when $E = 5$ , VHL does not work well. We suppose that reasons exist in two aspects: 1) As shown in Table 5, the test accuracy of centralized training using VHL is worse than the normal training. The larger number of classes need larger model capacity. The ResNet-50 cannot attain a high test accuracy on CIFAR-100, not to say 200 classes with the virtual dataset. 2) The larger local epochs means that clients will train more local iterations, which may cause clients to have a drifted feature expression of the virtual data, leading to the failure of calibration. + +Visualization of Feature Distribution. To understand how VHL helps generalize the model, we exploit t-SNE (van der Maaten & Hinton, 2008) to show the feature distributions of clients at the 299-th communication round. To highlight the generalization performance, we show the features on test datasets, where merely 3 clients are used considering the better visualization. And we also report feature distributions at different communication rounds in Appendix D.1. in Figure 2. From Figure 2 (a), we can see that FedAvg makes most features from different labels at the same client be very close, and it makes the features from the same class be separate. It indicates that different clients have very different feature representation for the same or similar inputs + +Table 1. Results with/without VHL on CIFAR-10. + +
ACC ↑ROUND ↓Speedup ↑
w/ (w/o) VHL
centralized training ACC = 92.88% (92.53%)
a = 0.1, E = 1, K = 10 (Target ACC = 79%)
FedAvg87.82 (79.98)128 (287)× 2.2 (× 1.0)
FedProx87.30 (83.56)128 (188)× 2.2 (× 1.5)
SCAFFOLD84.87 (83.58)90 (291)× 3.2 (× 1.0)
FedNova87.56 (81.35)128 (351)× 2.2 (× 0.8)
a = 0.05, E = 1, K = 10 (Target ACC = 69%)
FedAvg79.23 (69.02)112 (411)× 3.7 (× 1.0)
FedProx80.84 (78.66)151 (201)× 2.7 (× 2.0)
SCAFFOLD55.73 (38.55)Nan (Nan)Nan (Nan)
FedNova80.59 (64.78)247 (Nan)× 1.66 (Nan)
a = 0.1, E = 5, K = 10 (Target ACC = 84%)
FedAvg89.93 (84.79)91 (255)× 2.8 (× 1.0)
FedProx86.41 (82,18)255 (Nan)× 1.0 (Nan)
SCAFFOLD87.27 (86.20)45 (66)× 5.7 (× 2.0)
FedNova90.24 (86.09)67 (127)× 3.8 (× 1.0)
a = 0.1, E = 1, K = 100 (Target ACC = 49%)
FedAvg70.20 (49.61)385 (957)× 2.5 (× 1.0)
FedProx73.90 (49.97)325 (842)× 2.9 (× 1.1)
SCAFFOLD59.66 (52.24)479 (664)× 2.0 (× 1.4)
FedNova61.59 (46.53)554 (Nan)× 1.7 (Nan)
+ +"ROUND" represents the communication rounds that need to attain the target accuracy. The notion $\downarrow (\uparrow)$ indicates smaller (larger) values are preferred. "Nan" means that the target accuracy is never attained during the whole training process. + +in FedAvg, which results in poor generalization ability of the trained model. As shown in Figure 2 (b), after local training with the virtual data without feature calibration (called Naive VHL), we can see the features of virtual data are consistent in all clients as the virtual data is shared, but the feature distributions of the original data are only slightly better than the naive FedAvg. Thus, we would like to pull the features of the original dataset close to the virtual dataset so that the corrected training data has a relatively low data heterogeneity. As shown in Figure 2 (c), after we applied the feature calibration in VHL, the features from the same class at different clients are gathered closely and become compact. It indicates that training with VHL can help different clients learn homogeneous natural features for the same classes. + +# 5.3. Other Facets of VHL + +In this section, we dive into VHL deeper by further studying other facets related to it. In addition, we conduct experiments on CIFAR to investigate the intriguing property of VHL. All of these experimental results are listed in Table 6. + +Transfer Learning from Virtual Dataset. The deep learning model pretrained on virtual datasets could also perform well on realistic datasets (Baradad et al., 2021). Thus, to + +Table 2. Results with/without VHL on FMNIST. + +
ACC ↑ROUND ↓Speedup ↑
w/ (w/o) VHL
centralized training ACC = 93.80% (93.70%)
a = 0.1, E = 1, K = 10 (Target ACC = 86%)
FedAvg92.05 (86.81)52 (119)× 2.3 (× 1.0)
FedProx90.68 (87.12)31 (135)× 3.8 (× 0.9)
SCAFFOLD90.27 (86.21)14 (143)× 8.5 (× 0.8)
FedNova91.88 (86.99)52 (83)× 2.3 (× 1.4)
a = 0.05, E = 1, K = 10 (Target ACC = 78%)
FedAvg89.06 (78.57)53 (425)× 8.0 (× 1.0)
FedProx87.76 (81.96)30 (41)× 14.2 (× 10.4)
SCAFFOLD80.68 (76.08)58 (Nan)× 7.3 (Nan)
FedNova87.25 (79.06)30 (538)× 14.2 (× 0.8)
a = 0.1, E = 5, K = 10 (Target ACC = 87%)
FedAvg91.52 (87.45)51 (278)× 5.5 (× 1.0)
FedProx88.27 (86.07)74 (Nan)× 3.8 (Nan)
SCAFFOLD91.82 (87.10)20 (105)× 13.9 (× 2.7)
FedNova91.86 (87.53)51 (193)× 5.5 (× 1.4)
a = 0.1, E = 1, K = 100 (Target ACC = 90%)
FedAvg91.14 (90.11)436 (658)× 1.5 (× 1.0)
FedProx91.37 (90.71)283 (491)× 2.3 (× 1.3)
SCAFFOLD87.91 (85.99)Nan (Nan)Nan (Nan)
FedNova88.34 (87.09)Nan (Nan)Nan (Nan)
+ +Table 3. Experiment results of other Non-IID partition methods. + +
PartitionTest Accuracy w/(w/o) VHL
FedAvgFedProxSCAFFOLDFedNova
2-classes71.88/41.7475.43/54.2166.02/46.6773.46/43.38
Subset50.29/38.3339.41/33.6643.77/33.3538.22/32.18
+ +![](images/5d9460706c2eaeac874c9290922104eb03d9406d478226a78e541b7f31642743.jpg) +(a) Test Accuracy + +![](images/bac05fe7790e6d8a8933a918a6af80dd7461482d6bd863b74a2dd24d2efd5989.jpg) +(b) Model Divergence +Figure 3. CIFAR10 with $a = 0.1$ , $E = 1$ , $K = 10$ . Grey lines represent the test accuracy, and solid lines represent smoothed version of the grey lines for better visualization. + +understand whether the benefits of VHL come from only conducting transfer learning from the virtual dataset, we pretrain the server model with the virtual dataset, and then conduct vanilla FedAvg. We call this simple algorithm as virtual federated transfer learning (VFTL). The results of this experiment are shown in Table 6. Due to the limited space, we show the convergence curve of this experiment in the Figure 18 (a) in Appendix D.2. The experimental results show that the model performance could not benefit from such a pretraining on virtual dataset. But the Figure 18 (a) shows the VFTL could provide some convergence speedup + +Table 4. Results with/without VHL on SVHN. + +
ACC ↑ROUND ↓Speedup ↑
w/ (w/o) VHL
centralized training ACC = 95.01% (95.27%)
a = 0.1, E = 1, K = 10 (Target ACC = 88%)
FedAvg93.49 (88.56)75 (251)× 3.3 (× 1.0)
FedProx91.70 (86.51)271 (Nan)× 0.9 (Nan)
SCAFFOLD87.54 (80.61)Nan (Nan)Nan (Nan)
FedNova93.35 (89.12)75 (251)× 3.3 (× 1.0)
a = 0.05, E = 1, K = 10 (Target ACC = 82%)
FedAvg92.26 (82.67)94 (357)× 3.8 (× 1.0)
FedProx89.30 (78.57)320 (Nan)× 1.1 (Nan)
SCAFFOLD83.89 (74.23)147 (Nan)× 2.4 (Nan)
FedNova91.82 (82.22)128 (741)× 2.8 (× 0.5)
a = 0.1, E = 5, K = 10 (Target ACC = 87%)
FedAvg90.52 (87.92)145 (131)× 0.9 (× 1.0)
FedProx87.20 (78.43)351 (Nan)× 0.4 (Nan)
SCAFFOLD88.04 (81.07)210 (Nan)× 0.6 (Nan)
FedNova90.99 (88.17)75 (162)× 1.7 (× 0.8)
a = 0.1, E = 1, K = 100 (Target ACC = 89%)
FedAvg92.05 (89.44)362 (618)× 1.7 (× 1.0)
FedProx92.08 (89.51)356 (618)× 1.7 (× 1.0)
SCAFFOLD89.21 (89.55)968 (643)× 0.6 (× 1.0)
FedNova92.01 (82.08)676 (Nan)× 0.9 (Nan)
+ +at the beginning of training. We suppose such an initial speedup comes from the better feature extractor of the pretrained model. This phenomenon is compatible with the recently finding that the loading pretrained model could accelerate FL training (He et al., 2021). + +Naive VHL. We study the effect of simply training with the natural data together with the virtual dataset, without any extra algorithm designs. In this experiment, clients will sample both natural data together with the virtual data, without feature calibration. + +The experiment results are listed in Table 6, showing that even simply adding the virtual dataset could also benefit FL. We conjecture that the benefit of this may come from several aspects: 1) As the data heterogeneity decreases, the client drift is alleviated; 2) The client models could learn low-level features from the virtual data, thus there exists the effect of transfer learning from the virtual dataset; 3) By adding the virtual dataset, the clients now have more classes than before, which can effectively alleviate the negative impact of local dominant classes on classifiers, which is also studied by (Luo et al., 2021; Yu et al., 2021). + +Virtual Feature Alignment. To validate the effect of feature calibration, we completely eliminate the effect of the virtual data by removing the virtual dataset, and sampling new features from different Gaussian distributions. Then, we conduct feature calibration based on these shared fea + +Table 5. Results with/without VHL on CIFAR-100. + +
ACC ↑ROUND ↓Speedup ↑
w/ (w/o) VHL
centralized training ACC = 71.90 % (74.25 %)
a = 0.1, E = 1, K = 10 (Target ACC = 67%)
FedAvg70.04 (67.95)384 (497)× 1.3 (× 1.0)
FedProx68.29 (65.29)617 (Nan)× 0.8 (Nan)
SCAFFOLD67.88 (67.14)294 (766)× 1.7 (× 0.6)
FedNova69.58 (68.26)384 (472)× 1.3 (× 1.1)
a = 0.05, E = 1, K = 10 (Target ACC = 62%)
FedAvg65.61 (62.07)354 (514)× 1.5 (× 1.0)
FedProx64.39 (61.52)482 (Nan)× 1.1 (Nan)
SCAFFOLD60.67 (59.04)Nan (Nan)Nan (Nan)
FedNova66.45 (60.35)320 (Nan)× 1.6 (Nan)
a = 0.1, E = 5, K = 10 (Target ACC = 69%)
FedAvg69.85 (69.81)327 (283)× 0.9 (× 1.0)
FedProx63.83 (62.62)Nan (Nan)Nan (Nan)
SCAFFOLD69.43 (70.68)291 (171)× 1.0 (× 1.7)
FedNova68.86 (70.05)Nan (292)Nan (× 1.0)
a = 0.1, E = 1, K = 100 (Target ACC = 48%)
FedAvg53.45 (48.33)717 (967)× 1.3 (× 1.0)
FedProx52.68 (48.14)717 (955)× 1.3 (× 1.0)
SCAFFOLD54.93 (51.63)656 (827)× 1.5 (× 1.2)
FedNova53.50 (48.12)797 (967)× 1.2 (× 1.0)
+ +tures. We name this simple method as Virtual Feature Alignment (VFA). Besides aligning the features, we can also employ approaches like style normalization (Jin et al., 2020) to mitigate the domain gap. As shown in Table 6, feature calibration benefits FL even only with the random features. Although the performance of VFA falls behind the VHL, it is valuable to explore VFA, due to its computation efficiency. + +# 5.4. Ablation Study + +VHL with Other Datasets. We study the effect of replacing the virtual dataset generated by the StyleGAN to other datasets. The first dataset is generated by upsampling the pure Gaussian Noise, which is shown in Figure 6 in the Appendix C.3. The second dataset is generated by a simple CNN rather than StyleGAN shown in Figure 7 in the Appendix C.3. And the third dataset is a 10-class subset of Tiny-ImageNet (Le & Yang, 2015). + +As shown in Table 6, VHL with the simple pure noise could benefit FL, reducing the difficulty of generating the virtual dataset. And it shows that using a Tiny-[ImageNet as our virtual dataset could not outperform using pure noise, which is a bit surprising. Because the realistic dataset may have more plentiful semantic information than the virtual dataset. The possible reason is that, the Tiny-[ImageNet is more difficult to be separated than the generated virtual dataset, thus the feature calibration cannot work well. To verify this + +Table 6. Experiment results of further study of VHL on CIFAR10. + +
FedAvgFedProxSCAF.FedNova
Baselines79.9883.5683.5881.35
VHL87.8287.3084.8787.56
Other Facets of VHL
VFTL80.3882.2083.8380.63
Naive VHL86.5085.6685.7085.74
VFA85.1484.7585.3186.59
Ablation Study
Pure Noise87.0186.4685.5787.81
Simple-CNN84.8785.3084.1585.25
Tiny-ImageNet84.0583.6281.5785.41
Bv=6487.3686.3682.3987.20
Bv=12887.8287.3084.8787.56
Bv=25688.9586.8284.6887.89
Bv=38489.6986.5985.8788.73
λ=0.187.0286.1284.2587.02
λ=0.287.0486.0284.4187.65
λ=0.587.0285.9984.2987.15
λ=1.087.8287.3084.8787.56
λ=2.087.8786.8684.8188.71
λ=5.083.5288.3485.5888.47
λ=10.088.6588.4185.2988.39
h_shallow86.1085.5985.1984.95
h_middle87.0686.3087.9787.27
h_deep89.2687.5486.0088.42
h_last87.8287.3084.8787.56
Model Capacity
Res10-Baselines83.5582.7682.9183.14
Res10-VHL87.3986.0885.0988.03
Res18-Baselines79.9883.5683.5881.35
Res18-VHL87.8287.3084.8787.56
Res34-Baselines82.7384.0481.1182.48
Res34-VHL87.9288.0584.8088.74
+ +hypothesis, We report the curve of the training accuracy on the virtual dataset in Figure 18 (c) in Appendix D.2. + +Sampling More Virtual Data. We note that under the high Non-IID degree, some clients would own much more data samples than the virtual data, reducing the effect of feature calibration. Therefore, we consider increasing the sampling weight of the virtual data, making clients to see more virtual data to strengthen the effect of calibration. We conduct VHL with CIFAR-10 with different batch size $B_{v}$ to verify the effect of sampling more virtual data. The experiment results are shown in Table 6 and Figure 18 (a) in Appendix D.2, demonstrating that sampling more virtual data could strengthen the effect of VHL. + +Different Calibration Weight. We adjust different calibration weights $\lambda$ as sensitivity test. The experimental results are listed in Table 6, showing that VHL is not sensitive to the calibration weight. + +Using Features of Different Layers. To study the impact of features from different layers, we conduct calibration based on different output layers of ResNet-18. We find that using the features from the 4-th layer of ResNet-18 has the + +best performance. We suppose that calibration based on too shallow layer may be not enough to impact the subsequent layers feature shift. However, the calibration based on the last layer may interrupt the normal classification between the natural data and the virtual data, because which have completely different high-level semantic information. + +Model Capacity. Adding more data means deep learning models may need more model capacity, so we investigate the sensitivity of VHL to model capacity. We conduct experiments on CIFAR-10 with different models, including ResNet-10, ResNet-18 and ResNet-34. Results in Table 6 show that VHL could perform well on all three models of different model capacity. + +# 5.5. Limitations + +Guarantee the Diversity of the Virtual Dataset. In our method, the virtual dataset needs the same number of classes as the original datasets, so that the label alignment could be implemented. However, when meeting numerous classes of original datasets, generating a virtual dataset with enough diversity may cost more calculation resources. + +Extra Calculation. VHL needs to conduct training on the virtual data, causing the extra calculation cost. VFA is a possible direction to reduce the calculation, as mentioned in Sec. 5.3. We compare the calculation cost of different algorithms in Table 10 in Appendix D.3. + +# 6. Conclusion + +In this paper, we find that FL could remarkably benefit from a virtual dataset containing no information related to the natural dataset, shedding light on the data heterogeneity mitigation from a virtual data perspective. Through the calibration on the homogeneous virtual data, FL could attain significant performance improvement and much less client drift. Our contribution not only exists in the improvements of model performance in FL, but also in inspiring a new viewpoint to FL with many intriguing experimental phenomena. We hope the future works could unearth more things about VHL and exploit it to enhance FL or other machine learning tasks. + +# Acknowledgements + +This work was supported in part by Hong Kong CRF grant C2004-21GF, Hong Kong RIF grant R6021-20, and Hong Kong Research Matching Grant RMGS2019_1_23. YGZ and BH were supported by the RGC Early Career Scheme No. 22200720, NSFC Young Scientists Fund No. 62006202, and Guangdong Basic and Applied Basic Research Foundation No. 2022A1515011652. + +# References + +Acar, D. A. E., Zhao, Y., Matas, R., Mattina, M., Whatmough, P., and Saligrama, V. Federated learning based on dynamic regularization. In ICLR, 2021. +Baradad, M., Wulff, J., Wang, T., Isola, P., and Torralba, A. Learning to see by looking at noise. In NeurlPS, 2021. +Ben-David, S., Blitzer, J., Crammer, K., Pereira, F., et al. Analysis of representations for domain adaptation. In NeurlPS, pp. 137-144, 2007. +Ben-David, S., Blitzer, J., Crammer, K., Kulesza, A., Pereira, F., and Vaughan, J. W. A theory of learning from different domains. Machine learning, 79(1):151-175, 2010. +Cai, K., Lei, X., Wei, J., and Xiao, X. Data synthesis via differentially private markov random fields. Proc. VLDB Endow., 14(11):2190-2202, 2021. +Chang, H., Shejwalkar, V., Shokri, R., and Houmansadr, A. Cronus: Robust and heterogeneous collaborative learning with black-box knowledge transfer. arXiv preprint arXiv:1912.11279, 2019. +Chatalic, A., Schellekens, V., Houssiau, F., de Montjoye, Y. A., Jacques, L., and Gribonval, R. Compressive learning with privacy guarantees. Information and Inference: A Journal of the IMA, 2021. +Chen, H.-Y. and Chao, W.-L. Fedbe: Making bayesian model ensemble applicable to federated learning. In NeurIPS, 2020. +Croce, D., Castellucci, G., and Basili, R. Gan-bert: Generative adversarial learning for robust text classification with a bunch of labeled examples. In ACL, 2020. +Diochnos, D., Mahloujifar, S., and Mahmoody, M. Adversarial risk and robustness: General definitions and implications for the uniform distribution. In NeurlPS, 2018. +Franceschi, J.-Y., Fawzi, A., and Fawzi, O. Robustness of classifiers to uniform $\ell_p$ and gaussian noise. In AISTATS, 2018. +Frenay, B. and Verleysen, M. Classification in the presence of label noise: a survey. IEEE transactions on neural networks and learning systems, 25(5):845-869, 2013. +Ganin, Y., Ustinova, E., Ajakan, H., Germain, P., Larochelle, H., Laviolette, F., Marchand, M., and Lempitsky, V. Domain-adversarial training of neural networks. The journal of machine learning research, 17(1):2096-2030, 2016. + +Goetz, J. and Tewari, A. Federated learning via synthetic data. arXiv preprint arXiv:2008.04489, 2020. +Gong, M., Zhang, K., Liu, T., Tao, D., Glymour, C., and Scholkopf, B. Domain adaptation with conditional transferable components. In ICML, 2016. +Goodfellow, I., Pouget-Abadie, J., Mirza, M., Xu, B., Warde-Farley, D., Ozair, S., Courville, A., and Bengio, Y. Generative adversarial networks. Communications of the ACM, 63(11):139-144, 2020. +Hao, W., El-Khamy, M., Lee, J., Zhang, J., Liang, K. J., Chen, C., and Duke, L. C. Towards fair federated learning with zero-shot data augmentation. In CVPR, 2021. +Hardt, M. and Rothblum, G. N. A multiplicative weights mechanism for privacy-preserving data analysis. In FOCS, 2010. +Hardt, M., Ligett, K., and Mcsherry, F. A simple and practical algorithm for differentially private data release. In NeurlPS, 2012. +He, C., Li, S., So, J., Zhang, M., Wang, H., Wang, X., Vepakomma, P., Singh, A., Qiu, H., Shen, L., Zhao, P., Kang, Y., Liu, Y., Raskar, R., Yang, Q., Annavaram, M., and Avestimehr, S. Fedml: A research library and benchmark for federated machine learning. arXiv preprint arXiv:2007.13518, 2020. +He, C., Shah, A. D., Tang, Z., Sivashunmugam, D. F. N., Bhogaraju, K., Shimpi, M., Shen, L., Chu, X., Soltanolkotabi, M., and Avestimehr, S. Fedcv: A federated learning framework for diverse computer vision tasks. arXiv preprint arXiv:2111.11066, 2021. +He, K., Zhang, X., Ren, S., and Sun, J. Deep residual learning for image recognition. In CVPR, 2016. +Hsu, T. H., Qi, H., and Brown, M. Measuring the effects of non-identical data distribution for federated visual classification. arXiv preprint arxiv: 1909.06335, 2019. +Hsu, T.-M. H., Qi, H., and Brown, M. Federated visual classification with real-world data distribution. In ECCV, 2020. +Huang, X., Wang, P., Cheng, X., Zhou, D., Geng, Q., and Yang, R. The apolloscape open dataset for autonomous driving and its application. IEEE transactions on pattern analysis and machine intelligence, 42(10):2702-2719, 2019. +Jeong, E., Oh, S., Kim, H., Park, J., Bennis, M., and Kim, S.-L. Communication-efficient on-device machine learning: Federated distillation and augmentation under non-iid private data. 2018. + +Jin, X., Lan, C., Zeng, W., Chen, Z., and Zhang, L. Style normalization and restitution for generalizable person re-identification. In CVPR, 2020. +Johnson, N., Near, J. P., and Song, D. Towards practical differential privacy for sql queries. Proceedings of the VLDB Endowment, 11(5):526-539, 2018. +Kairouz, P., McMahan, H. B., Avent, B., Bellet, A., Dennis, M., Bhagoji, A. N., Bonawitz, K., Charles, Z., Cormode, G., Cummings, R., et al. Advances and open problems in federated learning. Found. Trends Mach. Learn., 14(1-2): 1-210, 2021. +Karimireddy, S. P., Kale, S., Mohri, M., Reddi, S., Stich, S., and Suresh, A. T. SCAFFOLD: Stochastic controlled averaging for federated learning. In ICML, 2020. +Karras, T., Laine, S., and Aila, T. A style-based generator architecture for generative adversarial networks. In CVPR, 2019. +Karras, T., Laine, S., Aittala, M., Hellsten, J., Lehtinen, J., and Aila, T. Analyzing and improving the image quality of StyleGAN. In CVPR, 2020. +Khosla, P., Teterwak, P., Wang, C., Sarna, A., Tian, Y., Isola, P., Maschinot, A., Liu, C., and Krishnan, D. Supervised contrastive learning. 2020. +Koltchinskii, V. and Panchenko, D. Empirical margin distributions and bounding the generalization error of combined classifiers. The Annals of Statistics, 30(1):1-50, 2002. +Krizhevsky, A. and Hinton, G. Learning multiple layers of features from tiny images. Master's thesis, 2009. +Le, Y. and Yang, X. Tiny imagenet visual recognition challenge. CS 231N, 7(7):3, 2015. +Lei, Q., Hu, W., and Lee, J. Near-optimal linear regression under distribution shift. In ICML, 2021. +Li, D. and Wang, J. Fedmd: Heterogenous federated learning via model distillation. arXiv preprint arXiv:1910.03581, 2019. +Li, Q., Diao, Y., Chen, Q., and He, B. Federated learning on non-iid data silos: An experimental study. arXiv preprint arXiv:2102.02079, 2021a. +Li, Q., He, B., and Song, D. Model-contrastive federated learning. In CVPR, 2021b. +Li, T., Sahu, A. K., Zaheer, M., Sanjabi, M., Talwalkar, A., and Smith, V. Federated optimization in heterogeneous networks. In MLSys, 2020a. + +Li, X., Huang, K., Yang, W., Wang, S., and Zhang, Z. On the convergence of fedavg on non-iid data. In ICLR, 2020b. +Lin, T., Kong, L., Stich, S. U., and Jaggi, M. Ensemble distillation for robust model fusion in federated learning. In NeurIPS, 2020. +Liu, F., Zhang, G., and Lu, J. Heterogeneous domain adaptation: An unsupervised approach. IEEE transactions on neural networks and learning systems, 31(12):5588-5602, 2020. +Long, M., Wang, J., Ding, G., Sun, J., and Yu, P. S. Transfer feature learning with joint distribution adaptation. In ICCV, 2013. +Long, M., Zhu, H., Wang, J., and Jordan, M. I. Deep transfer learning with joint adaptation networks. In ICML, 2017. +Long, Y., Wang, B., Yang, Z., Kailkhura, B., Zhang, A., Gunter, C., and Li, B. G-pate: Scalable differentially private data generator via private aggregation of teacher discriminators. 2021. +Luo, J., Wu, X., Luo, Y., Huang, A., Huang, Y., Liu, Y., and Yang, Q. Real-world image datasets for federated learning. arXiv preprint arXiv:1910.11089, 2019. +Luo, M., Chen, F., Hu, D., Zhang, Y., Liang, J., and Feng, J. No fear of heterogeneity: Classifier calibration for federated learning with non-IID data. In NeurlPS, 2021. +McMahan, B., Moore, E., Ramage, D., Hampson, S., and y Arcas, B. A. Communication-efficient learning of deep networks from decentralized data. In AISTATS, 2017. +Miyato, T., Maeda, S.-i., Koyama, M., and Ishii, S. Virtual adversarial training: a regularization method for supervised and semi-supervised learning. IEEE transactions on pattern analysis and machine intelligence, 41(8):1979-1993, 2018. +Netzer, Y., Wang, T., Coates, A., Bissacco, A., Wu, B., and Ng, A. Y. Reading digits in natural images with unsupervised feature learning. In NIPS Workshop on Deep Learning and Unsupervised Feature Learning 2011, 2011. +Pan, S. J. and Yang, Q. A survey on transfer learning. IEEE Transactions on knowledge and data engineering, 22(10): 1345-1359, 2009. +Pan, S. J., Tsang, I. W., Kwok, J. T., and Yang, Q. Domain adaptation via transfer component analysis. IEEE transactions on neural networks, 22(2):199-210, 2010. +Polyzotis, N., Roy, S., Whang, S. E., and Zinkevich, M. Data management challenges in production machine learning In SIGMOD, 2017. + +Qiu, W., Zhong, F., Zhang, Y., Qiao, S., Xiao, Z., Kim, T. S., and Wang, Y. Unrealcv: Virtual worlds for computer vision. In ACM Multimedia, 2017. +Quinonero-Candela, J., Sugiyama, M., Schwaighofer, A., and Lawrence, N. D. Dataset shift in machine learning. Mit Press, 2008. +Reddi, S. J., Charles, Z., Zaheer, M., Garrett, Z., Rush, K., Konečný, J., Kumar, S., and McMahan, H. B. Adaptive federated optimization. In ICLR, 2021. +Sehwag, V., Mahloujifar, S., Handina, T., Dai, S., Xiang, C., Chiang, M., and Mittal, P. Improving adversarial robustness using proxy distributions. arXiv preprint arXiv:2104.09425, 2021. +Shin, M., Hwang, C., Kim, J., Park, J., Dennis, M., and Kim, S.-L. Xor mixup: Privacy-preserving data augmentation for one-shot federated learning. arXiv preprint arXiv:2006.05148, 2020. +Tang, Z., Hu, Z., Shi, S., Cheung, Y.-M., Jin, Y., Ren, Z., and Chu, X. Data resampling for federated learning with non-iid labels. In FTL-IJCAI'21, 2021. +Tramer, F. and Boneh, D. Differentially private learning needs better features (or much more data). In ICLR, 2021. +van der Maaten, L. and Hinton, G. Visualizing data using t-sne. Journal of Machine Learning Research, 9(86): 2579-2605, 2008. +Wang, J., Liu, Q., Liang, H., Joshi, G., and Poor, H. V. Tackling the objective inconsistency problem in heterogeneous federated optimization. In NeurlPS, 2020. +Wang, J., Charles, Z., Xu, Z., Joshi, G., McMahan, H. B., Al-Shedivat, M., Andrew, G., Avestimehr, S., Daly, K., Data, D., et al. A field guide to federated optimization. arXiv preprint arXiv:2107.06917, 2021. +Xiao, H., Rasul, K., and Vollgraf, R. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms. arXiv preprint arXiv:1708.07747, 2017. +Yang, K., Zhou, T., Zhang, Y., Tian, X., and Tao, D. Class-disentanglement and applications in adversarial detection and defense. In NeurIPS, 2021. +Yang, T., Andrew, G., Eichner, H., Sun, H., Li, W., Kong, N., Ramage, D., and Beaufays, F. Applied federated learning: Improving google keyboard query suggestions. arXiv preprint arXiv:1812.02903, 2018. +Yoon, T., Shin, S., Hwang, S. J., and Yang, E. Fedmix: Approximation of mixup under mean augmented federated learning. In ICLR, 2021. + +Yu, F., Zhang, W., Qin, Z., Xu, Z., Wang, D., Liu, C., Tian, Z., and Chen, X. Fed2: Feature-aligned federated learning. In SIGKDD, 2021. +Yurochkin, M., Agarwal, M., Ghosh, S., Greenewald, K., Hoang, N., and Khazaeni, Y. Bayesian nonparametric federated learning of neural networks. In ICML, 2019. +Zhang, K., Schölkopf, B., Muandet, K., and Wang, Z. Domain adaptation under target and conditional shift. In ICML, 2013. +Zhao, H., Des Combes, R. T., Zhang, K., and Gordon, G. On learning invariant representations for domain adaptation. In ICML, 2019. +Zhao, N., Wu, Z., Lau, R. W. H., and Lin, S. What makes instance discrimination good for transfer learning? In ICLR, 2021. +Zhao, Y., Li, M., Lai, L., Suda, N., Civin, D., and Chandra, V. Federated learning with non-iid data. arXiv preprint arXiv:1806.00582, 2018. + +# A. Proof + +# A.1. Proof of Theorem 3.2 + +Recall that the model $f$ can be decomposed as $f = \phi \circ \rho$ , the statistical margin for $f$ then becomes: + +$$ +S M _ {m} (f, \mathcal {P} (x, y)) = S M _ {m} (\rho , \mathcal {P} (\phi (x), y)). \tag {6} +$$ + +In what follows, we use $\mathcal{P}(\phi ,y)$ to represent $\mathcal{P}(\phi (x),y)$ for brevity. + +Before giving detailed proof, we introduce a lemma: + +Lemma A.1. Let $\mathcal{P}$ and $\mathcal{P}_v$ be two distributions with identical label distributions, $d(\cdot ,\cdot)$ be the Wasserstein distance of two distributions, i.e., + +$$ +d \left(\mathcal {P} \left(\phi | y\right), \mathcal {P} _ {v} \left(\phi | y\right)\right) = \inf _ {J \in \mathcal {J} \left(\mathcal {P} \left(\phi | y\right), \mathcal {P} _ {v} \left(\phi | y\right)\right)} \mathbb {E} _ {\left(\phi , \phi^ {\prime}\right) \sim J} m \left(\phi , \phi^ {\prime}\right), +$$ + +where $\mathcal{J}(\mathcal{P}(\phi |y),\mathcal{P}_v(\phi |y))$ is the set of joint distributions of $\mathcal{P}(\phi |y)$ and $\mathcal{P}_v(\phi |y)$ . Then, we have + +$$ +\mathbb {E} _ {y} d (\mathcal {P} (\phi | y), \mathcal {P} _ {v} (\phi | y)) \geq | \mathbb {E} _ {\rho : = V H L (\mathcal {P} _ {v} (\phi , y))} [ S M _ {m} (\rho , \mathcal {P} (\phi , y)) - S M _ {m} (\rho , \mathcal {P} _ {v} (\phi , y)) ] |. +$$ + +Proof. We construct an optimal transport $\mathcal{I}_y^*$ between the conditional distributions $\mathcal{P}|y$ and $\mathcal{P}_v|y$ . Using the auxiliary distribution, we have + +$$ +\begin{array}{l} S M _ {m} (\rho , \mathcal {P} (\phi , y)) = \mathbb {E} _ {(\phi , y) \sim \mathcal {P}} \inf _ {\rho (\phi^ {\prime}) \neq y} m (\phi^ {\prime}, \phi) = \mathbb {E} _ {y} \mathbb {E} _ {\phi \sim \mathcal {P} | y} \inf _ {\rho (\phi^ {\prime}) \neq y} m (\phi^ {\prime}, \phi) = \mathbb {E} _ {y} \mathbb {E} _ {(\phi , \phi^ {\prime \prime}) \sim \mathcal {I} _ {y} ^ {*}} \inf _ {\rho (\phi^ {\prime}) \neq y} m (\phi^ {\prime}, \phi) \\ \leq \mathbb {E} _ {y} \mathbb {E} _ {(\phi , \phi^ {\prime \prime}) \sim \mathcal {I} _ {y} ^ {*}} \inf _ {\rho (\phi^ {\prime}) \neq y} [ m (\phi^ {\prime}, \phi^ {\prime \prime}) + m (\phi^ {\prime \prime}, \phi) ] \\ = \mathbb {E} _ {y} \mathbb {E} _ {(\phi , \phi^ {\prime \prime}) \sim \mathcal {I} _ {y} ^ {*}} \inf _ {\rho (\phi^ {\prime}) \neq y} m \left(\phi^ {\prime \prime}, \phi^ {\prime}\right) + \mathbb {E} _ {y} \mathbb {E} _ {(\phi , \phi^ {\prime \prime}) \sim \mathcal {I} _ {y} ^ {*}} m \left(\phi^ {\prime \prime}, \phi\right) \tag {7} \\ = \mathbb {E} _ {(\phi^ {\prime \prime}, y) \sim \mathcal {P} _ {v}} \inf _ {\rho (\phi^ {\prime}) \neq y} m \left(\phi^ {\prime \prime}, \phi^ {\prime}\right) + \mathbb {E} _ {y} d \left(\mathcal {P} (\phi | y), \mathcal {P} _ {v} (\phi | y)\right) \\ = S M _ {m} (\rho , \mathcal {P} _ {v} (\phi , y)) + \mathbb {E} _ {y} d (\mathcal {P} (\phi | y), \mathcal {P} _ {v} (\phi | y)). \\ \end{array} +$$ + +Similarly, we have + +$$ +S M _ {m} (\rho , \mathcal {P} _ {v} (\phi , y)) \leq S M _ {m} (\rho , \mathcal {P} (\phi , y)) + \mathbb {E} _ {y} d (\mathcal {P} (\phi | y), \mathcal {P} _ {v} (\phi | y)). \tag {8} +$$ + +Combining Eq. 7 and Eq. 8, we have + +$$ +\mathbb {E} _ {y} d (\mathcal {P} (\phi | y), \mathcal {P} _ {v} (\phi | y)) \geq | \mathbb {E} _ {\rho : = V H L (\mathcal {P} _ {v} (\phi , y))} [ S M _ {m} (\rho , \mathcal {P} (\phi , y)) - S M _ {m} (\rho , \mathcal {P} _ {v} (\phi , y)) ] |. \tag {9} +$$ + +This completes the proof. + +In addition, we decompose $SM_{m}(f,\mathcal{P}(\phi ,y))$ as follows: + +$$ +S M _ {m} (f, \mathcal {P} (\phi , y)) = S M _ {m} (f, \mathcal {P} (\phi , y)) - S M _ {m} (f, \mathcal {P} _ {v} (\phi , y)) + S M _ {m} (f, \mathcal {P} _ {v} (\phi , y)) - S M _ {m} (f, \tilde {D} (\phi , y)) + S M _ {m} (f, \tilde {D} (\phi , y)), +$$ + +where $\tilde{D} (\phi ,y)$ stands for the training set containing $n_v$ samples drawn from $\mathcal{P}_v(\phi ,y)$ . In what follows, we omit $(\phi ,y)$ for each joint distribution, e.g., using $\mathcal{P}$ for $\mathcal{P}(\phi ,y)$ , and denote $\mathbb{E}_{\rho \coloneqq VHL(\mathcal{P}(\phi ,y))}$ as $\mathbb{E}_{\rho \leftarrow \mathcal{P}}$ for brevity. + +Theorem A.2. Let $f = \phi \circ \rho$ be a neural network decompose of a feature extractor $\phi$ and a classifier $\rho$ , $\mathcal{P}(x,y)$ and $\mathcal{P}_v(x,y)$ are natural and virtual distributions with identical label distributions. Then, learning $f$ with the proposed distribution mismatch penalty, i.e., Eq. 4 elicits an model with bounded statistical margin, i.e., Definition 3.1. + +Proof. Built upon the decomposition and lemma A.1, we can bound the statistical margin $\mathbb{E}_{\rho \leftarrow \mathcal{P}_v}SM_m(\rho ,\mathcal{P})$ + +$$ +\begin{array}{l} \mathbb {E} _ {\rho \leftarrow \mathcal {P} _ {v}} S M _ {m} (\rho , \mathcal {P}) \geq \mathbb {E} _ {\rho \leftarrow \mathcal {P} _ {v}} S M _ {m} (\rho , \tilde {D}) - | \mathbb {E} _ {\rho \leftarrow \mathcal {P} _ {v}} [ S M _ {m} (\rho , \mathcal {P} _ {v}) - S M _ {m} (\rho , \tilde {D}) ] | - | \mathbb {E} _ {\rho \leftarrow \mathcal {P} _ {v}} [ S M _ {m} (\rho , \mathcal {P}) - S M _ {m} (\rho , \mathcal {P} _ {v}) ] | \\ \geq \mathbb {E} _ {\rho \leftarrow \mathcal {P} _ {v}} S M _ {m} (\rho , \tilde {D}) - \left| \mathbb {E} _ {\rho \leftarrow \mathcal {P} _ {v}} \left[ S M _ {m} (\rho , \mathcal {P} _ {v}) - S M _ {m} (\rho , \tilde {D}) \right] \right| - \mathbb {E} _ {y} d \left(\mathcal {P} (\phi | y), \mathcal {P} _ {v} (\phi | y)\right) \tag {10} \\ \end{array} +$$ + +The first and second term $\mathbb{E}_{\rho \leftarrow \mathcal{P}_v}SM_m(\rho ,\tilde{D}),|\mathbb{E}_{\rho \leftarrow \mathcal{P}_v}[SM_m(\rho ,\mathcal{P}_v) - SM_m(\rho ,\tilde{D})]|$ can be bounded by maximizing the statistical margin (Diochnos et al., 2018), requiring that the distribution $\mathcal{P}_v$ is separable. Specifically, the first term reveals that the statistical margin on the training set should be large, and the second term further requires that the statistical margin should be large on the (virtual) distribution. The last term $\mathbb{E}_y d(\mathcal{P}(\phi |y),\mathcal{P}_v(\phi |y))$ is bounded by the conditional distribution, i.e., Eq 4. Hence, the statistical margin elicited by Eq. 4 is bounded, leading to bounded generalization performance. + +# B. More Related work + +# B.1. Federated Learning + +Federated Learning (FL) is first proposed by (McMahan et al., 2017) as a distributed algorithm to protect users' data privacy while collaboratively training a global model. The heterogeneous data distribution across all clients severely damage the convergence of federated learning and final performance (Zhao et al., 2018; Li et al., 2020b; Kairouz et al., 2021; Tang et al., 2021). When training with the heterogeneous data, local and global models are much more unstable than centralized training (Karimireddy et al., 2020). And there exists a more severe divergence between local models of FL than that of distributed training with IID data (Li et al., 2020a; Karimireddy et al., 2020). This inconsistency is called client drift. + +To mitigate the client drift, hyper-parameters may need to be carefully adjusted (Wang et al., 2021), like learning rate and local training iterations, which directly decide how fast local model move and thus how far drift they could be. However, too small learning rate also means slower convergence. Thus, how to simultaneously achieve faster training speed and a more gentle client drift is important. To this end, many research works try to design more effective federated learning algorithms to address client drift problem. + +Model Regularization. This line of research focuses on adding regularization to calibrate the optimization direction of local models, restricting local models from being too far away from the server model. FedProx (Li et al., 2020a) adds a penalty of the L2 distance between local models to the server model. + +SCAFFOLD (Karimireddy et al., 2020) utilizes the history information to reduce the "client variance", thus decreasing the client drift. MOON (Li et al., 2021b) performs contrastive learning between the server model and client models, calibrating clients' learned representation. + +**Optimization Schemes.** From the optimization point of view, some methods propose to correct the updates from clients, accelerating and stabilizing the convergence. FedNova (Wang et al., 2020) propose to normalize the local updates to eliminate the inconsistency between the local and global optimization objective functions. (Hsu et al., 2019) proposes FedAvgM, which exploits the history updates of server model to avoid the overfits on the selected clients at current round. A recent work (Reddi et al., 2021) proposes FEDOPT, which generalizes the centralized optimization methods into FL scenario, like FedAdaGrad, FedYogi, FedAdam. + +Sharing Data. Because the original cause of client drift is the data heterogeneity, another line of research focuses on generating more data that carries some information of the natural data, and sharing them to all clients. It has been found that sharing a part of natural data could significantly benefit federated learning (Zhao et al., 2018), yet which sacrifices the privacy of clients' data. + +A series of works (Hardt & Rothblum, 2010; Hardt et al., 2012; Chatalic et al., 2021; Johnson et al., 2018; Cai et al., 2021) add noise on data queries to implement sharing data with privacy guarantee at some degree. In addition, sharing incomplete data is also a promising direction, where the generation process can be similar to (Yang et al., 2021). + +FD (Jeong et al., 2018) proposes to let clients collectively train a generative model to locally reproduce the data samples of all devices, augmenting their local data to become IID. G-PATE (Long et al., 2021) leverages GAN to generate data, with private aggregation among different discriminators to ensure privacy guarantees at some degree. (Goetz & Tewari, 2020) utilized the adversarial learning to generate data samples based on the raw data to help FL. + +Fed-ZDAC (Hao et al., 2021) utilize the intermedia activations and BN layer statistic of the raw data information to learn and share synthetic data. The profiles of the raw images could be still seen from the synthetic images, exposing the raw data information at a degree. XorMixFL (Shin et al., 2020) proposes to collect other clients' XOR-encoded data samples that are decoded only using each client's own data samples, also exposing raw data information to other clients. FedMIX (Yoon et al., 2021) proposes to let clients send and receive the averaged local data of each batch. Strictly speaking, this method exposes the statistic information of local data, i.e. the mean values. + +FedMD (Li & Wang, 2019), Cronus (Chang et al., 2019) and CCVR (Luo et al., 2021) transmit the logits information of data samples to enhance FL, which may expose the accurate high-level semantic information of raw data. + +FedDF (Lin et al., 2020) utilizes other data and conduct knowledge distillation based on these data, to transfer knowledge of models between server and clients. The most difference between FedDF and VHL is that our model will be directly trained on the virtual data, which is seen as a part of the new objective function. And VHL does not require the shared dataset to be meaningful and has transferability with raw data. + +Table 7. Demystifying different FL algorithms related to the sharing data. + +
Shared DataRelation with Private Raw DataObjective of the Algorithm
FD (Jeong et al., 2018)Synthetic DataGenerated Based on Raw DataServer Model Performance
G-PATE (Long et al., 2021)Synthetic DataGenerated Based on Raw DataServer Model Performance
(Goetz & Tewari, 2020)Synthetic DataGenerated Based on Local ModelServer Model Performance
Fed-ZDAC (Hao et al., 2021)Intermediate FeaturesFeatures of Raw DataServer Model Performance
XorMixFL (Shin et al., 2020)STAT. of raw Data-Server Model Performance
FedMIX (Yoon et al., 2021)STAT. of raw Data-Server Model Performance
FedMD (Li & Wang, 2019)logitsFeatures of Raw DataPersonalized FL
CCVR (Luo et al., 2021)logitsFeatures of Raw DataServer Model Performance
Cronus (Chang et al., 2019)Intermediate FeaturesFeatures of Raw DataDefend Poisoning Attack
FedDF (Lin et al., 2020)New DataHas Transferability with Raw DataServer Model Performance
VHL (ours)New DataNo limitationServer Model Performance
+ +Note: "STAT." means statistic information, like mean or standard deviation. + +Table 8. Comparisons with FedDF. + +
Non-IID DegreeFedAvgFedDF + realFedDF + noiseFedAvg + VHL
α = 0.162.2271.36-75.02
α = 1.076.0180.6946.983.13
+ +To highlight our novelty, we compare and demystify different FL algorithms related to the sharing data in Table 7. We would like to clarify that we are the first to raise and analyze the question of how to introduce virtual datasets (even pure noise) containing absolutely no private information to promote FL. Specifically, related works, i.e., the first 9 lines in Table 7, have risks of exposing private data, while the 10-th related work in Table 7, FedDF, requires a distribution similar to the private distribution, see Theorem 5.1 in the FedDF. In contrast, we consider arbitrary datasets with no private information. + +We omitted the comparison with works in Table 7, because of the above differences. Because FedDF does not expose the information of the raw data, we compare VHL with the FedDF. We have conducted experiments using the same settings as in FedDF. The results are listed in Table 8. For FedDF, the distribution similar to the private distribution (FedDF + real) improves the accuracy, while noise (FedDF + noise) degrades the accuracy. VHL could perform much better with the noise dataset. + +# B.2. Virtual Dataset + +Generative learning (Croce et al., 2020; Goodfellow et al., 2020; Karras et al., 2020) attains great progress in recent years, making it possible to synthesis images, texts or sound that cannot be distinguished from the real data. And the Unreal Engine (Qiu et al., 2017) or other advanced computer graphics techniques also could generate vivid virtual images. + +Recently, some researchers exploit the virtual datasets to tackle many problems in machine learning tasks. (Baradad et al., 2021) proposes that the neural networks could benefit from noise data. Specifically, the deep learning models pretrained on the noise data, are capable of generalizing well on real-world datasets. Apollo Synthetic Dataset (Huang et al., 2019) is a virtual dataset for training better autonomous driving models. (Miyato et al., 2018) exploits virtual labels for adversarial training. VHL plays as a role to connect the federated learning with the virtual dataset. + +# C. Details of Experiment Configuration + +# C.1. Hyper-parameters + +The learning rate configuration has been listed in Table 9. We report the best results and their learning rates (searched in $\{0.0001, 0.001, 0.01, 0.1\}$ ). + +And for all experiments, we use learning-rate decay of 0.992 per round. The batch size of the real data is set as 128, which also serves as the batch size of the virtual data. We use momentum-SGD as optimizers for all experiments, with momentum of 0.9, and weight decay of 0.0001. For different FL settings, when $K = 10$ or 100, and $E = 1$ , the maximum communication round is 1000. For $K = 10$ and $E = 5$ , the maximum communication round is 400 (due to the $E = 5$ increase the calculation cost). The number of clients selected for calculation is 5 per round for $K = 10$ , and 10 for $K = 100$ . + +Table 9. Learning rate of all experiments. + +
FedAvgFedProxSCAFFOLDFedNova
CIFAR-10a=0.1,E=1,K=10Baselines0.010.010.01
VHL0.010.010.01
a=0.05,E=1,K=10Baselines0.010.010.01
VHL0.010.010.01
a=0.1,E=5,K=10Baselines0.010.010.01
VHL0.010.010.01
a=0.1,E=1,K=100Baselines0.010.010.0001
VHL0.010.010.0001
FMNISTa=0.1,E=1,K=10Baselines0.010.010.01
VHL0.010.010.01
a=0.05,E=1,K=10Baselines0.010.010.0001
VHL0.010.010.0001
a=0.1,E=5,K=10Baselines0.010.010.01
VHL0.010.010.01
a=0.1,E=1,K=100Baselines0.010.010.001
VHL0.010.010.001
SVHNa=0.1,E=1,K=10Baselines0.010.010.01
VHL0.010.010.01
a=0.05,E=1,K=10Baselines0.010.010.01
VHL0.020.010.01
a=0.1,E=5,K=10Baselines0.010.0010.001
VHL0.010.0010.001
a=0.1,E=1,K=100Baselines0.0010.0010.0001
VHL0.0010.0010.0001
CIFAR-100a=0.1,E=1,K=10Baselines0.010.010.01
VHL0.010.010.01
a=0.05,E=1,K=10Baselines0.010.010.01
VHL0.10.010.01
a=0.1,E=5,K=10Baselines0.010.010.01
VHL0.010.010.01
a=0.1,E=1,K=100Baselines0.010.010,01
VHL0.010.010.01
+ +# C.2. Implementation + +We sample the virtual data along with the natural data together. Therefore, in each epoch, the number of sampled virtual data is the $B_v / B_d$ times as much as the natural data, in which $B_v$ and $B_d$ are batch sizes of virtual data and natural data respectively. + +We utilize the supervised contrastive loss (Khosla et al., 2020) to pull natural features toward the virtual features. In addition, to avoid that the virtual features moving towards the natural features, which may cause the homogeneous virtual features are biased by the natural features, we detach the virtual features before sending them into the supervised contrastive loss. + +# C.3. Generating Virtual Dataset + +We use $C_v$ to represent the number of classes of the virtual dataset. And $C_v = 10$ for 10-classes datasets, $C_v = 100$ for CIFAR-100 $^4$ . + +No matter which generating method we use, we sample noise from $C_v$ different Gaussian distributions with different means but the same standard deviation, representing different classes of the virtual data. The server collects the outputs of the StyleGAN-v2, and then distributes them to all clients at the beginning. Thus, there is no extra calculation of clients to generate datasets. + +For the upsampling from the pure noise, we firstly sample noise point as a $8 \times 8$ size image, and conduct upsampling to attain a $32 \times 32$ size image. Through upsampling, these noise images could form some color blocks, instead of pure noise points in the images. Thus, the client models could learn some basic vision features from them. + +For the simple CNN generator, we sample the 64-dim noises and feed them into the CNN. Then this simple generator outputs the $32 \times 32$ size images. This simple CNN consists of for transpose convolutional layers for upsampling and 3 convolutional layers for downsampling. Because an untrained simple CNN does not have enough output diversity, we use 10 CNNs with different initial weights, to generate the virtual dataset as the data of 10 different classes. + +We display these generated virtual datasets as Figure 4, 5, 6 and 7. One can see that different images of different labels are easy to be distinguished. And the images generated by Style-GAN of the same class are the most diverse. + +![](images/a3384f60d336573db62ef2568803006989604630b16b37f8447e469a17a0beb1.jpg) +Figure 4. Generated Virtual Data for CIFAR-10, FMNIST and SVHN. Each figure has 90 data samples of the same class. + +![](images/d59904a6f9efab46282e2bc3183de55e2bfcf5c01a378feb413af5544c3a489e.jpg) +Figure 5. Generated Virtual Data for CIFAR-100. Due to space limitation, we only show 10 out of 100 classes. + +We show all convergence curves in Figure 14, 15, 16 and 17. One can see that nearly all experiments could benefit convergence acceleration from VHL. + +![](images/bdc4765cba552c7b9bcf1228df60dc3af344bb74eb8a6bfd8bf6c732f537c317.jpg) +Figure 6. Generated Gaussian Noise with upsampling. + +![](images/fae16aac5b44f190e08204d39c8bdd15e095ee5ad8513d4543f4ec9ec1b30305.jpg) +Figure 7. Generated virtual dataset using ten simple decoders. + +# D. More Experiment Results and Discussion + +# D.1. Feature Shifts between Clients + +We show more t-SNE visualization of feature distribution between client models in Figure 8, 9 and 10, and them of the server model in Figure 11, 12 and 13. + +One can see that the clients can quickly learn to distinguish virtual data and attain the consensus on the feature expression of the virtual data of the same class (see Figure 9 (a) and Figure 10 (a)). Therefore, the subsequent local training based on the homogeneous virtual feature could benefit the consistent expression on the natural data. + +One interesting observation is that only training with the virtual data also benefits FL. And clients also can more quickly learn consistent feature expression though such Naive VHL than through FedAvg (see Figure 9 (c) and Figure 10 (c)). + +Another interesting finding is that, after local training, the features from one client are easily to be clustered together by t-SNE (see Figure 8 (a) and (b)), which means that these client models are greatly different. This happens even at the 999-th communication round for FedAvg (see Figure 8 (d)). + +![](images/163893cc9158d71720f73c21e4e5a3cc13e5b0960d17b5d97156ff5d2d5e4470.jpg) +(a) 9-th round. + +![](images/c2a20025965cd1706932eb2b2ecf9ca42f6a71420c101db2a151f8700586afeb.jpg) +(b) 99-th round. + +![](images/72250d334d4c1e8f0c4b28610ca0f577081d51aa83e958117e803389c666625b.jpg) +(c) 299-th round. + +![](images/80c594dab015f1206aff687899e5643513b660fa32717016bff072309c65054f.jpg) +(d) 999-th round. + +![](images/f60ff8270740868b326fa0e8c0d33cbbd897dc666d5caad5e35ce6367abc4c82.jpg) +(a) 9-th round. + +![](images/694d6480004a7904006cad677fc276b044bfbb0b97aded06efc2e80f574cce61.jpg) +Figure 8. Features of CIFAR10 test data of different client models without VHL. +(b) 99-th round. + +![](images/a663112e93b8e4907e2e3498a2113fca66c0cc8f63074330af06c658dd5cdbaf.jpg) +(c) 299-th round. + +![](images/897410a761c5870b2ce7d5fa0aa5479f042ba38bd0f66a43b602e5cf968ed0ec.jpg) +(d) at 999-th round. + +![](images/6cbb6cf86101b3d5bff8f8bb0e53219a3c064ba98fb40acd3a5ff637ec2fe2ab.jpg) +Figure 9. Features of CIFAR10 test data of different client models with Naive VHL. +(a) 9-th round. + +![](images/0f23165d9cb995924c7baf7b0fa8233e87709264eacf256e33fd47612f8c9e8e.jpg) +(b) 99-th round. + +![](images/00596c716807453b293c13523cbff60ad5b6c77181a71ba0f408666a724929a0.jpg) +(c) 299-th round. + +![](images/dbe62f691238089d5778a875e27e0988bbf5d8d1a3f94f6369f8ed83199136f6.jpg) +(d) at 999-th round. + +![](images/ab3e1ea2efa285a7eb3264b618c982dbc163a987f750a7b5ea8dca41863ae142.jpg) +Figure 10. Features of CIFAR10 test data of different client models with VHL. +(a) 9-th round. +Figure 11. Features of CIFAR10 test data of server model without VHL. + +![](images/c3abc8023b4f7356a1a588433b2d2efc32f5da23c5f65a2e4d5be56c4637e281.jpg) +(b) 99-th round. + +![](images/56c849c3f484e99e478372bc15415ec572521462b98dad1c247fdb2e84428afa.jpg) +(c) 299-th round. + +![](images/10c0eb08f903c980cf53f9e04ef741645b82790caaef35ce2c1e06419c495c7d.jpg) +(d) 999-th round. + +![](images/e4661e7eb6b460eab4f4bd72a2360b53befc068eb3d595cde572150917ef8646.jpg) +(a) 9-th round. + +![](images/df89ac8d7c156f5c7ae585318e6550fd4639b8490315d7c56a854bfe2ccb9164.jpg) +(b) 99-th round. + +![](images/ff40bd8ecfc1e22fac83cf8e378823a41a3d23586d9e8a78ddd369c685960244.jpg) +(c) 299-th round. + +![](images/d72ffcc8943609276232640a4db7cce89434a6e3afbd6b23f5df9b293e8f9dfc.jpg) +(d) at 999-th round. + +![](images/6a6b6415c770df176096a1ccb8b0930673beb8ccf6632f8b4308f20437f4b843.jpg) +(a) 9-th round. + +![](images/e353fea69152ec79f9f16220dd685457a35af081688711078a72e20306e17e9b.jpg) +Figure 12. Features of CIFAR10 test data of server model with Naive VHL. +(b) 99-th round. + +![](images/303c05c0b400caeeef88050063a85fe247d4227555934b3cf50c9202db4f7930.jpg) +(c) 299-th round. + +![](images/247827ba8f62ce5e11f75ea2d6c2f9c19d90bdbdd3966bfa32215413ad0380bd.jpg) +(d) at 999-th round. + +![](images/f43cd0ee3b7bbd62b4fe81ed14ba1018db3682ea7eeadb95af652da62d7c09c8.jpg) +Figure 13. Features of CIFAR10 test data of server model with VHL. +(a) $a = 0.1, K = 10, E = 1$ + +![](images/ca5928c412918f45f194c46e5443e10f04b188e7aaa4c434995ffade7591956b.jpg) +(b) $a = 0.1, K = 10, E = 5$ + +![](images/5f4fba0612a2d5515cf82e45860e20e3a7fcbf19f0287319e9dfdde0f409968e.jpg) +(c) $a = 0.1, K = 100, E = 1$ + +![](images/c5d5a9d06276d592a0e5b8fa22cb04fbd062542d795567fc9f2502cb243e9a4b.jpg) +(d) $a = 0.05, K = 10, E = 1$ + +![](images/72a2b1e4b88b37d407134cc22e7bcdf4c688eee02217beb0bfd1564f615d2bdf.jpg) +(a) $a = 0.1, K = 10, E = 1$ + +![](images/2f978035e1f311b7bf042d4609c3f9e41a02443398dc85683658a7e9e00ebd15.jpg) +Figure 14. Convergence comparison of CIFAR-10. +(b) $a = 0.1, K = 10, E = 5$ +Figure 15. Convergence comparison of FMNIST. + +![](images/7239c37f10ea179fd50d075222e535c0aef80bc74539c7420bb76590a0b812e5.jpg) +(c) $a = 0.1, K = 100, E = 1$ + +![](images/12dc7c9616a6625d9c61b0b2c3945d62181817ea38e13cfaca1220fbb5b080cb.jpg) +(d) $a = 0.05, K = 10, E = 1$ + +# D.2. More Facets of VHL + +We provide more comparisons of convergence trends of three experiments, including loading pretrained models (Figure 18 (a)), VHL with different batch size (Figure 18 (b)), training accuracy with VHL but different virtual data (Figure 18 (c)). + +Naive VHL. As summarized in Sec. 5.3, the naive VHL also could benefit FL. We discuss reasons of this in detail here. As pointed by (Luo et al., 2021; Yu et al., 2021), local training on local severe imbalanced dataset would lead to the severe preference of the classifier towards the local dominant classes. Due to this bias of classifier, the shallow layers of the model + +![](images/a0dc55331f0e3db673f5b393567ca69ba8a1daa19951108b27cd1629c916106e.jpg) +(a) $a = 0.1, K = 10, E = 1$ + +![](images/18e26670fa7a109151f1fc8ea48856369a875c1411810bcaa6ae036d298a2a75.jpg) +(b) $a = 0.1, K = 10, E = 5$ + +![](images/066ed402a6856fddf8c246c9ff0737fab4599a10ac89b92f7a951b96d4c5248d.jpg) +(c) $a = 0.1, K = 100, E = 1$ + +![](images/e66b11db59713417cb4117b1e90f24e6eab5086f585ffcc3a4b243459ab1fd2d.jpg) +(d) $a = 0.05, K = 10, E = 1$ + +![](images/2a0cb2f1fbde0c7498d9c5a06268584333be5b672bd2b60b7a6c9c39c95814ca.jpg) +(a) $a = 0.1, K = 10, E = 1$ + +![](images/e79facebed80d9b3422c9bbc411684cd3c2b82db5d739e680590f7aeb57862b1.jpg) +(b) $a = 0.1, K = 10, E = 5$ + +![](images/a7496149f2234d4a86b1cdb360ff1f874d83970456db9414e9672672385c291d.jpg) +Figure 16. Convergence comparison of SVHN. +(c) $a = 0.1, K = 100, E = 1$ + +![](images/5628fda90b76892ae854139f5acfd7819dee84907235bfa08045f2a51c9983b5.jpg) +(d) $a = 0.05, K = 10, E = 1$ +Figure 17. Convergence comparison of CIFAR100. + +cannot learn good representations of the raw data. Therefore, introducing more common virtual data could alleviate such imbalance situation, even these virtual data has no relationship with the raw data. And the vision information owned by the virtual data could help clients learn better feature extractor, like (Baradam et al., 2021). + +Batch Size of VHL. Similar with the contrastive learning (Khosla et al., 2020), because VHL needs to pull data of the same class together, the batch size impacts the effect of VHL. As shown in Table 6 and Figure 18 (b), larger batch size of virtual data improve both convergence and model performance. However, larger batch size means the extra calculation cost, which may be improved in the future. + +Using Realistic Data. To our surprise, using the Tiny-ImageNet as the virtual data to conduct VHL cannot outperform using the virtual noise data. According to the classic transfer learning (Pan & Yang, 2009; Baradad et al., 2021), transferring knowledge from the realistic data should benefit generalization performance better than from the virtual images that seem like noise (see Figure 4, 5, 6 and 7). We suspect the reason is that the Tiny-ImageNet is more difficult to be separated than the generated virtual dataset, leading to the inconsistent features of the Tiny-ImageNet. Then the calibration loses its effect. To validate this conjecture, We plot the training accuracy of the virtual dataset in Figure 18 (c). + +![](images/c36deae062fb95377f8be662854117c936522aa5ef41179494ec0a0f298146b2.jpg) +(a) Using Model Pretrained on Virtual (b) VHL with different $B_{v}$ of virtual dataset. Dataset. +Figure 18. Convergence of more experiments. + +![](images/fc9e4427a4626537ea94c092b7ec254c45294ada68b847edbac5b7068732920d.jpg) + +![](images/6469a68f0fb2edac0946266282c611012563c31ef9092eb37151a7bc12ef70fb.jpg) +(c) Training ACC. on Virtual Dataset. + +# D.3. Comparisons of Calculation Cost + +As mentioned in section 5.5, training on the virtual data causes the extra calculation cost. Thus, similar with comparing the convergence speed, we compare the total calculation cost of different algorithms to achieve the target accuracy in Table 10. It shows how many data samples that each algorithm needs to process to achieve the target accuracy. We use $N_{total}$ and $R_{total}$ + +Table 10. Calculation cost $(\times D_{data})$ to achieve the target accuracy. + +
Target ACCw/(w/o) VHLFedAvgFedProxSCAFFOLDFedNova
CIFAR-10a=0.1,E=1,K=10100without with143.5 12894 128145.5 90175.5 128
a=0.05,E=1,K=10100without with205.5 112100.5 151Nan NanNan 247
a=0.1,E=5,K=10100without with637.5 455Nan 1275165 225317.5 335
a=0.1,E=1,K=100100without with95.7 7784.2 6566.4 95.8Nan 110.8
FMNISTa=0.1,E=1,K=10100without with59.5 5267.5 3171.5 1441.5 52
a=0.05,E=1,K=10100without with212.5 5320.5 30Nan 58269 30
a=0.1,E=5,K=10100without with695 255Nan 370262.5 100482.5 255
a=0.1,E=1,K=100100without with65.8 87.249.1 56.6Nan NanNan Nan
SVHNa=0.1,E=1,K=10100without with125.5 75Nan 271Nan Nan125.5 75
a=0.05,E=1,K=10100without with178.5 94Nan 320Nan 147370.5 128
a=0.1,E=5,K=10100without with327.5 725Nan 1755Nan 1050405 375
a=0.1,E=1,K=100100without with61.8 72.461.8 71.264.3 193.6Nan 135.2
CIFAR-100a=0.1,E=1,K=10100without with248.5 384Nan 617383 294236 384
a=0.05,E=1,K=10100without with257 354Nan 482Nan NanNan 320
a=0.1,E=5,K=10100without with707.5 1635Nan Nan427.5 1455730 Nan
a=0.1,E=1,K=100100without with96.7 143.495.5 143.482.7 131.296.7 159.4
+ +to represent the number of processed samples and the number of communication rounds to achieve the target accuracy, $R_{total}$ are shown in Table 1, 2, 4 and 5. And the $D_{data}$ represents the total size of all datasets from clients. + +Note that for $E = 1$ and $K = 10$ setting, the $N_{total} = D_{data} \times R_{total} \times 0.5$ , as the server randomly selects 5 clients each round. For $E = 5$ and $K = 10$ setting, $N_{total} = D_{data} \times R_{total} \times 0.5 \times 5$ , as each client conducts 5 local epochs before communication. For $E = 1$ and $K = 100$ setting, $N_{total} = D_{data} \times R_{total} \times 0.1$ , as the server randomly selects 10 clients out of 100 clients each round. Because we sample virtual data with the same batch size as the natural data, the extra calculation cost is doubled for VHL. + +Table 10 shows that for most of cases, VHL needs to process similar or less number of data samples to attain the target test accuracy. However, for CIFAR-100 dataset, VHL shows more calculation cost. This trend aligns with the communication, i.e. VHL shows less performance gains on CIFAR-100. To address this problem, one may consider reducing the sampling size of virtual data. Or, we may explore more interesting properties of VHL to make it computation-friendly, like the VFA discussed in section 5.3. \ No newline at end of file diff --git a/virtualhomogeneitylearningdefendingagainstdataheterogeneityinfederatedlearning/images.zip b/virtualhomogeneitylearningdefendingagainstdataheterogeneityinfederatedlearning/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..2048e70f7a032996156e823468a1035cabe3671b --- /dev/null +++ b/virtualhomogeneitylearningdefendingagainstdataheterogeneityinfederatedlearning/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0a7aad5fb639f69c16723a29bd9820a2d336e59abfb94cfdbe575b95baded8b3 +size 3160812 diff --git a/virtualhomogeneitylearningdefendingagainstdataheterogeneityinfederatedlearning/layout.json b/virtualhomogeneitylearningdefendingagainstdataheterogeneityinfederatedlearning/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..af94044b4699cc4bedda16b0563ae63883c49776 --- /dev/null +++ b/virtualhomogeneitylearningdefendingagainstdataheterogeneityinfederatedlearning/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:71ae4a463608a0cdc024d88373069b6e5f67ad7668614983f26c1fc2b3bd668d +size 860829 diff --git a/visualattentionemergesfromrecurrentsparsereconstruction/1afe11ca-0f71-4a25-935e-f485a19e77a5_content_list.json b/visualattentionemergesfromrecurrentsparsereconstruction/1afe11ca-0f71-4a25-935e-f485a19e77a5_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..534a8b6b70070510fca860f138b580d2c608017b --- /dev/null +++ b/visualattentionemergesfromrecurrentsparsereconstruction/1afe11ca-0f71-4a25-935e-f485a19e77a5_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:af7c0027d522d05d572f97a9525d040e53847a7012ca19e62df9301e5330797c +size 106090 diff --git a/visualattentionemergesfromrecurrentsparsereconstruction/1afe11ca-0f71-4a25-935e-f485a19e77a5_model.json b/visualattentionemergesfromrecurrentsparsereconstruction/1afe11ca-0f71-4a25-935e-f485a19e77a5_model.json new file mode 100644 index 0000000000000000000000000000000000000000..493b2e769d75e440daab2530e932398d9f5426e7 --- /dev/null +++ b/visualattentionemergesfromrecurrentsparsereconstruction/1afe11ca-0f71-4a25-935e-f485a19e77a5_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dec0a744b8cae3990f4890ae738ddfc9212e7f735a206998597f2691d80a9a4d +size 134949 diff --git a/visualattentionemergesfromrecurrentsparsereconstruction/1afe11ca-0f71-4a25-935e-f485a19e77a5_origin.pdf b/visualattentionemergesfromrecurrentsparsereconstruction/1afe11ca-0f71-4a25-935e-f485a19e77a5_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..c9c228304b8fb05460e6b3c1b250f4ef504ab634 --- /dev/null +++ b/visualattentionemergesfromrecurrentsparsereconstruction/1afe11ca-0f71-4a25-935e-f485a19e77a5_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:38277cb9beeb41a553b36907b4dff4112a9ea7e2d54792c6374d3cbd637cd2ef +size 11196464 diff --git a/visualattentionemergesfromrecurrentsparsereconstruction/full.md b/visualattentionemergesfromrecurrentsparsereconstruction/full.md new file mode 100644 index 0000000000000000000000000000000000000000..328303a27d4ac9d148d9932518b54734ff70e7dc --- /dev/null +++ b/visualattentionemergesfromrecurrentsparsereconstruction/full.md @@ -0,0 +1,435 @@ +# Visual Attention Emerges from Recurrent Sparse Reconstruction + +Baifeng Shi 1 Yale Song 2 Neel Joshi 2 Trevor Darrell 1 Xin Wang 2 + +# Abstract + +Visual attention helps achieve robust perception under noise, corruption, and distribution shifts in human vision, which are areas where modern neural networks still fall short. We present VARS, Visual Attention from Recurrent Sparse reconstruction, a new attention formulation built on two prominent features of the human visual attention mechanism: recurrence and sparsity. Related features are grouped together via recurrent connections between neurons, with salient objects emerging via sparse regularization. VARS adopts an attractor network with recurrent connections that converges toward a stable pattern over time. Network layers are represented as ordinary differential equations (ODEs), formulating attention as a recurrent attractor network that equivalently optimizes the sparse reconstruction of input using a dictionary of "templates" encoding underlying patterns of data. We show that self-attention is a special case of VARS with a single-step optimization and no sparsity constraint. VARS can be readily used as a replacement for self-attention in popular vision transformers, consistently improving their robustness across various benchmarks. + +# 1. Introduction + +One of the hallmarks of human visual perception is its robustness under severe noise, corruption, and distribution shifts (Biederman, 1987; Bisanz et al., 2012). Although having surpassed human performance on ImageNet (He et al., 2015), convolutional neural networks (CNNs) are still far behind the human visual systems on robustness (Dodge & Karam, 2017; Geirhos et al., 2017) – CNNs are vulnerable under random image corruption (Hendrycks & Dietterich, 2019), adversarial perturbation (Szegedy et al., 2013), and distribution shifts (Wang et al., 2019; Djolonga et al., 2021). + +Vision transformers (Dosovitskiy et al., 2020) have been reported to be more robust to image corruption and distribution shifts than CNNs under certain conditions (Naseer et al., 2021; Paul & Chen, 2021). One hypothesis is that the self-attention module, a key component of vision transformers, helps improve robustness (Paul & Chen, 2021), achieving state-of-the-art performance on a variety of robustness benchmarks (Mao et al., 2021). Although the robustness of vision transformers still seems to be far behind human vision (Hendrycks et al., 2021a; Dodge & Karam, 2017), recent work suggests that attention is a key to achieving (perhaps human-level) robustness in computer vision. + +The cognitive science literature has also suggested a close relationship between attention mechanisms and robustness in human vision (Kar et al., 2019; Wyatte et al., 2012). For example, visual attention in human vision has been shown to selectively amplify certain patterns in the input signal and repress others that are not desired or meaningful, leading to robust recognition under challenging conditions such as occlusion (Tang et al., 2018), clutter (Mnih et al., 2014; Walther et al., 2005), and severe corruptions (Wyatte et al., 2014). These findings motivate us to improve robustness of neural networks by designing attention inspired by the human visual attention. However, despite the existing computational models of human visual attention (e.g., Li (2014)), their concrete instantiation in DNNs is still missing, and the connection between human visual attention and existing attention designs is also vague (Sood et al., 2020). + +In this work, we introduce VARS—Visual Attention from Recurrent Sparse reconstruction—a new attention formulation inspired by the concurrency and sparsity commonly observed in the human visual system. Human visual attention contains the process of grouping and selecting salient features while repressing irrelevant signals (Desimone & Duncan, 1995). One of its neural foundations is the recurrent connections between neurons in the same layer, as opposed to the feed-forward connections from lower to higher layers (Stettler et al., 2002; Gilbert & Wiesel, 1989; Bosking et al., 1997; Li, 1998; Lamme & Roelfsema, 2000). By iteratively connecting neurons, salient features with strong + +correlations are grouped and amplified (Roelfsema, 2006; O'Reilly et al., 2013). Sparsity, on the other hand, also plays an important role in visual attention, where distracting information is muted by the sparsity constraint and only the most salient parts of the input remains (Chaney et al., 2014; Wright et al., 2008). Sparsity is also a natural outcome of recurrent connections (Rozell et al., 2008), and the two together can be used to formulate visual attention. + +Built upon this observation, VARS shows that visual attention naturally emerges from a recurrent sparse reconstruction of input signals in deep neural networks. We start from an ordinary differential equation (ODE) description of neural networks and adopt an attractor network (Grossberg & Mingolla, 1987; Zucker et al., 1989; Yen & Finkel, 1998) to describe the recurrently connected neurons that arrive at an equilibrium state over time. We then reformulate the computation model into an encoder-decoder style module and show that by adding inhibitory recurrent connections between the encoding neurons, the ODE is equivalent to optimizing the sparse reconstruction of the input using a learned dictionary of "templates" encoding underlying data patterns. In practice, the feed-forward pathway of our attention module only involves optimizing the sparse reconstruction, which can be efficiently solved by the iterative shrinkage-thresholding algorithm (Gregor & LeCun, 2010). + +We present multiple variants of VARS by instantiating the learned dictionary in the sparse reconstruction as a static (input-independent), dynamic (input-dependent), or static+dynamic (combination of the two) set of templates. We show that the existing self-attention design (Vaswani et al., 2017), widely adopted in vision transformers, is a special case of VARS with a dynamic dictionary but only using a single step update of the ODE without sparsity constraints. VARS extends self-attention and exhibits higher robustness in practice. + +We evaluate VARS on five large-scale robustness benchmarks of naturally corrupted, adversarially perturbed and out-of-distribution images on ImageNet, where VARS consistently outperforms previous methods. We also assess the quality of attention maps on human eye fixation and image segmentation datasets, and show that VARS produces higher quality attention maps than self-attention. + +# 2. Related Work + +Recurrence in vision. Recurrent connections are as ubiquitous as feed-forward connections in the human visual system (Felleman & Van Essen, 1991). Various phenomena in human vision are credited to recurrence, such as visual grouping and pattern completion (Roelfsema et al., 2002; O'Reilly et al., 2013), robust recognition and segmentation under clutter (Vecera & Farah, 1997), and even perceptual + +illusions (Mély et al., 2018). + +In deep learning, Nayebi et al. (2018) find that convolutional recurrent models can better capture neural dynamics in the primate visual system. Other work has designed recurrent modules to help networks attend to salient features such as contours (Linsley et al., 2020), to group and segregate an object from its context (Kim et al., 2019; Darrell et al., 1990), or to conduct Bayesian inference of corrupted images (Huang et al., 2020). Zoran et al. (2020) combine an LSTM (Hochreiter & Schmidhuber, 1997) and self-attention to improve adversarial robustness. However, the LSTM is only used to generate the queries of self-attention and does not affect the attention mechanism itself. Instead, we show visual attention emerges from concurrency and can be formulated as a recurrent contractor network, which is equivalent to optimizing sparse reconstruction of the input signals. + +Sparsity in vision. It has long been hypothesized that the primary visual cortex (V1) encodes incoming stimuli in a sparse manner (Olshausen & Field, 1997). Olshausen & Field (1996) show that localized and oriented filters resembling the simple cells in the visual cortex can spontaneously emerge through dictionary learning via sparse coding. Some work has extended this hypothesis to the prestriate cortex such as V2 (Lee et al., 2007). Rozell et al. (2008) propose Locally Competitive Algorithms (LCA) as a biologically-plausible neural mechanism for computing sparse representations in the visual cortex based on neural recurrence. + +Recently there are studies on designing sparse neural networks, but they mostly focus on reducing the computational complexity via sparse weights or connections (Hoefler et al., 2021; Liu et al., 2019; Guo et al., 2018). Other work has exploited sparse data structure in neural networks (Wu et al., 2019; Fan et al., 2020). In this work, we draw a connection between sparsity and recurrence as well as visual attention and build a new attention formulation on top of it to improve the robustness of deep neural networks. + +Visual attention and robustness. Attention widely exists in human brains (Scholl, 2001) and is adopted in machine learning models (Vaswani et al., 2017). A number of studies focus on object-based and bottom-up attention. Various computational models have been proposed for visual attention (Koch & Ullman, 1987; Itti & Koch, 2001; Li, 2014), where neural recency help highlight salient features. + +In deep learning, the attention mechanism is widely used to process language or visual data (Vaswani et al., 2017; Dosovitskiy et al., 2020). The recently proposed self-attention based vision transformers (Dosovitskiy et al., 2020) can scale to large datasets better than conventional CNNs and achieve better robustness under distribution shifts (Mao et al., 2021; Naseer et al., 2021; Paul & Chen, 2021). + +In a complementary line of work to address model robust- + +![](images/731061a2358a8d07dfe5e99abf04f7f155093c5b5cec236286248913ba0c4805.jpg) +Figure 1. Illustrations on neural dynamics. (a) Feed-forward networks. The output $\mathbf{z}^{\ell -1}$ from the $(\ell -1)$ -th layer's neurons is processed by the feed-forward function $W^{\ell}$ into $W^{\ell}(\mathbf{z}^{\ell -1})$ , used as the input to the $\ell$ -th layer's neurons. The $\ell$ -th layer's neuron output $\mathbf{z}^{\ell}$ is identical to the input. (b) Recurrent networks. When the $\ell$ -th layer's neurons are recurrently connected, the output $\mathbf{z}^{\ell}$ is wired back by weight matrix $\mathbf{A}$ serving as an additional input to the neurons. The final output is the steady state $\mathbf{z}^{\ell^{*}} = \mathbf{A}\mathbf{z}^{\ell^{*}} + W^{\ell}(\mathbf{z}^{\ell -1})$ . (c) Recurrent networks as encoder-decoder. The neurons with recurrent connections in (b) have the same steady state as an encoder-decoder structure, where the auxiliary layer encodes $\mathbf{z}^{\ell}$ by $\mathbf{P}^T$ and its output is decoded by $\mathbf{P}$ and sent back. (d) Sparse recurrent networks. We adopt a sparse structure in the encoding by adding inhibitive recurrent connections $-\gamma (\mathbf{P}^T\mathbf{P} - \mathbf{I})$ between $\mathbf{u}^{\ell}$ . + +ness, researchers have shown that model robustness can be improved through data augmentation (Geirhos et al., 2018; Rebuffi et al., 2021), designing more robust model architectures (Dong et al., 2020) and training strategies (Madry et al., 2017; Wang et al., 2021b). Some other work (Machiraju et al., 2021; Shi et al., 2020) improves model robustness from a bio-inspired view. In this work, we propose a new attention design, (partially) inspired by human vision systems, which can be used as a replacement for self-attention in vision transformers to further improve model robustness. + +# 3. VARS Formulation + +In this section, we first formulate the neural recurrence based on an ODE description of neural dynamics (Section 3.1) and show its equivalence to optimizing the sparse reconstruction of the inputs (Section 3.2). Then we draw a connection between visual attention and recurrent sparse reconstruction and describe the design of VARS (Section 3.3). We find self-attention is a special case of VARS (Section 3.4) and give different model instantiations in Section 3.5. + +# 3.1. Neural Recurrence + +ODE descriptions of neural dynamics. We start with an ODE description of feed-forward neural networks (Dayan & Abbott, 2001). Let $\mathbf{z}^{\ell} \in \mathbb{R}^{d}$ denote the output of the $\ell$ -th layer's neurons in a neural network. In a feed-forward neural network, the output of the $\ell$ -th layer is + +$$ +\mathbf {z} ^ {\ell} = W ^ {\ell} \left(\mathbf {z} ^ {\ell - 1}\right), \tag {1} +$$ + +where $W^{\ell}(\cdot)$ is a feed-forward function (e.g., a convolutional or fully connected operator). This equation can be + +viewed as an equilibrium state $(\frac{\mathrm{d}\mathbf{z}^{\ell}}{\mathrm{d}t} = 0)$ of the following differential equation: + +$$ +\frac {\mathrm {d} \mathbf {z} ^ {\ell}}{\mathrm {d} t} = - \mathbf {z} ^ {\ell} + W ^ {\ell} \left(\mathbf {z} ^ {\ell - 1}\right), \tag {2} +$$ + +which defines the neural dynamics of $\ell$ -th layer's neurons. This can be seen as the (simplified) dynamics of biological neurons: $\mathbf{z}^{\ell}$ is the membrane potential which is charged by the feed-forward input $W^{\ell}(\mathbf{z}^{\ell -1})$ and discharged by the self leakage $-\mathbf{z}^{\ell}$ (Dayan & Abbott, 2001). Note that in the feed-forward case, the output $\mathbf{z}^{\ell}$ of the neurons is identical to the input $W^{\ell}(\mathbf{z}^{\ell -1})$ . Figure 1(a) provides an illustration. + +Horizontal recurrent connections. In the feed-forward case, the input $W^{\ell}(\mathbf{z}^{\ell -1})$ to the $\ell$ -th layer solely depends on the output $\mathbf{z}^{\ell -1}$ from the previous layer. However, when the neurons in the $\ell$ -th layer are recurrently connected (illustrated in Figure 1(b)), the input also depends on the $\ell$ -th layer's output $\mathbf{z}^{\ell}$ itself, which we denote by $\widetilde{W}^{\ell}(\mathbf{z}^{\ell -1},\mathbf{z}^{\ell})$ . Therefore, the output of a recurrently connected layer is the equilibrium state of an updated differential equation + +$$ +\frac {\mathrm {d} \mathbf {z} ^ {\ell}}{\mathrm {d} t} = - \mathbf {z} ^ {\ell} + \widetilde {W} ^ {\ell} \left(\mathbf {z} ^ {\ell - 1}, \mathbf {z} ^ {\ell}\right). \tag {3} +$$ + +In this case, the equilibrium $\mathbf{z}^{\ell^{*}} = \widetilde{W}^{\ell}(\mathbf{z}^{\ell -1},\mathbf{z}^{\ell^{*}})^{3}$ typically does not have a closed-form solution, and in practice the differential equation is often solved by rolling out each step of updates as in recurrent neural networks (RNNs) (e.g., Hochreiter & Schmidhuber (1997)) or by using root-finding techniques (Bai et al., 2019). + +Following the previous work by Li (2014), we decompose $\widetilde{W}^{\ell}(\mathbf{z}^{\ell - 1}, \mathbf{z}^{\ell})$ into a feed-forward input $W^{\ell}(\mathbf{z}^{\ell - 1})$ and an + +additional recurrent input $\mathbf{A}^{\ell}\mathbf{z}^{\ell}$ and rewrite Equation 3 as + +$$ +\frac {\mathrm {d} \mathbf {z} ^ {\ell}}{\mathrm {d} t} = - \mathbf {z} ^ {\ell} + \mathbf {A} ^ {\ell} \mathbf {z} ^ {\ell} + \mathbf {x} ^ {\ell} \tag {4} +$$ + +where $\mathbf{x}^{\ell} = W^{\ell}(\mathbf{z}^{\ell -1})$ is the feed-forward input of the neurons in the $\ell$ -th layer and $\mathbf{A}^{\ell}\in \mathbb{R}^{d\times d}$ , often assumed symmetric and positive semi-definite (Hopfield, 1984; Cohen & Grossberg, 1983), is the weight of horizontal recurrent connections of neurons in the $\ell$ -th layer (Figure 1(b)). Note that Equation 4 is also a special case of the continuous attractor neural network (Wu et al., 2016), which is used as a computational model for various neural behaviors such as visual attention (Li, 2014). In what follows, for simplicity and without loss of generality, we only focus on a single-layer scenario and omit the superscript $\ell$ . + +# 3.2. Recurrence Entails Sparse Reconstruction + +We have defined the neural recurrence in ODEs and now we build its connection to the optimization of sparse reconstruction to understand the functionality of recurrence. + +We notice that Equation 4 can also be viewed as an encoder-decoder structure. Since $\{\mathbf{A} \mid \mathbf{A} \in S_{+}^{d}\} = \{\mathbf{P}\mathbf{P}^{T} \mid \mathbf{P} \in \mathbb{R}^{d \times d^{\prime}}, d^{\prime} \geq d\}$ , we can reparameterize $\mathbf{A}$ as $\mathbf{P}\mathbf{P}^{T}$ , and turn Equation 4 into + +$$ +\frac {\mathrm {d} \mathbf {z}}{\mathrm {d} t} = - \mathbf {z} + \mathbf {P} \mathbf {P} ^ {T} \mathbf {z} + \mathbf {x}, \tag {5} +$$ + +which has the same steady state solution as + +$$ +\left\{ \begin{array}{l} \frac {\mathrm {d} \mathbf {z}}{\mathrm {d} t} = - \mathbf {z} + \mathbf {P} \mathbf {u} + \mathbf {x}, \\ \frac {\mathrm {d} \mathbf {u}}{\mathrm {d} t} = - \mathbf {u} + \mathbf {P} ^ {T} \mathbf {z}. \end{array} \right. \tag {6} +$$ + +Here, we introduce an auxiliary layer $\mathbf{u} \in \mathbb{R}^{d'}$ that receives input $\mathbf{P}^T\mathbf{z}$ and converges to $\mathbf{u}^* = \mathbf{P}^T\mathbf{z}^*$ . Meanwhile $\mathbf{z}$ converges to $\mathbf{z}^* = \mathbf{P}\mathbf{u}^* + \mathbf{x}$ . We can view the steady state solution as an equilibrium between an encoder and a decoder, where the column vectors of $\mathbf{P}$ serve as atoms (or "templates") of a dictionary, $\mathbf{u}^*$ is the encoding of $\mathbf{z}^*$ through the template matching $\mathbf{P}^T\mathbf{z}^*$ , and $\mathbf{z}^* = \mathbf{P}\mathbf{u}^* + \mathbf{x}$ is the decoding of $\mathbf{u}^*$ plus a residual connection $\mathbf{x}$ . (Figure 1(c)). + +Next, we show that this encoder-decoder structure naturally connects with the hypothesis of sparse coding in V1, which states that the encoding of visual signals should be sparse (Olshausen & Field, 1997). Moreover, sparsity naturally emerges as we build the inhibitive recurrent connections between the encoding neurons ( $\mathbf{u}$ in our case) (Rozell et al., 2008). Specifically, the encoding is sparse when there exists mutual inhibition between neurons that encode the similar feature and mutual excitation between neurons that encode different features. To show this, we follow Rozell et al. (2008) and add recurrent connections between $\mathbf{u}$ , mod + +eled by the weight matrix $-\gamma (\mathbf{P}^T\mathbf{P} - \mathbf{I})$ . In addition, we add hyperparameters $\alpha$ and $\beta$ to control the strength of self-leakage, and the element-wise activation functions $g(\cdot)$ to gate the output from the neurons (Dayan & Abbott, 2001). As a result, we update the dynamics of $\mathbf{z}$ and $\mathbf{u}$ as (see also Figure 1(d)): + +$$ +\left\{ \begin{array}{l} \frac {\mathrm {d} \mathbf {z}}{\mathrm {d} t} = - \alpha \mathbf {z} + \mathbf {P} g (\mathbf {u}) + \mathbf {x}, \\ \frac {\mathrm {d} \mathbf {u}}{\mathrm {d} t} = - \beta \mathbf {u} - \gamma \left(\mathbf {P} ^ {T} \mathbf {P} - \mathbf {I}\right) g (\mathbf {u}) + \mathbf {P} ^ {T} \mathbf {z}. \end{array} \right. \tag {8} +$$ + +By taking $\alpha = 1$ and $\beta = \gamma = 2$ and choosing $g$ as an element-wise thresholding function $g(\mathbf{u}_i) = sgn(\mathbf{u}_i)\cdot (|\mathbf{u}_i| - \frac{\lambda}{2})_+$ , where $sgn(\cdot)$ is the sign function, $(\cdot)_+$ is ReLU, and $\lambda$ controls the sparsity constraint (see Appendix for more details), Equation 8-9 have the equilibrium state as + +$$ +\left\{ \begin{array}{l} \widetilde {\mathbf {u}} ^ {*} = \underset {\widetilde {\mathbf {u}} \in \mathbb {R} ^ {d ^ {\prime}}} {\arg \min } \frac {1}{2} \left| \left| \mathbf {P} \widetilde {\mathbf {u}} - \mathbf {x} \right| \right| _ {2} ^ {2} + \lambda \left| \left| \widetilde {\mathbf {u}} \right| \right| _ {1}, \\ \mathbf {z} ^ {*} = \mathbf {P} \widetilde {\mathbf {u}} ^ {*} + \mathbf {x}, \end{array} \right. \tag {10} +$$ + +where $\widetilde{\mathbf{u}} = g(\mathbf{u})$ is the gated output of the encoding neurons. We can see that by adding the recurrent connections in $\mathbf{u}$ and the activation functions $g(\cdot)$ , the output of $\ell$ -th layer's neurons is not only a simple "copy-paste" of the feed-forward input $\mathbf{x}$ (Equation 1) but also with a sparse reconstruction of the input $\mathbf{P}\widetilde{\mathbf{u}}^*$ . This formulation also indicates that solving the dynamics of a sparse recurrent network is equivalent to sparse reconstruction of the input signal. + +# 3.3. VARS: Attention from Sparse Reconstruction + +The core design of VARS is based on the observation that visual attention is achieved through (i) grouping different features and different locations into separate objects and (ii) selecting the most salient objects and suppressing distracting or noisy ones (Desimone & Duncan, 1995). Note that the dynamics of sparse encoding $\mathbf{u}$ (Equation 9) contains a similar process, where the features in $\mathbf{z}$ are grouped by each template $\mathbf{P}^{\mu}$ through $(\mathbf{P}^{\mu})^{T}\mathbf{z}$ and fed into the encoding $\mathbf{u}_{\mu},$ meanwhile the recurrent term $-\gamma (\mathbf{P}^T\mathbf{P} - \mathbf{I})g(\mathbf{u})$ imposes a sparse structure on $\mathbf{u}$ so that only the $\mathbf{u}_{\mu}$ that encodes the most salient template objects will survive. + +Here we introduce VARS, a module that achieves visual attention via sparse reconstruction following the formulation in Equation 10-11, i.e., VARS takes a feed-forward input $\mathbf{x}$ and outputs the sparse reconstruction $\mathbf{P}\widetilde{\mathbf{u}}^*$ of $\mathbf{x}$ and a + +![](images/016fa8f7bbb4e7537f781fe460d6f096f340aaaa921a50359616b90fe939dba6.jpg) +Figure 2. Overview of VARS. First, we initialize $\widetilde{\mathbf{u}}$ as $\mathbf{P}^T\mathbf{x}$ , the encoding of the input. Then, for each iteration, we update $\widetilde{\mathbf{u}}$ to minimize the reconstruction error between $\mathbf{x}$ and the decoded $\mathbf{P}\widetilde{\mathbf{u}}$ , as well as the sparsity constraint. After multiple steps, the converged $\widetilde{\mathbf{u}}^*$ is decoded and output together with a residual term. + +residual term. The VARS module can be plugged into neural networks to help attend features. + +In practice, VARS optimizes the sparse reconstruction (Equation 10) iteratively, as illustrated in Figure 2. First, we initialize $\widetilde{\mathbf{u}}$ as the encoding of input $\mathbf{x}$ , i.e., $\widetilde{\mathbf{u}} \gets \mathbf{P}^T\mathbf{x}$ (the red block in Figure 2). Then, for each iteration, we decode $\widetilde{\mathbf{u}}$ into $\mathbf{P}\widetilde{\mathbf{u}}$ (the green block in Figure 2) and update $\widetilde{\mathbf{u}}$ by minimizing the reconstruction error $\frac{1}{2}||\mathbf{P}\widetilde{\mathbf{u}} - \mathbf{x}||_2^2$ and the sparsity constraint $\lambda ||\widetilde{\mathbf{u}} ||_1$ . We adopt the update rule in the Learned Iterative Shrinkage Thresholding Algorithm (LISTA) (Gregor & LeCun, 2010), i.e., each update is + +$$ +\widetilde {\mathbf {u}} \leftarrow \mathcal {S} _ {\frac {w _ {1} \cdot \lambda}{w _ {2} \cdot L}} \left(\widetilde {\mathbf {u}} - \frac {1}{w _ {2} \cdot L} \left(\mathbf {T} ^ {T} \mathbf {P} ^ {T} \mathbf {P} \boldsymbol {\Gamma} \widetilde {\mathbf {u}} - \mathbf {P} ^ {T} \mathbf {x}\right)\right), \tag {12} +$$ + +where $S_{\lambda}(x) = \operatorname{sgn}(x) \cdot (|x| - \lambda)_+$ is an element-wise thresholding function, and $L$ is the largest singular value of $\mathbf{P}^T\mathbf{P}$ . $w_1, w_2 \in \mathbb{R}$ and $\Gamma \in \mathbb{R}^{d' \times d'}$ are learned parameters so that after several iterations of Equation 12 the output is close to the sparse reconstruction. After multiple updates, we decode the converged $\widetilde{\mathbf{u}}^*$ into $\mathbf{P}\widetilde{\mathbf{u}}^*$ and output it together with a residual term. + +Overall, VARS groups features of different objects in the input into different encoding neurons, and the most salient objects (e.g., "0" in the input in Figure 2) are preserved while other distractors are suppressed by sparse reconstruction. VARS can be easily plugged into any neural network and is computationally efficient thanks to the LISTA algorithm with fast convergence (see Section 4). + +# 3.4. Self-Attention as a Special Case of VARS + +Here we show that self-attention can be viewed as a special case of VARS using a dynamic instantiation of the dictionary + +with single step approximation and no sparsity constraint. + +Self-attention formulation. In self-attention, the input $\mathbf{X} \in \mathbb{R}^{N \times C}$ contains $N$ tokens and $C$ channels. We use the superscript $\mu$ for the channel index and the subscript $i$ for the token index, e.g., $\mathbf{X}_i^\mu$ is the $\mu$ -th channel in the $i$ -th token. In each head, self-attention gives the output $\mathbf{Z}$ by + +$$ +\mathbf {Z} _ {i} ^ {\mu} = \sum_ {j} \mathbf {K} (\mathbf {X}, \mathbf {X}) _ {i j} \cdot \mathbf {X} _ {j} ^ {\mu} + \mathbf {X} _ {i} ^ {\mu}, \tag {13} +$$ + +where $\mathbf{K}(\mathbf{X},\mathbf{X})\in \mathbb{R}^{N\times N}$ measures the similarity between tokens in $\mathbf{X}$ , i.e., $\mathbf{K}(\mathbf{X},\mathbf{X})_{ij} = e^{(\mathbf{W}\mathbf{X}_i)^T (\mathbf{W}'\mathbf{X}_j)}$ , with $\mathbf{W}$ and $\mathbf{W}'$ as query and key projections. Self-attention is compute intensive given its quadratic computational complexity. Performer (Choromanski et al., 2020), a recently proposed variant of vision transformers, approximates the similarity kernel with the inner product of the feature maps, i.e., $\mathbf{K}(\mathbf{X},\mathbf{X})\approx \Phi (\mathbf{X})\Phi '( \mathbf{X})^T$ , where $\Phi (\mathbf{X}),\Phi^{\prime}(\mathbf{X})\in$ $\mathbf{R}^{N\times C'}$ are specific (random) feature maps of $\mathbf{X}$ . + +Connection between self-attention and VARS. Following the formulation in Performer, we can rewrite Equation 13 as + +$$ +\mathbf {Z} ^ {\mu} = \Phi (\mathbf {X}) \Phi (\mathbf {X}) ^ {T} \mathbf {X} ^ {\mu} + \mathbf {X} ^ {\mu}. \tag {14} +$$ + +Here we use a symmetric similarity kernel by setting $\mathbf{W} = \mathbf{W}'$ , which means $\Phi = \Phi'$ . This feed-forward computation is a single-step Euler update7 of the differential equation + +$$ +\frac {\mathrm {d} \mathbf {Z} ^ {\mu}}{\mathrm {d} t} = - \mathbf {Z} ^ {\mu} + \Phi (\mathbf {X}) \Phi (\mathbf {X}) ^ {T} \mathbf {Z} ^ {\mu} + \mathbf {X} ^ {\mu}, \tag {15} +$$ + +which has a similar form with the ODE description of a recurrent layer (Equation 5), except that Equation 15 uses $\Phi(\mathbf{X})$ as the dictionary which is dependent on the specific input $\mathbf{X}$ while Equation 5 uses a static dictionary $\mathbf{P}$ learned from the entire dataset. This shows self-attention is a variant of recurrent networks using a dynamic dictionary. See Appendix ?? for the visualization of the dynamic dictionary. + +However, compared to VARS (Equation 10-11), self-attention (Equation 15) does not have the inhibitive recurrent connections (Equation 9) to turn into sparse reconstruction, and updates the ODE (Equation 15) only via a single step. Therefore, we introduce VARS with a dynamic dictionary: + +$$ +\left\{ \begin{array}{l} \widetilde {\mathbf {U}} ^ {\mu^ {*}} = \underset {\widetilde {\mathbf {U}} ^ {\mu}} {\arg \min } \frac {1}{2} \left| \left| \Phi (\mathbf {X}) \widetilde {\mathbf {U}} ^ {\mu} - \mathbf {X} ^ {\mu} \right| \right| _ {2} ^ {2} + 2 \lambda \left| \left| \widetilde {\mathbf {U}} ^ {\mu} \right| \right| _ {1} \\ \mathbf {Z} ^ {\mu^ {*}} = \Phi (\mathbf {X}) \widetilde {\mathbf {U}} ^ {\mu^ {*}} + \mathbf {X} ^ {\mu}, \end{array} \right. \tag {16} +$$ + +which optimizes the sparse reconstruction of each channel $\mathbf{X}^{\mu}$ in the input. We refer VARS with a static dictionary to as VARS-S (Equation 10-11) and VARS with an dynamic dictionary as VARS-D (Equation 16-17). + +Table 1. Dataset overview. We evaluate VARS on five robustness benchmarks and perform evaluation in three additional settings. + +
Dataset NameType
RobustnessImageNet-C (IN-C) (Hendrycks & Dietterich, 2019)Natural corruption
ImageNet-R (IN-R) (Hendrycks et al., 2021a)Out of distribution
ImageNet-SK (IN-SK) (Wang et al., 2019)Out of distribution
PGD (Madry et al., 2017)Adversarial attack
ImageNet-A (IN-A) (Hendrycks et al., 2021b)Natural adv. example
OthersPACS (Li et al., 2017)Domain generalization
PASCAL VOC (Everingham et al., 2010)Semantic segmentation
MIT1003 (Judd et al., 2009)Human eye fixation
+ +# 3.5. VARS Instantiations + +Dictionary designs. So far, we introduced two instantiations of VARS: VARS with a static dictionary $\mathbf{P}$ (VARS-S) (Equation 10-11) and VARS with a dynamic dictionary $\Phi(\mathbf{X})$ (VARS-D) (Equation 16-17). Both variants have their own merits as $\mathbf{P}$ learns a general pattern of the dataset while $\Phi(\mathbf{X})$ captures the specialized information on a per input basis. Therefore, we consider a third instantiation of VARS, VARS-SD to combine both the static and dynamic dictionaries using the union of atoms in $\mathbf{P}$ and $\Phi(\mathbf{X})$ denoted as $[\mathbf{P};\Phi(\mathbf{X})]$ . We use all three variants in our experiments. + +Instantiation of $\mathbf{P}$ . In theory, $\mathbf{P}$ can be any real matrix of the specific shape. However, since each column of $\mathbf{P}$ is a template which is a signal in the spatial feature domain, we may impose certain inductive biases such as translational symmetry when instantiating $\mathbf{P}$ . To this end, we design $\mathbf{P}$ by making its templates kernels with different translations, which means $\mathbf{P}^T$ is a convolution layer, i.e., $(\mathbf{P}^T\mathbf{x})_\uparrow = conv(\mathbf{x}_\uparrow)$ where $(\cdot)_\uparrow$ unflattens a vector into a 2D signal. Then $\mathbf{P}$ is a deconvolution layer with its kernel shared with the convolution layer, used in both static and static+dynamic dictionaries. + +# 4. Experiments + +We test VARS on five robustness benchmarks on the ImageNet dataset including naturally corrupted, out of distribution, and adversarial images (Section 4.1). We also evaluate our models on the following settings: domain generalization (Section 4.2), image segmentation, and human eye fixation predictions (Section 4.3). Finally, we analyze and ablate the design choices of VARS in Section 4.4. + +Experimental Setup. We evaluate on multiple datasets (Table 1) and the models are pretrained on ImageNet-1K (Deng et al., 2009). For baselines, we consider DeiT (Touvron et al., 2021), a commonly-used vision transformer model, and RVT (Mao et al., 2021), the state-of-the-art vision transformer on various robustness benchmarks. For generality, we also test on GFNet (Rao et al., 2021) using a linear token-mixer instead of self-attention. We apply VARS in the baselines by replacing the global operators (self-attention or token mixer). For all the models, we adopt the convolutional + +![](images/3703f27214fe5dbd2eaf61dda1bd8cfcb150d4200caabbfd0c6e7a6eea8a4771.jpg) +Figure 3. Attention maps under image corruption. We can see VARS consistently highlights the core parts of the object (airplane) while self-attention can miss them (e.g., weather). The attention maps of VARS-SD are most stable and sharp. + +patch-embedding (Xiao et al., 2021) to facilitate training and also apply Performer approximation which VARS is also built on. We use $*$ to denote the modified baselines. Results of both original and modified baselines are reported. + +# 4.1. Evaluation on Robustness Benchmarks + +We show the evaluation results on the robustness benchmarks in Table 2. First, we can see vision transformers are generally more robust than the CNN counterparts even with an order of magnitude smaller numbers of parameters and FLOPs. We can also observe that VARS consistently improves the baselines across different benchmarks. For example, compared to DeiT, VARS-SD reduces the error rate from $67\%$ to $62.5\%$ on IN-C and improves the accuracy from $34.5\%$ to $40.2\%$ on IN-R, from $21.7\%$ to $27.5\%$ on IN-R, which are over 5 absolute points improvements. Similar results are observed with GFNet and RVT. + +Moreover, when built on top of the RVT network design, VARS-SD outperforms or is on par with the previous methods across the five benchmarks. Note that VARS is built upon $\mathrm{RVT}^*$ , the modified version of RVT (see Experimental Setup). As shown in Table 2, $\mathrm{RVT}^*$ has weaker initial performance than the vanilla RVT model, mainly due to the Performer approximation of the self-attention. + +In Figure 3, we visualize the attention maps of self-attention and VARS-S, -D, -SD under different image corruption scenarios. We see that for a clean image, all the attention designs can roughly locate salient regions around the main object (airplane). However, self-attention only highlights the center part of the object while VARS-SD and VARS-D capture the contour of the object more clearly. For cor + +Table 2. Evaluation results on robustness benchmarks. We find that VARS consistently improves over the self-attention counterparts (DeiT*, GFNet* and RVT*). VARS-SD outperforms or is on par with previous methods despite using a weaker initial model. The best performance of each vision transformer architecture is bold and the underlined values are the overall state-of-the-art performance. + +
ModelGFLOPsParams.(M)Clean↑IN-C↓IN-R↑IN-SK↑PGD↑IN-A↑
CNNsRegNetY-4GF (Radosavovic et al., 2020)4.020.679.268.738.825.92.48.9
ResNet50 (He et al., 2016)4.125.679.065.542.531.512.55.9
ResNeXt50-32x4d (Xie et al., 2017)4.325.079.864.741.529.313.510.7
InceptionV3 (Szegedy et al., 2016)5.727.277.480.638.927.63.110.0
TransformersPiT-Ti (Heo et al., 2021)0.74.972.969.134.621.65.16.2
ConViT (d'Ascoli et al., 2021)1.45.773.368.435.222.47.58.9
PVT (Wang et al., 2021a)1.913.275.079.633.921.50.57.9
DeiT (Touvron et al., 2021)1.35.772.271.132.620.26.27.3
GFNet (Rao et al., 2021)1.37.574.665.940.427.07.66.3
RVT (Mao et al., 2021)1.38.678.458.243.730.011.713.3
DeiT*1.35.774.767.034.521.711.99.4
w/ VARS-S1.06.873.769.836.824.810.84.9
w/ VARS-D1.45.475.664.939.627.513.710.2
w/ VARS-SD1.45.876.562.540.227.513.411.5
GFNet-Ti*1.37.574.665.940.427.07.66.3
w/ VARS-S1.37.574.163.540.828.69.55.8
w/ VARS-D1.99.877.858.641.229.015.912.6
w/ VARS-SD1.910.478.257.441.029.516.213.0
RVT*1.38.677.660.441.728.711.111.1
w/ VARS-S1.09.276.861.843.230.17.69.1
w/ VARS-D1.28.078.258.742.029.811.712.4
w/ VARS-SD1.59.278.458.342.530.511.413.4
+ +Table 3. Evaluation of domain generalization on PACS. Our VARS-SD outperforms the baseline RVT* and other variants. + +
TargetPhotoSketchCartoonArt
RVT*94.1981.7379.7881.25
VARS-S93.8982.6280.1681.49
VARS-D96.2980.4080.3384.77
VARS-SD96.4782.7880.9886.08
+ +rupted images, we observe that attention maps from vanilla self-attention tend to be noisier than VARS. For example, with severe weather corruption (the last row), self-attention misses the main object and rather highlights the snow effect, while VARS-SD still captures the object and suppresses the noise. We also notice that VARS-S tend to produce a blurrier attention map compared to the ones with a dynamic dictionary, which might be due to the weaker expressivity of static dictionary compared to the dynamic dictionary. + +# 4.2. Evaluation on Domain Generalization + +Domain generalization is a related setting, which evaluates the models' generalization to unseen domains at test time. Here we finetune the ImageNet-pretrained models on three source domains in PACS (Li et al., 2017) and test them on the left-out target domain. + +Table 3 shows that VARS-SD outperforms the RVT baseline across all four target domains. Specifically, VARS-SD improves RVT* from $81.25\%$ to $86.08\%$ on the Art domain and from $94.19\%$ to $96.47\%$ on the Photo domain. These results indicate that our attention module is more robust than self-attention when generalizing to unseen domains. + +Table 4. Segmentation evaluation on PASCAL VOC using attention maps. Our VARS-SD improves the mean IOU score of the baseline RVT* and is more selective (higher FN scores). + +
RVT*VARS-SVARS-DVARS-SD
mIoU↑39.9243.3342.0344.15
FP↓49.4123.1125.2329.28
FN↓3.9512.0811.778.76
+ +# 4.3. Evaluation on Segmentation and Eye Fixation + +Attention as coarse image segmentation. Recently, self-supervised vision transformers (Caron et al., 2021) have been shown to produce attention maps that are similar to the semantic segmentation of foreground objects. Following Caron et al. (2021), we evaluate RVT* with self-attention and VARS on the validation set of PASCAL VOC 2012 using the model trained on ImageNet-1K. To obtain a segmentation map, we normalize an attention map from the global average of tokens to [0, 1] and use a threshold 0.3 to distinguish foreground objects from the background (class agnostic). The main evaluation metric is mean IoU which evaluates the overlapping area between a predicted segmentation map and the ground truth. We also consider false positive (FP) and false negative (FN) rates as metrics. + +Table 4 shows that all three variants of VARS achieve higher mean IoU compared to the self-attention counterpart RVT*, where VARS-SD improves the score from $39.92\%$ to $44.15\%$ . Also, the FP rate is substantially reduced by our attention framework, indicating that VARS can effectively filter out distracting information and preserve only the relevant information about the foreground objects. Another + +Table 5. Evaluation on human eye fixations. Here our VARS-S achieves the highest score while all variants outperforms RVT*. + +
MetricRVT*VARS-SVARS-DVARS-SD
NSS0.5020.7370.6320.678
+ +![](images/dbd757b09fdfe4f8477a254a685684cf3f5aaf9698559d5b4bbee6509989aa00.jpg) +Figure 4. Visualization on eye fixation. VARS' attention maps are more consistent with human eye fixation than self-attention's. + +observation is that VARS has a higher FN rate, suggesting VARS is more selective than self-attention and emphasize more on the core parts of the objects. + +Alignment with human eye fixations. Since human eye fixation is under the guidance of bottom-up attention (Li, 2014), here we investigate how close our attention maps are to the human eye fixation maps. Here we evaluate the ImageNet-pretrained RVT with self-attention and VARS on MIT1003 (Judd et al., 2009), containing 1K natural images with eye fixation maps collected from 15 human observers. We adopt the metric of normalized scanpath saliency (NSS) (Peters et al., 2005) that measures an average of normalized attention value at fixated positions. + +Table 5 shows that RVT with VARS achieves higher NSS scores than RVT with self-attention (i.e., $\mathrm{RVT^{*}}$ ), aligning better with the human eye fixations data. Figure 4 shows the attention maps captured from humans and generated by the models. We notice that VARS predicts regions that are more closely aligned with human attention, while self-attention tend to highlight irrelevant background regions. + +# 4.4. Analysis and Ablation Study + +Recurrent refinement of attention. VARS performs recurrent sparse reconstruction of the inputs in an iterative manner. In Figure 5, we visualize the attention maps VARS-S on ImageNet validation samples at different updating steps. We can see that VARS refines the attention maps through recurrent updates, i.e., the attention maps become more focused on the core parts of the objects while suppressing the background and other distracting objects. + +Number of recurrent updates. Figure 6 (left) shows the accuracy on ImageNet-C over different number of updates $k$ . We find that the model has a similar performance between + +![](images/6f771b1b14a9bed20bc91cb2020837fddca03ce2a7ad20c5022bdba4d5af0390.jpg) +Figure 5. Recurrent refinement of attention maps. VARS refines the attention maps iteratively during the recurrent updates. + +![](images/538847722b22762ba58bb69ddd4a1fad6a9cc1f0ae62edc2f865281d2baf1c99.jpg) +Figure 6. Hyperparameter analysis. We study the number of updates (left) and the level of sparse regularization (right) in sparse reconstruction. VARS performs similarly with 3 to 5 iteration steps and we choose 3 for better efficiency. VARS is not sensitive to the level of sparse regularization and we use 0.3 in the experiments. + +$k = 3$ and 5 with a drop of performance at $k = 1$ and 7. We choose $k = 3$ in our experiments for efficiency. + +Strength of sparse constraints. Figure 6 (right) shows the accuracy over different $\lambda$ values that determine the level of sparse regularization during the reconstruction of input. We observe that the curves are relatively flat which indicates VARS is not very sensitive to the strength of the sparse regularization. We adopt $\lambda = 0.3$ in our experiments which has a slightly better performance than the other values. + +# 5. Conclusion + +We introduced a new attention formulation—Visual Attention from Recurrent Sparse reconstruction (VARS)—which takes inspiration from the robustness characteristics of human vision. We observed a connection among visual attention, recurrence, and sparsity and showed that contemporary attention models can be derived from recurrent sparse reconstruction of input signals. VARS adopts an ODE based formulation to describe neural dynamics; equilibrium states are solved by iteratively optimizing the sparse reconstruction of input. We showed that self-attention is a special case of VARS with approximate neural dynamics and no sparsity constraints. VARS is a general attention module that can be plugged into vision transformers, replacing the self-attention module, offering improved performance. We conducted extensive evaluation on five robustness bench + +marks and three additional datasets of related settings to understand the properties of VARS. We found VARS increases model robustness with improved quality of attention maps across various datasets and settings. + +# Acknowledgement + +Baifeng Shi, Trevor Darrell, and Xin Wang are supported by DARPA and/or the BAIR Commons program. + +# References + +Bai, S., Kolter, J. Z., and Koltun, V. Deep equilibrium models. arXiv preprint arXiv:1909.01377, 2019. +Biederman, I. Recognition-by-components: a theory of human image understanding. Psychological review, 94 (2):115, 1987. +Bisanz, J., Bisanz, G. L., and Kail, R. Learning in children: Progress in cognitive development research. Springer Science & Business Media, 2012. +Bosking, W. H., Zhang, Y., Schofield, B., and Fitzpatrick, D. Orientation selectivity and the arrangement of horizontal connections in tree shrew striate cortex. Journal of neuroscience, 17(6):2112-2127, 1997. +Caron, M., Touvron, H., Misra, I., Jégou, H., Mairal, J., Bojanowski, P., and Joulin, A. Emerging properties in self-supervised vision transformers. arXiv preprint arXiv:2104.14294, 2021. +Chaney, W., Fischer, J., and Whitney, D. The hierarchical sparse selection model of visual crowding. Frontiers in integrative neuroscience, 8:73, 2014. +Choromanski, K., Likhosherstov, V., Dohan, D., Song, X., Gane, A., Sarlos, T., Hawkins, P., Davis, J., Mohiuddin, A., Kaiser, L., et al. Rethinking attention with performers. arXiv preprint arXiv:2009.14794, 2020. +Cohen, M. A. and Grossberg, S. Absolute stability of global pattern formation and parallel memory storage by competitive neural networks. IEEE transactions on systems, man, and cybernetics, (5):815-826, 1983. +Darrell, T., Sclaroff, S., and Pentland, A. Segmentation by minimal description. In Proceedings Third International Conference on Computer Vision, pp. 112-113. IEEE Computer Society, 1990. +d'Ascoli, S., Touvron, H., Leavitt, M., Morcos, A., Biroli, G., and Sagun, L. Convit: Improving vision transformers with soft convolutional inductive biases. arXiv preprint arXiv:2103.10697, 2021. + +Dayan, P. and Abbott, L. F. Theoretical neuroscience: computational and mathematical modeling of neural systems. Computational Neuroscience Series, 2001. +Deng, J., Dong, W., Socher, R., Li, L.-J., Li, K., and Fei-Fei, L. Imagenet: A large-scale hierarchical image database. In IEEE conference on computer vision and pattern recognition, 2009. +Desimone, R. and Duncan, J. Neural mechanisms of selective visual attention. Annual review of neuroscience, 18 (1):193-222, 1995. +Djolonga, J., Yung, J., Tschannen, M., Romijnders, R., Beyer, L., Kolesnikov, A., Puigcerver, J., Minderer, M., D'Amour, A., Moldovan, D., et al. On robustness and transferability of convolutional neural networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 16458-16468, 2021. +Dodge, S. and Karam, L. A study and comparison of human and deep learning recognition performance under visual distortions. In 2017 26th international conference on computer communication and networks (ICCCN), pp. 1-7. IEEE, 2017. +Dong, M., Li, Y., Wang, Y., and Xu, C. Adversarily robust neural architectures. arXiv preprint arXiv:2009.00902, 2020. +Dosovitskiy, A., Beyer, L., Kolesnikov, A., Weissenborn, D., Zhai, X., Unterthiner, T., Dehghani, M., Minderer, M., Heigold, G., Gelly, S., et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020. +Everingham, M., Van Gool, L., Williams, C. K., Winn, J., and Zisserman, A. The Pascal visual object classes (voc) challenge. *IJCV*, 88(2):303-338, 2010. +Fan, Y., Yu, J., Mei, Y., Zhang, Y., Fu, Y., Liu, D., and Huang, T. S. Neural sparse representation for image restoration. arXiv preprint arXiv:2006.04357, 2020. +Felleman, D. J. and Van Essen, D. C. Distributed hierarchical processing in the primate cerebral cortex. *Cerebral cortex* (New York, NY: 1991), 1(1):1-47, 1991. +Geirhos, R., Janssen, D. H., Schütt, H. H., Rauber, J., Bethge, M., and Wichmann, F. A. Comparing deep neural networks against humans: object recognition when the signal gets weaker. arXiv preprint arXiv:1706.06969, 2017. +Geirhos, R., Rubisch, P., Michaelis, C., Bethge, M., Wichmann, F. A., and Brendel, W. Imagenet-trained cnns are biased towards texture; increasing shape bias improves accuracy and robustness. arXiv preprint arXiv:1811.12231, 2018. + +Gilbert, C. D. and Wiesel, T. N. Columnar specificity of intrinsic horizontal and corticocortical connections in cat visual cortex. Journal of Neuroscience, 9(7):2432-2442, 1989. +Gregor, K. and LeCun, Y. Learning fast approximations of sparse coding. In Proceedings of the 27th international conference on international conference on machine learning, pp. 399-406, 2010. +Grossberg, S. and Mingolla, E. Neural dynamics of perceptual grouping: Textures, boundaries, and emergent segmentations. In The adaptive brain II, pp. 143-210. Elsevier, 1987. +Guo, Y., Zhang, C., Zhang, C., and Chen, Y. Sparse dnns with improved adversarial robustness. arXiv preprint arXiv:1810.09619, 2018. +He, K., Zhang, X., Ren, S., and Sun, J. 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. +He, K., Zhang, X., Ren, S., and Sun, J. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770-778, 2016. +Hendrycks, D. and Dietterich, T. Benchmarking neural network robustness to common corruptions and perturbations. arXiv preprint arXiv:1903.12261, 2019. +Hendrycks, D., Basart, S., Mu, N., Kadavath, S., Wang, F., Dorundo, E., Desai, R., Zhu, T., Parajuli, S., Guo, M., et al. The many faces of robustness: A critical analysis of out-of-distribution generalization. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 8340-8349, 2021a. +Hendrycks, D., Zhao, K., Basart, S., Steinhardt, J., and Song, D. Natural adversarial examples. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 15262-15271, 2021b. +Heo, B., Yun, S., Han, D., Chun, S., Choe, J., and Oh, S. J. Rethinking spatial dimensions of vision transformers. arXiv preprint arXiv:2103.16302, 2021. +Hochreiter, S. and Schmidhuber, J. Long short-term memory. Neural computation, 9(8):1735-1780, 1997. +Hoefler, T., Alistarh, D., Ben-Nun, T., Dryden, N., and Peste, A. Sparsity in deep learning: Pruning and growth for efficient inference and training in neural networks. arXiv preprint arXiv:2102.00554, 2021. + +Hopfield, J. J. Neurons with graded response have collective computational properties like those of two-state neurons. Proceedings of the national academy of sciences, 81(10): 3088-3092, 1984. +Huang, Y., Gornet, J., Dai, S., Yu, Z., Nguyen, T., Tsao, D. Y., and Anandkumar, A. Neural networks with recurrent generative feedback. arXiv preprint arXiv:2007.09200, 2020. +Itti, L. and Koch, C. Computational modelling of visual attention. Nature reviews neuroscience, 2(3):194-203, 2001. +Judd, T., Ehinger, K., Durand, F., and Torralba, A. Learning to predict where humans look. In 2009 IEEE 12th international conference on computer vision, pp. 2106-2113. IEEE, 2009. +Kar, K., Kubilius, J., Schmidt, K., Issa, E. B., and DiCarlo, J. J. Evidence that recurrent circuits are critical to the ventral stream's execution of core object recognition behavior. Nature neuroscience, 22(6):974-983, 2019. +Kim, J., Linsley, D., Thakkar, K., and Serre, T. Disentangling neural mechanisms for perceptual grouping. arXiv preprint arXiv:1906.01558, 2019. +Koch, C. and Ullman, S. Shifts in selective visual attention: towards the underlying neural circuitry. In *Matters of intelligence*, pp. 115–141. Springer, 1987. +Lamme, V. A. and Roelfsema, P. R. The distinct modes of vision offered by feedforward and recurrent processing. Trends in neurosciences, 23(11):571-579, 2000. +Lee, H., Ekanadham, C., and Ng, A. Sparse deep belief net model for visual area v2. Advances in neural information processing systems, 20:873-880, 2007. +Li, D., Yang, Y., Song, Y.-Z., and Hospedales, T. M. Deeper, broader and artier domain generalization. In Proceedings of the IEEE international conference on computer vision, pp. 5542-5550, 2017. +Li, Z. A neural model of contour integration in the primary visual cortex. Neural computation, 10(4):903-940, 1998. +Li, Z. Understanding vision: theory, models, and data. Oxford University Press, USA, 2014. +Linsley, D., Kim, J., Ashok, A., and Serre, T. Recurrent neural circuits for contour detection. arXiv preprint arXiv:2010.15314, 2020. +Liu, S., Mocanu, D. C., and Pechenizkiy, M. On improving deep learning generalization with adaptive sparse connectivity. arXiv preprint arXiv:1906.11626, 2019. + +Machiraju, H., Choung, O.-H., Frossard, P., Herzog, M., et al. Bio-inspired robustness: A review. arXiv preprint arXiv:2103.09265, 2021. +Madry, A., Makelov, A., Schmidt, L., Tsipras, D., and Vladu, A. Towards deep learning models resistant to adversarial attacks. arXiv preprint arXiv:1706.06083, 2017. +Mao, X., Qi, G., Chen, Y., Li, X., Duan, R., Ye, S., He, Y., and Xue, H. Towards robust vision transformer. arXiv preprint arXiv:2105.07926, 2021. +Mély, D. A., Linsley, D., and Serre, T. Complementary surrounds explain diverse contextual phenomena across visual modalities. Psychological review, 125(5):769, 2018. +Mnih, V., Heess, N., Graves, A., et al. Recurrent models of visual attention. In Advances in neural information processing systems, pp. 2204-2212, 2014. +Naseer, M., Ranasinghe, K., Khan, S., Hayat, M., Khan, F. S., and Yang, M.-H. Intriguing properties of vision transformers. arXiv preprint arXiv:2105.10497, 2021. +Nayebi, A., Bear, D., Kubilius, J., Kar, K., Ganguli, S., Sussillo, D., DiCarlo, J. J., and Yamins, D. L. Taskdriven convolutional recurrent models of the visual system. arXiv preprint arXiv:1807.00053, 2018. +Olshausen, B. A. and Field, D. J. Emergence of simple-cell receptive field properties by learning a sparse code for natural images. Nature, 381(6583):607-609, 1996. +Olshausen, B. A. and Field, D. J. Sparse coding with an overcomplete basis set: A strategy employed by v1? Vision research, 37(23):3311-3325, 1997. +O'Reilly, R. C., Wyatte, D., Herd, S., Mingus, B., and Jilk, D. J. Recurrent processing during object recognition. Frontiers in psychology, 4:124, 2013. +Paul, S. and Chen, P.-Y. Vision transformers are robust learners. arXiv preprint arXiv:2105.07581, 2021. +Peters, R. J., Iyer, A., Itti, L., and Koch, C. Components of bottom-up gaze allocation in natural images. Vision research, 45(18):2397-2416, 2005. +Radosavovic, I., Kosaraju, R. P., Girshick, R., He, K., and Dollar, P. Designing network design spaces. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10428-10436, 2020. +Rao, Y., Zhao, W., Zhu, Z., Lu, J., and Zhou, J. Global filter networks for image classification. arXiv preprint arXiv:2107.00645, 2021. + +Rebuffi, S.-A., Gowal, S., Calian, D. A., Stimberg, F., Wiles, O., and Mann, T. A. Data augmentation can improve robustness. Advances in Neural Information Processing Systems, 34, 2021. +Roelfsema, P. R. Cortical algorithms for perceptual grouping. Annu. Rev. Neurosci., 29:203-227, 2006. +Roelfsema, P. R., Lamme, V. A., Spekreijse, H., and Bosch, H. Figure—ground segregation in a recurrent network architecture. Journal of cognitive neuroscience, 14(4): 525-537, 2002. +Rozell, C. J., Johnson, D. H., Baraniuk, R. G., and Olshausen, B. A. Sparse coding via thresholding and local competition in neural circuits. *Neural computation*, 20 (10):2526-2563, 2008. +Scholl, B. J. Objects and attention: The state of the art. Cognition, 80(1-2):1-46, 2001. +Shi, B., Zhang, D., Dai, Q., Zhu, Z., Mu, Y., and Wang, J. Informative dropout for robust representation learning: A shape-bias perspective. In International Conference on Machine Learning, pp. 8828-8839. PMLR, 2020. +Sood, E., Tannert, S., Frassinelli, D., Bulling, A., and Vu, N. T. Interpreting attention models with human visual attention in machine reading comprehension. arXiv preprint arXiv:2010.06396, 2020. +Stettler, D. D., Das, A., Bennett, J., and Gilbert, C. D. Lateral connectivity and contextual interactions in macaque primary visual cortex. Neuron, 36(4):739-750, 2002. +Szegedy, C., Zaremba, W., Sutskever, I., Bruna, J., Erhan, D., Goodfellow, I., and Fergus, R. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199, 2013. +Szegedy, C., Vanhoucke, V., Ioffe, S., Shlens, J., and Wojna, Z. Rethinking the inception architecture for computer vision. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2818-2826, 2016. +Tang, H., Schrimpf, M., Lotter, W., Moerman, C., Paredes, A., Caro, J. O., Hardesty, W., Cox, D., and Kreiman, G. Recurrent computations for visual pattern completion. Proceedings of the National Academy of Sciences, 115 (35):8835-8840, 2018. +Touvron, H., Cord, M., Douze, M., Massa, F., Sablayrolles, A., and Jégou, H. Training data-efficient image transformers & distillation through attention. In International Conference on Machine Learning, pp. 10347-10357. PMLR, 2021. +Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, L., and Polosukhin, I. Attention is all you need. In Advances in neural information processing systems, pp. 5998-6008, 2017. + +Vecera, S. P. and Farah, M. J. Is visual image segmentation a bottom-up or an interactive process? Perception & Psychophysics, 59(8):1280-1296, 1997. +Walther, D., Rutishauser, U., Koch, C., and Perona, P. Selective visual attention enables learning and recognition of multiple objects in cluttered scenes. Computer Vision and Image Understanding, 100(1-2):41-63, 2005. +Wang, H., Ge, S., Xing, E. P., and Lipton, Z. C. Learning robust global representations by penalizing local predictive power. arXiv preprint arXiv:1905.13549, 2019. +Wang, W., Xie, E., Li, X., Fan, D.-P., Song, K., Liang, D., Lu, T., Luo, P., and Shao, L. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. arXiv preprint arXiv:2102.12122, 2021a. +Wang, X., Girshick, R., Gupta, A., and He, K. Non-local neural networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 7794-7803, 2018. +Wang, X., Huang, T. E., Liu, B., Yu, F., Wang, X., Gonzalez, J. E., and Darrell, T. Robust object detection via instance-level temporal cycle confusion. arXiv preprint arXiv:2104.08381, 2021b. +Wright, J., Yang, A. Y., Ganesh, A., Sastry, S. S., and Ma, Y. Robust face recognition via sparse representation. IEEE transactions on pattern analysis and machine intelligence, 31(2):210-227, 2008. +Wu, S., Wong, K. M., Fung, C. A., Mi, Y., and Zhang, W. Continuous attractor neural networks: candidate of a canonical model for neural information representation. F1000Research, 5, 2016. +Wu, Y., Rosca, M., and Lillicrap, T. Deep compressed sensing. In International Conference on Machine Learning, pp. 6850-6860. PMLR, 2019. +Wyatte, D., Curran, T., and O'Reilly, R. The limits of feedforward vision: Recurrent processing promotes robust object recognition when objects are degraded. Journal of Cognitive Neuroscience, 24(11):2248-2261, 2012. +Wyatte, D., Jilk, D. J., and O'Reilly, R. C. Early recurrent feedback facilitates visual object recognition under challenging conditions. Frontiers in psychology, 5:674, 2014. +Xiao, T., Dollar, P., Singh, M., Mintun, E., Darrell, T., and Girshick, R. Early convolutions help transformers see better. Advances in Neural Information Processing Systems, 34, 2021. + +Xie, S., Girshick, R., Dollar, P., Tu, Z., and He, K. Aggregated residual transformations for deep neural networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1492-1500, 2017. +Yen, S.-C. and Finkel, L. H. Extraction of perceptually salient contours by striate cortical networks. Vision research, 38(5):719-741, 1998. +Zoran, D., Chrzanowski, M., Huang, P.-S., Gowal, S., Mott, A., and Kohli, P. Towards robust image classification using sequential attention models. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 9483-9492, 2020. +Zucker, S. W., Dobbins, A., and Iverson, L. Two stages of curve detection suggest two styles of visual computation. Neural computation, 1(1):68-81, 1989. + +# A. Additional Qualitative Results + +# A.1. Evolution of Attention Maps during Recurrent Updates in VARS + +In Figure 7 we show more examples of the evolution of attention maps in each step of the recurrent update in VARS. Here we choose VARS-D built upon the RVT baseline and visualize the attention map of the last layer in the first block. We can observe that the attention map is more sharp and concentrated on the salient objects after each iteration. + +![](images/37971392b956d09fff006ee1e5bb4cd0b139c8abacbbebb092ebe4e2db125010.jpg) +Figure 7. Visualization of the attention maps after each iteration of update in VARS. One can see that the attention will be more concentrated on the salient objects in the image after each update. + +# A.2. Visualization of Attention Maps under Different Image Corruptions + +We show additional visualization of the attention maps under different image corruptions in Figure 8, where each block contains attention maps of clean images as well as images under noise, blur, digital, and weather corruptions (from top to down). We show the attention maps of RVT*, VARS-S, VARS-D, and VARS-SD (from left to right). One can see that the attention maps of self-attention baseline is more sensitive to image corruptions, while variants of VARS tend to output stable attention maps. Meanwhile, the attention maps of VARS-S are steady but not as sharp as VARS-D and VARS-SD. + +![](images/1d3330ac3f80ece4a7e917acf7cb6c11c98b84e609e44f7149d5347917f6df1e.jpg) + +![](images/bb4d471eecac62111ea9b5e6dd1af38042face75e7d4c48571aab0d3f731624b.jpg) + +![](images/f2df35034a772c56146a53ef03cab4f24963feac666d0e4ae499ac6a9dbbc435.jpg) +Figure 8. Visualization of the attention maps under image corruptions. Each block contains clean images as well as images under corruption of noise, blur, digital, and weather (from top to down). We visualize the attention map of RVT*, VARS-S, VARS-D, and VARS-SD (from left to right in each block). Across different images, self-attention is usually more unstable than the variants of VARS. Meanwhile, VARS-S has attention maps that are consistent under different corruptions but are not as sharp as those of VARS-D and VARS-SD. + +![](images/0daee9d097697661262d1a9378cdbb90e5d68d3e909563b082f8c656a723a417.jpg) + +# A.3. Comparing Attention Maps with Human Eye Fixation + +In Figure 9 we show additional results on comparing the attention maps of different models with the human eye fixation data. We can see that, the attention maps of VARS are more consistent with human eye fixation than self-attention. + +![](images/8ea9bd6fe0de99152d52c0c17a3745a56396deb085060fab01b51ea0ef64884c.jpg) +Figure 9. Comparison between attention maps of different models and human eye fixation probabilities. The variants of VARS have attention maps that are more consistent with human eye fixation. + +# B. Details on Derivation of the Sparse Reconstruction Problem + +We follow Rozell et al. (2008) and add recurrent connections between $\mathbf{u}$ , modeled by the weight matrix $-\gamma (\mathbf{P}^T\mathbf{P} - \mathbf{I})$ . We also add hyperparameters $\alpha$ and $\beta$ to control the strength of self-leakage and the element-wise activation functions $g(\cdot)$ to gate the output from the neurons (Dayan & Abbott, 2001). As a result, we fix the dynamics of the recurrent networks as: + +$$ +\left\{ \begin{array}{l} \frac {\mathrm {d} \mathbf {z}}{\mathrm {d} t} = - \alpha \mathbf {z} + \mathbf {P} g (\mathbf {u}) + \mathbf {x}, \\ \frac {\mathrm {d} \mathbf {u}}{\mathrm {d} t} = - \beta \mathbf {u} - \gamma \left(\mathbf {P} ^ {T} \mathbf {P} - \mathbf {I}\right) g (\mathbf {u}) + \mathbf {P} ^ {T} \mathbf {z}. \end{array} \right. \tag {18} +$$ + +By taking $\alpha = 1$ and $\beta = \gamma = 2$ , it has the same steady state solution as + +$$ +\left\{ \begin{array}{c} \frac {\mathrm {d} \mathbf {u}}{\mathrm {d} t} = - 2 (\mathbf {u} - \widetilde {\mathbf {u}}) - \mathbf {P} ^ {T} \mathbf {P} \widetilde {\mathbf {u}} + \mathbf {P} ^ {T} \mathbf {x}, \\ \mathbf {z} = \mathbf {P} \widetilde {\mathbf {u}} + \mathbf {x}, \end{array} \right. \tag {21} +$$ + +where $\widetilde{\mathbf{u}} = g(\mathbf{u})$ . Now we choose $g(\cdot)$ as the thresholding function $g(\mathbf{u}_i) = sgn(\mathbf{u}_i)\cdot (|\mathbf{u}_i| - \lambda)_+$ , where $sgn(\cdot)$ is the sign function and $(\cdot)_{+}$ is ReLU. Under the assumption that $g(\cdot)$ is monotonically non-decreasing, Eq. 20 is actually minimizing the energy function + +$$ +E (\widetilde {\mathbf {u}}) = \frac {1}{2} \left\| \mathbf {P} \widetilde {\mathbf {u}} - \mathbf {x} \right\| ^ {2} + 2 \lambda \| \widetilde {\mathbf {u}} \| _ {1}. \tag {22} +$$ + +To see this, one can verify that when $\mathbf{u}$ evolves by Eq. 20, $E(\widetilde{\mathbf{u}})$ is non-increasing, i.e., + +$$ +\frac {\mathrm {d} E}{\mathrm {d} t} = - \left(2 \lambda \cdot \operatorname {s g n} (\mathbf {u}) + \mathbf {P} ^ {T} \mathbf {P} \widetilde {\mathbf {u}} - \mathbf {P} ^ {T} \mathbf {x}\right) ^ {T} \cdot \mathbf {K} (\mathbf {u}) \cdot \left(2 \lambda \cdot \operatorname {s g n} (\mathbf {u}) + \mathbf {P} ^ {T} \mathbf {P} \widetilde {\mathbf {u}} - \mathbf {P} ^ {T} \mathbf {x}\right) = \left(\frac {\mathrm {d} \mathbf {u}}{\mathrm {d} t}\right) ^ {T} \mathbf {K} (\mathbf {u}) \frac {\mathrm {d} \mathbf {u}}{\mathrm {d} t}, \tag {23} +$$ + +where $\mathbf{K}(\mathbf{u})$ is a diagonal matrix with $\mathbf{K}(\mathbf{u})_{ii} = 1$ when $(i) |\mathbf{u}_i| > 1$ , and $(ii) |\mathbf{u}_i| = 1$ and $\frac{\mathrm{d}\mathbf{u}_i}{\mathrm{d}t} \cdot sgn(\mathbf{u}_i) > 0$ , otherwise $\mathbf{K}(\mathbf{u})_{ii} = 0$ . Since $\mathbf{K}(\mathbf{u})$ is positive semi-definite, Eq. 23 is non-positive, which means the energy is non-increasing. Then Eq. 20 equivalently optimizes the sparse reconstruction: + +$$ +\left\{ \begin{array}{l} \widetilde {\mathbf {u}} ^ {*} = \underset {\widetilde {\mathbf {u}} \in \mathbb {R} ^ {d ^ {\prime}}} {\arg \min } \frac {1}{2} \left\| \mathbf {P} \widetilde {\mathbf {u}} - \mathbf {x} \right\| ^ {2} + 2 \lambda \left\| \widetilde {\mathbf {u}} \right\| _ {1} \\ \mathbf {z} ^ {*} = \mathbf {P} \widetilde {\mathbf {u}} ^ {*} + \mathbf {x}. \end{array} \right. \tag {24} +$$ \ No newline at end of file diff --git a/visualattentionemergesfromrecurrentsparsereconstruction/images.zip b/visualattentionemergesfromrecurrentsparsereconstruction/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..592ced06a69876a07693b0f46f0603fa292dfab2 --- /dev/null +++ b/visualattentionemergesfromrecurrentsparsereconstruction/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b2f56d36b7282875b5994ee549fc0f95ae622abbd6169fe2bdc258b90663298 +size 918564 diff --git a/visualattentionemergesfromrecurrentsparsereconstruction/layout.json b/visualattentionemergesfromrecurrentsparsereconstruction/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..edadb9dffa0583c4391b60ef928170a3e5cbb0f4 --- /dev/null +++ b/visualattentionemergesfromrecurrentsparsereconstruction/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fe79c87b76c31d58f8e07b7e87ff7f8f4ef0691ac6d8f752646830ae2e3d2813 +size 615374 diff --git a/vitnetinterpretablevisiontransformerswithneuraltreedecoder/cb985e63-503d-441b-b79e-ead319b13ecd_content_list.json b/vitnetinterpretablevisiontransformerswithneuraltreedecoder/cb985e63-503d-441b-b79e-ead319b13ecd_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..21560f634b184957146f960439ea0a94fe6934b1 --- /dev/null +++ b/vitnetinterpretablevisiontransformerswithneuraltreedecoder/cb985e63-503d-441b-b79e-ead319b13ecd_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6daca2e0d0cf0e7452bf305abd9fe082929d0ff83182d568f43347827be75090 +size 71519 diff --git a/vitnetinterpretablevisiontransformerswithneuraltreedecoder/cb985e63-503d-441b-b79e-ead319b13ecd_model.json b/vitnetinterpretablevisiontransformerswithneuraltreedecoder/cb985e63-503d-441b-b79e-ead319b13ecd_model.json new file mode 100644 index 0000000000000000000000000000000000000000..7fe31761bf69ce2309fdf5eb67b59ded1725e5b6 --- /dev/null +++ b/vitnetinterpretablevisiontransformerswithneuraltreedecoder/cb985e63-503d-441b-b79e-ead319b13ecd_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1c07a4459282522d333a4b81881d6ce51a367171780039788034a544aa39896d +size 89301 diff --git a/vitnetinterpretablevisiontransformerswithneuraltreedecoder/cb985e63-503d-441b-b79e-ead319b13ecd_origin.pdf b/vitnetinterpretablevisiontransformerswithneuraltreedecoder/cb985e63-503d-441b-b79e-ead319b13ecd_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..caeca1347fcff80fb7f7c7e2dbaa497e3e62b2ff --- /dev/null +++ b/vitnetinterpretablevisiontransformerswithneuraltreedecoder/cb985e63-503d-441b-b79e-ead319b13ecd_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9d73439bf2c6b7c51a042316428c6bf1f2697fc94226996f361b9df86168afb5 +size 6927936 diff --git a/vitnetinterpretablevisiontransformerswithneuraltreedecoder/full.md b/vitnetinterpretablevisiontransformerswithneuraltreedecoder/full.md new file mode 100644 index 0000000000000000000000000000000000000000..d8884463a11a1883b10b3805e7798ea1f05e5d67 --- /dev/null +++ b/vitnetinterpretablevisiontransformerswithneuraltreedecoder/full.md @@ -0,0 +1,267 @@ +# Sangwon Kim1 Jaeyeal Nam1 Byoung Chul Ko1 + +# Abstract + +Vision transformers (ViTs), which have demonstrated a state-of-the-art performance in image classification, can also visualize global interpretations through attention-based contributions. However, the complexity of the model makes it difficult to interpret the decision-making process, and the ambiguity of the attention maps can cause incorrect correlations between image patches. In this study, we propose a new ViT neural tree decoder (ViT-NeT). A ViT acts as a backbone, and to solve its limitations, the output contextual image patches are applied to the proposed NeT. The NeT aims to accurately classify fine-grained objects with similar inter-class correlations and different intra-class correlations. In addition, it describes the decision-making process through a tree structure and prototype and enables a visual interpretation of the results. The proposed ViT-NeT is designed to not only improve the classification performance but also provide a human-friendly interpretation, which is effective in resolving the trade-off between performance and interpretability. We compared the performance of ViT-NeT with other state-of-art methods using widely used fine-grained visual categorization benchmark datasets and experimentally proved that the proposed method is superior in terms of the classification performance and interpretability. The code and models are publicly available at https://github.com/jumpsnack/ViT-NeT. + +# 1. Introduction + +Transformer structures, which have recently led to successful results in natural language processing (NLP), have also + +$^{1}$ Department of Computer Engineering, Keimyung University, Daegu, South Korea. Correspondence to: Byoung Chul Ko . + +Proceedings of the $39^{th}$ International Conference on Machine Learning, Baltimore, Maryland, USA, PMLR 162, 2022. Copyright 2022 by the author(s). + +![](images/6f02e237a1cf5697c1738bd6e977cd843d56ea2e37aa82971865a3d0d5b5975d.jpg) +Figure 1. A ViT-NeT is a novel way of using a neural tree decoder to grant intrinsic interpretability to the ViT. In particular, the proposed NeT supports the interpretation of the sequential decision-making procedure for a given image. At each tree node, attention is concentrated on the glitter rump, green throat, and tail covert, and the image is classified as a "Bird" through a specific node path. ViT-NeT is compatible with any ViT methods and datasets for fine-grained visual classification. + +been applied to computer vision. In the same manner in which NLP divides a sentence into several words and allows the transformer to learn the association between each word, a vision transformer (ViT) (Dosovitskiy et al., 2020) learns the association between image patches. Consequently, it has been proven that the ViT structure performs better in the field of vision than a convolutional neural network (CNN) structure. However, because the ViT and CNN approaches are based on a black-box learning mechanism, there are limitations in terms of the interpretability of the model. Thus, demand is increasing for information on the model interpretability, an explanation of the results, and the model performance. + +In the field of computer vision, interpretability can be broadly divided into two approaches, i.e., those that provide attention (e.g., heat map and saliency) to the prediction results and those using the interpretability (transparency) of the model itself. First, attention based explainable models (Samek et al., 2017; Selvaraju et al., 2017; Chattopadhyay et al., 2018; Itaya et al., 2021) provide saliency to the image pixels to explain why a predictive model classifies objects into specific classes. However, these methods have limita + +tions in that a person must infer the description of the model from the attention map again and cannot know the decision-making process for why the model emphasizes such pixels. Second, interpretable models (Chen & Guestrin, 2016; Ke et al., 2017; Dorogush et al., 2018; Lundberg et al., 2020; Kim et al., 2021) are structures in which the model itself is transparent, or the decision-making step is understandable. The interpretability of a model is closely related to its complexity and performance. From the perspective of complexity, the decision tree originally designed as an interpretable structure has an extremely simple make up, and therefore has an advantage in terms of the interpretability compared to the deep neural network (DNN). To overcome the low interpretability of DNNs while maintaining a high performance on fine-grained images, some algorithms (Chen et al., 2019a; Ji et al., 2020; Wan et al., 2021; Nauta et al., 2021) have attempted to combine DNNs with decision trees. Such algorithms provide an attention map to the user for reasons of classification as well as explanations of the classification process. However, these interpretable models still have limitations in explaining the decision-making processes, and there is a trade-off between interpretability and performance. For example, ProtoTree (Nauta et al., 2021) achieved the highest fine-grained image classification performance using an ensemble of a DNN and a decision tree; however, the interpretability was eventually lowered again owing to the learning complexity of the ensemble model. + +In this study, we propose an interpretable vision transformer neural tree (ViT-NeT) that supports excellent fine-grained visual categorization (FGVC) and provides model interpretability with a simultaneous visual explanation. ViT-NeT is composed of a combination of a ViT encoder and soft neural tree decoder (NeT). Although the role of ViT is to achieve a high level classification performance using high-quality local and global features as well as the attention information, a neural tree acts as a discriminant decoder that interprets the decision-making process of the ViT and routes the images hierarchically. Therefore, ViT-NeT can largely solve the interpretability and performance trade-off that occurs in the existing ensemble models. Figure 1 shows the approximate operating structure of ViT-NeT. Figure illustrates which image patch receives attention for each node, how the image patch is branched for each node, and finally, the fine-grained classification. + +This study is the first to combine ViT with neural decision trees to achieve a high interpretability and classification performance for fine-grained images. The contributions of the ViT-NeT proposed in this study are as follows: + +- Unlike existing interpretable models, a high performance on fine-grained image classification is achieved competitively with state-of-the-art (SOTA) CNNs and ViTs, and an analysis is possible without a trade-off + +between performance and interpretability. + +- The attention weight of a vanilla ViT supports only image interpretability, such as an attention map, whereas the proposed method makes the decision model itself transparent, enabling the decision-making process and image explanation at the same time. +- Molecule prototyping allows a simultaneous interpretation of the positive and negative components of data at the nodes of the neural tree. +- We present qualitative and quantitative evidence for the excellent interpretability of the decision-making of the ViT-NeT model for various test data. + +# 2. Related Works + +FGVC with ViTs Until recently, visual classification was the most fundamental field of deep-learning research; however, the performance of SOTA models has already reached its limit. Furthermore, fine-grained categorization, such as distinguishing visually similar animals and plants, is a challenging problem that goes beyond the limits of both human and machine performance. This limitation arises because most images have both a high inter-class correlation and a low intra-class correlation. Similar to other vision tasks, the FGVC task is driven by a CNN, which has achieved the highest benchmark performance. As various ViT-based methods (Dosovitskiy et al., 2020; Touvron et al., 2021; Liu et al., 2021) have recently outperformed CNNs and demonstrated a SOTA performance, ViT has begun to be applied to FGVC (He et al., 2021; Zhang et al., 2021). For example, TransFG (He et al., 2021) exploited attention-based patch distillation and contrastive loss to extract robust local image patches and discriminative regions. AFTrans (Zhang et al., 2021) proposed a selective attention collection module that operates using a Siamese architecture that shares the weight parameters. However, because the attention module of the transformer is applied based on the implicit assumption that it would be extracted from a local highly discriminative part, there is a limitation in that the reliability of an attention map generated during the training process will be ambiguous. + +Visual explanation with ViTs With the improving performances of CNNs, research on visual explanations is being actively conducted to secure the reliability necessary for its practical application. Thus far, visual explanation contributions in computer vision (Binder et al., 2016; Ribeiro et al., 2016; Selvaraju et al., 2017; Shrikumar et al., 2017; Lundberg & Lee, 2017; Chattopadhy et al., 2018; Itaya et al., 2021) have mostly focused on CNNs. Although ViTs are emerging as a new learning paradigm, few practical studies have been conducted on visual explanations. A common + +![](images/2fd3a6c81ff228e075587626e8bbf236783f238e3726f1204505cd357519a68a.jpg) +(a) Hierarchical Transformer Encoder + +![](images/3d8e2cd31e395cfe178d7b21ff45d8917f4932f35a5b4461faa50816070caaa7.jpg) +(b) Neural Tree Decoder + +![](images/ce820036ec9845a5519befe37ffe0b673f39407e0b369fd0885c53ee39003469.jpg) +(c) Contextual Transformer Module + +![](images/94173f1aafb78534501063bbc8e8f09402743c3a7293751f4fa442c88b9df280.jpg) +(d) Leaf Node +Figure 2. Overview of our ViT-NeT model formed using (a) the hierarchical transformer encoder, (b) neural tree decoder, (c) contextual transformer module, and (d) leaf node. + +way to explain the output of a ViT is to visualize the attention maps. Because the attention maps created through self-attention are applied using only the query and key, there is a disadvantage in that the overall operation of the model is not considered. The major issue with the attention-based ViT methods is that the attention of the previous layer is combined nonlinearly with the attention of the next layer. To solve this problem, an attention rollout (Abnar & Zuidema, 2020) combining attention maps and assuming linearity has been proposed; however, it is difficult to avoid ambiguity in the attention maps, which may lead to incorrect correlations between image patches. Although CNNs and ViT-based visual explanations aim to emphasize a meaningful area, it is impossible to explain the decision-making process; in addition, they have limitations in that they support only a global interpretation. Therefore, for true visual explanations, we require a new model that is capable of image interpretability and at the same time can simultaneously explain the decision-making process. + +Model interpretability with neural trees A decision tree is a powerful way to solve specific tasks at a single feature level. Although a decision tree architecture has intrinsic interpretability, it has a fatal flaw making it unsuitable for computer vision tasks. To overcome this hurdle, many studies (Hinton et al., 2015; Kontschieder et al., 2015; Balestriero, 2017; Tanno et al., 2019; Ji et al., 2020; Alaniz et al., 2021; Wan et al., 2021; Nauta et al., 2021) have introduced differentiable neural trees compatible with various vision tasks. ANTs (Tanno et al., 2019) exploits an adaptively configurable neural tree mechanism with trainable tree components, that is, nodes, edges, and leaves. However, it has a limited interpretation and is unsuitable for large-scale datasets. Although NBDT (Wan et al., 2021) applies a sequentially interpretable neural tree, it must use param + +eters induced from trained CNNs and requires WordNet (Miller, 1995) to define the interpretable tree architecture. With ProtoTree (Nauta et al., 2021), a new method is introduced for building an interpretable tree that can visualize decision-making with prototypes. Nonetheless, it has certain disadvantages in that the best performance only occurs when it is a formed ensemble, the ensemble of the tree eventually reduces the interpretability, and the training scheme is complex. + +# 3. Approach + +Although attention weights from a stack of ViT layers provide interpretable clues, existing interpretable models based on ViT (Dosovitskiy et al., 2020; Touvron et al., 2021; Liu et al., 2021) only provide post-hoc explanations. Although intrinsic explanations are ideal cases for interpretable models, it is generally the case that the more interpretable the model structure is, the less accuracy it achieves. To achieve a better balance between the interpretability and accuracy of the model, we propose a novel, structurally interpretable, and visually explainable ViT-NeT model by combining a hierarchical transformer task with a neural tree decoder. + +An overview of the proposed ViT-NeT is shown in Figure 2. First, we use a hierarchical vision-based transformer (Liu et al., 2021) among the ViT methods as a backbone for a feature representation. This method can consider the variations in small and large objects in an image simultaneously using a shifted window. Next, by changing the local level feature prototyping (Chen et al., 2018; Nauta et al., 2021) into a more human-friendly approach, the system was designed to improve the fine-grained classification performance while easily interpreting the decision-making process and enabling a visual explanation. + +Algorithm 1 Training a ViT-NeT +Input: Training set $\mathcal{T}$ , number of epochs $E$ , hierarchical transformer encoder $f$ depth of tree $d$ encoder parameter $\theta$ , decoder parameter $\omega$ +Initialize $\mathbb{T} =$ init tree $(d;\omega)$ +Initialize leaf node set $\mathbb{L} = \emptyset$ +Get leaf node ids from $\mathbb{T}$ and assign it into $\mathbb{L}$ +function traverse(i,zi) if $i\in \mathbb{L}$ then return $\mathcal{L}(\mathbf{z}_i)$ end if $\mathcal{R}_{i,2\times i}(\mathbf{z}_i) = [\mathcal{N}(\mathbf{z}_i)]_0^1$ $\mathcal{R}_{i,2\times i + 1}(\mathbf{z}_i) = 1 - [\mathcal{N}(\mathbf{z}_i)]_0^1$ $l_{\text{distrib}} =$ traverse(2 x i, E,i,2x i (zi)) $r_{\text{distrib}} =$ traverse(2 x i + 1, E,i,2x i + 1 (zi)) return $\mathcal{R}_{i,2\times i}(\mathbf{z}_i)\times l_{\text{distrib}} + \mathcal{R}_{i,2\times i + 1}(\mathbf{z}_i)\times r_{\text{distrib}}$ +end function +for $e\in \{1,\dots ,E\}$ do randomly split T into B mini-batches for $(x_b,y_b)\in \{\mathcal{T}_1,\ldots ,\mathcal{T}_b,\ldots ,\mathcal{T}_B\}$ do $\mathbf{z}_1^b = f(x_b;\theta)$ $\hat{y}_b =$ traverse(1,zb) compute loss(yb,yb) update parameter $\theta$ and w with AdamW end for +end for + +Hierarchical transformer encoder ViT, which applies a transformer to image classification, has recently been proposed, and various attempts have been made to fill the gap between ViT and a CNN. Among them, the Swin Transformer (Liu et al., 2021) uses a shifted window mechanism to induce a powerful expression for dealing with the various problems of early ViT, such as inductive bias and computational complexity. The single-window approach used in conventional transformers exhibits some weaknesses in various perturbed images, which, unlike a CNN, must maintain an inductive bias. In the same way as a traditional CNN ensures robustness in many different cases, the Swin transformer inherits hierarchical feature encoding, similar to a feature pyramid, from the CNN framework. A Swin transformer uses a shift window to change the window size and process multiple patches with self-attention. Because the size of the patch included in the window varies, an attention map was created to easily detect small and large objects. The self-attention of a vanilla transformer applies a quadratic number of computations on the input image, whereas the Swin transformer conducts a linear computation on the image. This has the advantage of not only increasing the size of the model with a relatively small number of computa + +tions but also increasing the inference speed. We used the Swin transformer as a backbone model to extract the attention map features for fine-grained classification and a visual explanation of the images. + +Interpretable neural tree decoder Existing interpretable methods are simple and effective but have limitations in that they provide only one option between explainability and performance. To achieve a better trade-off between accuracy and interpretability, we propose a NeT that uses a perfect binary tree and a differentiable routing mechanism. The proposed NeT consists of sets of nodes $\mathcal{N}(\cdot)$ , leaves $\mathcal{L}(\cdot)$ , and edges $\mathcal{E}_{i,j}(\cdot)$ between a parent node $i$ and a child node $j$ . Because the model uses a perfect binary tree, each internal node has two child nodes: $\mathcal{N}_{2\times i}$ and $\mathcal{N}_{2\times i+1}$ . Given the encoder output $\mathbf{z}_1 = f(x; \theta)$ , the proposed NeT predicts the final class labels $\hat{y}$ in a soft-decision manner. Algorithm 1 introduces the training procedure through a recursive tree traversing ViT-NeT. + +The proposed NeT of the ViT-NeT model is aimed specifically at classifying objects that have similar inter-class correlations and dissimilar intra-class correlations. Although a global classification can be applied based on relatively simple global cues, fine-grained classification requires discriminant regions of subdivided categories that are highly localized. In this study, to capture a small discriminant feature, prototypes were applied to condensed image patches. + +Branch routing The NeT uses prototypes to find discriminative regions among the image patches. When the discriminative feature is sampled, the routing direction is determined such that the samples are sent to the child in the differentiable routing module. Specifically, each internal node corresponds to a trainable prototype $\mathcal{P}_i\in \mathbb{R}^{H_1\times W_1\times D}$ . Each prototype is a trainable tensor that is used to measure the squared $L^2$ routing score $\mathcal{N}_i\in [0,1]$ against the reshaped image patches $\mathbf{z}\in \mathbb{R}^{H\times W\times D}$ : + +$$ +\mathcal {N} (\mathbf {z} _ {i}) = \max _ {\tilde {\mathbf {z}} \in \operatorname {p a t c h e s} \left(\mathbf {z} _ {\mathrm {i}}\right)} \log \left(\left(\| \tilde {\mathbf {z}} - \mathcal {P} _ {i} \| _ {2} ^ {2} + 1\right) / \left(\| \tilde {\mathbf {z}} - \mathcal {P} _ {i} \| _ {2} ^ {2} + \epsilon\right)\right), \tag {1} +$$ + +The routing score $\mathcal{N}(\mathbf{z}_i)$ of the $i$ -th internal node gives the similarity between the nearest condensed image patch $\tilde{\mathbf{z}} \in \mathbb{R}^{1 \times D}$ and prototype $\mathcal{P}_i$ . To define the similarity between a prototype and the image patches in each node, inspired by (Chen et al., 2018), we use a convolutional operation to measure the distance, where each prototype operates as a convolutional kernel over $\mathbf{z}$ and derives the distance between the prototype and its current $\mathbf{z}$ . To induce similarity from the distance, we use a logarithmic similarity measure in Equation (1), which has a high similarity when the distance is closer to its receptive patch. Following Equation (1), we define the routing scores for each child node as + +$$ +\mathcal {R} _ {i, 2 \times i} (\mathbf {z} _ {i}) = [ \mathcal {N} (\mathbf {z} _ {i}) ] _ {0} ^ {1} \text {a n d} \mathcal {R} _ {i, 2 \times i + 1} (\mathbf {z} _ {i}) = 1 - [ \mathcal {N} (\mathbf {z} _ {i}) ] _ {0} ^ {1}. +$$ + +Contextual transformer enhancing A contextual transformer module is used to enforce the model to capture discriminative patches. Depending on the fact that the empirical receptive field is much smaller than the theoretical receptive field, the discriminative representation should be formed by a larger receptive field. In this regard, we focused on enhancing the global features into tree edges across all discretized image patches. As shown in Figure 2 (c), the contextual transformer module (CTM) provides a better description of the object by aggregating the global context to the patches of each position. Specifically, given that image patches are squeezed along the side channel dimensions to 1-dim, softmax is applied on the patch dimensions. This condensed context matrix is multiplied by the given image patches to assign global context information. Subsequently, the matrix is projected, followed by a couple of fully connected layers with GELU and layer normalization. Finally, the enhanced contextual image patches $\mathbf{z}_j$ using Equation (2) are fed into the corresponding child nodes/leaves. + +$$ +\mathbf {z} _ {j} = \mathcal {E} _ {i, j} (\mathbf {z} _ {i}) = \operatorname {C T M} (\mathbf {z} _ {i}), \tag {2} +$$ + +Label prediction Each leaf in the tree decoder corresponds to the leaf prediction module $\mathcal{L}(\cdot)$ for predicting the class probability over the $K$ classes that need to be learned. Let $\rho(\mathbf{z}_1)$ be the accumulated routing score of the encoder output $\mathbf{z}_1$ passing from the root node to the $l$ -th leaf node in a set of edges of a specific path $p_l$ . The accumulated routing score, $\rho(\mathbf{z}_1)$ , is calculated using Equation (3). + +$$ +\rho \left(\mathbf {z} _ {i}\right) = \prod_ {(i, j) \in p _ {l}} \mathcal {R} _ {i, j} \left(\mathcal {E} _ {i, j} \left(\mathbf {z} _ {i}\right)\right), \tag {3} +$$ + +Each leaf prediction module is formed through global average pooling (GAP), global max pooling (GMP), a global fully connected layer (GFC) with shared weights, a local fully connected layer (LFC), and layer normalization (LN), as shown in Figure 2 (d). The formula for the leaf prediction module is as follows: + +$$ +\mathcal {L} \left(\mathbf {z} _ {l}, x\right) = \operatorname {L N} \left(\operatorname {L F C} \left(\operatorname {G M P} \left(\mathbf {z} _ {l}\right)\right) + \operatorname {G F C} \left(\operatorname {G A P} (f (x; \theta))\right)\right), \tag {4} +$$ + +In Equation (4), whereas the leaf node learns the local view with a given enhanced context patch and LFC, the GFC fuels the leaf to learn its representation from a global contextual view. + +The final prediction $\hat{y}$ is computed as the summation of all leaf predictions $\mathcal{L}$ multiplied by the accumulated routing scores $\rho_{l}$ , such that + +$$ +\hat {y} = \sum_ {l \in \mathbb {L}} \sigma \left(\mathcal {L} \left(\mathbf {z} _ {l}, x\right)\right) \cdot \rho_ {l} \left(\mathbf {z} _ {1}\right), \tag {5} +$$ + +The final prediction $\hat{y}$ is optimized using a negative logarithmic likelihood loss with the ground truth label $y$ . + +# 4. Experiments + +This section introduces the detailed setup, including the datasets and training hyper-parameters. A quantitative analysis was conducted, followed by ablation studies and qualitative analyses. + +# 4.1. Experiment Setup + +Datasets We evaluated our ViT-NeT on three FGVC datasets: CUB-200-2011 (Wah et al., 2011), Stanford Cars (Krause et al., 2013), and Stanford Dogs (Khosla et al., 2011), and compared our model with previous SOTA models in terms of accuracy and interpretability. + +Implementation details ViT-NeT was implemented in PyTorch. Our hierarchical transformer encoder $f$ contains Swin transformer layers (Liu et al., 2021) pre-trained using ImageNet-22K. First, we resized the input images to a pixel resolution of $448 \times 448$ through random cropping for training and center cropping for testing. Following the procedure of (Liu et al., 2021), we split the image into small size 4 patches and set the group window size to 14. An AdamW optimizer was employed with a momentum of 0.9. The learning rate was initialized as 2e-5 for CUB-200-2011, 2e-4 for Stanford Dogs, and 2e-3 for Stanford Cars. The batch size was set to 16. Training and testing were conducted using four NVIDIA Tesla V100 32GB GPUs with APEX. + +# 4.2. Quantitative Analysis + +Evaluation on the CUB-200-2011 Dataset The CUB-200-2011 (Wah et al., 2011) dataset consists of 11,788 images in 200 classes with 5,994 training images and 5,794 testing images. Table 1 shows the comparison results with various SOTA methods for both the CNN and ViT regimes. Compared to the best result of AFTrans (Zhang et al., 2021), the proposed ViT-NeTs show better results and outweighs all CNN-based methods on the CUB-200-2011 dataset. When the backbone network of ViT-NeT is replaced with base data-efficient image transformers (DeiT-B)(Touvron et al., 2021), the performance is degraded by $1.5\%$ in comparison to the base Swin transformer (SwinT-B). When compared to the base transformer models DeiT and SwinT, the proposed neural tree decoder fuels an overall performance of approximately $2.5\%$ and $3.2\%$ , respectively. From the results, we can confirm that for the CUB-200-2011 dataset, + +Table 1. Top-1 Accuracy comparison on CUB-200-2011. + +
MethodBackboneTop-1 (%)
ProtoTree† (Nauta et al., 2021)ResNet-5082.2
STN (Jaderberg et al., 2015)Inception84.1
ResNet-50 (He et al., 2016)ResNet-5084.5
MA-CNN (Zheng et al., 2017)VGG-1986.5
DCL (Chen et al., 2019b)VGG-1686.9
TASN (Zheng et al., 2019b)VGG-1987.1
DFL-CNN (Wang et al., 2018)ResNet-5087.4
NTS-Net (Yang et al., 2018)ResNet-10187.9
DCL (Chen et al., 2019b)ResNet-5087.8
TASN (Zheng et al., 2019b)ResNet-5087.9
DBTNet (Zheng et al., 2019a)ResNet-10188.1
FDL (Liu et al., 2020)DenseNet-16189.1
PMG (Du et al., 2020)ResNet-5089.6
API-Net (Zhuang et al., 2020)DenseNet-16190.0
StackedLSTM (Ge et al., 2019)GoogleNet90.4
DeiT (Touvron et al., 2021)DeiT-B87.6
SwinT (Liu et al., 2021)SwinT-B88.4
TransFG (He et al., 2021)ViT-B/1690.9
AFTrans (Zhang et al., 2021)ViT-B/1691.5
ViT-NeTDeiT-B90.1
ViT-NeTSwinT-B91.6
+ +† 224 image input + +when the proposed NeT is combined with SwinT, it shows the best fine-grained classification performance compared to the CNN-based methods as well as base transformers. + +Evaluation on the Stanford Dogs Dataset The Stanford Dogs dataset (Khosla et al., 2011) is a fine-grained dataset of 100 different breeds formed by 20,580 images, which is formed by 12,000 images for training and 8,580 images for testing. The evaluation results are listed in Table 2. Our ViT-NeT outperformed most of the comparison methods, particularly on the CNN backbone. Moreover, the performance of our model is on par with the attention-based variants (He et al., 2021; Zhang et al., 2021) and exceeds the accuracy of the black-box or base ViT-based methods. Base DeiT and SwinT provide a lower performance than when combined with our NeT decoder, DeiT-B+NeT and SwinT-B+NeT, i.e., $91.5\%$ versus $93.6\%$ , and $88.0\%$ versus $90.3\%$ , respectively. When our ViT-NeT model uses SwinT-B as a backbone, the top-1 accuracy is slightly diminished by $3.3\%$ compared to the DeiT-B backbone. This is due to the problem that base SwinT's classification performance is somewhat inferior in images with a complex background. However, when combined with DeiT, it significantly outperforms the base DeiT as well as SOTA AFTrans. As a result, the proposed NeT proved that the fine-grained classification performance can be improved by using the delivered condensed image patches with a neural tree and a differentiable routing mechanism regardless of the type of ViT. + +Evaluation on the Stanford Cars Dataset The Stanford Cars dataset (Krause et al., 2013) contains 16,185 images in + +Table 2. Top-1 Accuracy comparison on Stanford Dogs. + +
MethodBackboneTop-1 (%)
MaxEnt (Dubey et al., 2018)DenseNet-16183.6
FDL (Liu et al., 2020)DenseNet-16184.9
DFL-CNN (Wang et al., 2018)ResNet-5084.9
RA-CNN (Fu et al., 2017)VGG-1987.3
Cross-X (Luo et al., 2019)ResNet-5088.9
SEF (Luo et al., 2020)ResNet-5088.8
API-Net (Zhuang et al., 2020)ResNet-10190.3
DeiT (Touvron et al., 2021)DeiT-B91.5
SwinT (Liu et al., 2021)SwinT-B88.0
TransFG (He et al., 2021)ViT-B/1690.4
AFTrans (Zhang et al., 2021)ViT-B/1691.6
ViT-NeTDeiT-B93.6
ViT-NeTSwinT-B90.3
+ +Table 3. Top-1 Accuracy comparison on Stanford Cars. + +
MethodBackboneTop-1 (%)
ProtoTree† (Nauta et al., 2021)ResNet-5086.6
RA-CNN (Fu et al., 2017)VGG-1992.5
MaxEnt (Dubey et al., 2018)DenseNet-16193.0
DFL-CNN (Wang et al., 2018)ResNet-5093.1
SEF (Luo et al., 2020)ResNet-5094.0
FDL (Liu et al., 2020)DenseNet-16194.2
Cross-X (Luo et al., 2019)ResNet-5094.6
MMAL (Balikas et al., 2017)ResNet-5095.0
PMG (Du et al., 2020)ResNet-5095.1
API-Net (Zhuang et al., 2020)DenseNet-16195.3
DeiT (Touvron et al., 2021)DeiT-B92.4
SwinT (Liu et al., 2021)SwinT-B94.5
TransFG (He et al., 2021)ViT-B/1694.1
AFTrans (Zhang et al., 2021)ViT-B/1695.0
ViT-NeTDeiT-B94.7
ViT-NeTSwinT-B95.0
+ +† 224 image input + +196 classes, including 8,144 images for training and 8,041 images for testing. As shown in Table 3, the proposed ViT-NeT based on SwinT-B showed a top-1 accuracy of $95.0\%$ . This accuracy is equivalent to that of AFTrans (Zhang et al., 2021), which achieves a SOTA performance among the ViT-based methods. The CNN-based SOTA method API-Net (Zhuang et al., 2020) employs a complex DenseNet-161 and an anti-perturbation inference design with a generative prediction strategy to exploit the discriminative features, achieving a top-1 accuracy of $95.3\%$ . However, this method has a disadvantage in that it takes a long time to learn and test because of the complex network. By combining a NeT, ViT-NeT improves the performance of the base encoders, DeiT and SwinT. Combining proposed NeT model with DeiT-B and SwinT-B, we found that the performance improved by $2.3\%$ and $0.5\%$ compared to base DeiT and SwinT, respectively. + +Table 4. Ablation study between pooling methods on CUB-200-2011 dataset. + +
PoolingTop-1 (%)
GAP91.4
GMP91.6
+ +Table 5. Ablation study on the contextual transformer module on CUB-200-2011 dataset. + +
BackboneUse CTMTop-1 (%)
DeiT-BX89.3
✓90.1
SwinT-BX90.7
✓91.6
+ +In experiments on three datasets, we commonly found that performance could be significantly improved by combining NeT with base ViTs. When the Swin transformer was used as the backbone of NeT, the overall performance was high, but the Stanford Dogs dataset showed slightly lower performance. Therefore, it is necessary to improve the performance of NeT's CMT and leaf prediction module so that it can consistently achieve high performance regardless of the backbone and dataset type. + +# 4.3. Ablation Study + +Effectiveness of tree depth We graphed the performance changes using the tree depth, which is a key factor defining a tree architecture. To validate the effectiveness of the tree height, we defined five variants with different depths \{3, 4, 5, 6, 7\} of trees on the CUB-200-2011, Stanford Dogs and Stanford Cars datasets. As shown in Figure 3, the proposed ViT-NeT achieves the best performance when the depth of the tree is set to 4 in CUB-200-2011 dataset. In the case of a depth of 3, the model has a limited capacity, which is insufficient for representing subtle differences in the dataset. Conversely, when the depth of the tree is set to over 5, an excessive number of trainable parameters for the dataset lead the model to an overfitting, as shown in Figure 4. This issue can also be validated through a sequential analysis of the decision-making process, and it can be confirmed that the activations are derived from the overlapping characteristics of the given image. + +In the case of the Stanford Cars and Stanford Dogs datasets, a significant performance was shown when the tree depth was 5 or more. In the case of the Stanford Cars dataset, there was no significant difference in the performance depending on the tree depth, and the best performance occurred at a depth of 6. Similarly, in the Stanford Dogs dataset, the best performance was achieved at a depth of 6, although the performance difference was larger with the tree depth. From + +![](images/f6d84467ed7d44ab37db079a919782a0ec7b841405a40f3bad02cf3a3bb9e72d.jpg) +Figure 3. Top-1 Accuracy of a ViT-NeT with effect of the depth of the neural tree decoder on CUB-200-2011, Stanford Dogs and Stanford Cars. + +![](images/43794426bdf85e33d55a8ba80b08a19e73835fc545163af61972681fc2993836.jpg) +Figure 4. Prototype responses of a specific decision path in the NeT with the depth of 5. As the tree depth increases, model overfitting occurs, resulting in identical prototype responses at the tip of the bird's wing. + +the experiment results, we can see that the tree depth of NeT should differ according to the complexity of the dataset, and that increasing the depth does not improve the performance but rather leads to an overfitting. + +Effectiveness of leaf nodes Leaf nodes play an important role in projecting routed patches into subcategorical spaces. In Section 3, we suggest that each leaf node be configured with the local projection and global guidance projection. To allow the leaves to learn robust condensed patches, we considered two options: GAP and GMP. From the comparison results presented in Table 4, we found that using GMP leads to the top-1 accuracy $(0.2\%)$ , beating out the GAP, on the CUB-200-2011 dataset. We identified that the GMP operation can gather more contextual information by focusing on the maximum response of the patches rather than encouraging a leaf to focus on the average responses between patches. + +Effectiveness of contextual transformer module We designed a neural tree decoder using a CTM at all tree edges. We believe that the CTM enhances the global context information between discretized patches. To evaluate the + +![](images/b2a126b46baca35b0d088b8c47a104165eec74e2a4d3b0029a7f16e4f7675121.jpg) +Figure 5. Visualized local interpretations showing sequential decision-making on randomly sampled images. The proposed NeT found tails, beaks, wings, feathers, claws, and eyes in the given images. + +effectiveness of the CTM, we conducted a performance comparison on two backbone networks with two variants, i.e., $w/CTM$ and $wo/CTM$ . As shown in Table 5, when using DeiT as the backbone with the CTM of ViT-NeT, the top-1 accuracy is increased from $89.3\%$ to $90.1\%$ . Similarly, when SwinT is used as the backbone with the CTM of ViT-NeT, the top-1 accuracy increases from $90.7\%$ to $91.6\%$ . We confirm that the CTM can fuse various types of global context information within the condensed image patches for achieving a better performance. + +# 4.4. Qualitative Analysis + +We present an intrinsically interpretable NeT method. To validate the interpretability of the decision-making, we provide qualitative evaluations that show visualized sequential decision-making against randomly sampled images. Figure 5 shows the validation results of the decision path for a given image. To visualize a practical decision-making procedure, we redefine the decision routing in a hard decision manner, which greedily feeds condensed image patches to a specific child node with a larger routing score. As shown in this figure, The proposed NeT finds local discriminative regions in a human-friendly manner. Similar to (Chen et al., 2018; Nauta et al., 2021), some results attempt to interpret + +the background. Owing to the nature of the dataset, it is difficult to state that it is completely incorrect because the species of bird may be divided according to the habitat. For example, because auklets live in the sea, there may be a lot of water or stones in the background, whereas flycatchers mainly feed on insects, and thus they may be surrounded by trees or grass. We found that the results of the prototype trained at the root node from the proposed model are somewhat different from the results of the leaf. In the root node, there are cases in which the prototype mainly focuses on the color or texture, which may divide a large feature space into sub-decision regions owing to the nature of the binary tree. + +# 5. Conclusion + +A CNN and ViT, which are leading SOTA approaches in image classification, both have a flaw in that they are black-box models that cannot clearly explain or interpret the prediction results. The ViT-NeT proposed in this paper uses the ViT backbone to extract high-quality local and global features as well as attention information, and applies a new NeT designed to present the decision-making and image explanation for the classification process. Although existing fine-grained visual categorization methods have a trade-off + +between interpretability and performance, the proposed ViT-NeT achieves a newly demonstrated SOTA performance and excellent interpretability on the benchmark dataset without any trade-offs. + +# Acknowledgements + +This research was supported by Basic Science Research Program through the National Research Foundation of Korea (NRF) funded by the Ministry of Education(2021R1A6A3A13039438) and (2022R1I1A3058128). + +# References + +Abnar, S. and Zuidema, W. Quantifying attention flow in transformers. arXiv preprint arXiv:2005.00928, 2020. +Alaniz, S., Marcos, D., Schiele, B., and Akata, Z. Learning decision trees recurrently through communication. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 13518-13527, 2021. +Balestriero, R. Neural decision trees. arXiv preprint arXiv:1702.07360, 2017. +Balikas, G., Moura, S., and Amini, M.-R. Multitask learning for fine-grained twitter sentiment analysis. Proceedings of the 40th International ACM SIGIR Conference on Research and Development in Information Retrieval, 2017. +Binder, A., Montavon, G., Lapuschkin, S., Müller, K.-R., and Samek, W. Layer-wise relevance propagation for neural networks with local renormalization layers. In International Conference on Artificial Neural Networks, pp. 63-71. Springer, 2016. +Chattopadhyay, A., Sarkar, A., Howlader, P., and Balasubramanian, V. N. Grad-cam++: Generalized gradient-based visual explanations for deep convolutional networks. In 2018 IEEE winter conference on applications of computer vision (WACV), pp. 839-847, 2018. +Chen, C., Li, O., Tao, C., Barnett, A. J., Su, J., and Rudin, C. This looks like that: deep learning for interpretable image recognition. arXiv preprint arXiv:1806.10574, 2018. +Chen, H., Zhang, H., Boning, D., and Hsieh, C.-J. Robust decision trees against adversarial examples. In International Conference on Machine Learning, pp. 1122-1131. PMLR, 2019a. +Chen, T. and Guestrin, C. Xgboost: A scalable tree boosting system. In Proceedings of the 22nd acm sigkdd international conference on knowledge discovery and data mining, pp. 785-794, 2016. + +Chen, Y., Bai, Y., Zhang, W., and Mei, T. Destruction and construction learning for fine-grained image recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5157-5166, 2019b. +Dorogush, A. V., Ershov, V., and Gulin, A. Catboost: gradient boosting with categorical features support. arXiv preprint arXiv:1810.11363, 2018. +Dosovitskiy, A., Beyer, L., Kolesnikov, A., Weissenborn, D., Zhai, X., Unterthiner, T., Dehghani, M., Minderer, M., Heigold, G., Gelly, S., et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020. +Du, R., Chang, D., Bhunia, A. K., Xie, J., Ma, Z., Song, Y.-Z., and Guo, J. Fine-grained visual classification via progressive multi-granularity training of jigsaw patches. In European Conference on Computer Vision, pp. 153-168. Springer, 2020. +Dubey, A., Gupta, O., Raskar, R., and Naik, N. Maximum-entropy fine grained classification. In Bengio, S., Wallach, H., Larochelle, H., Grauman, K., Cesa-Bianchi, N., and Garnett, R. (eds.), Advances in Neural Information Processing Systems, volume 31. Curran Associates, Inc., 2018. URL https://proceedings.neurips.cc/paper/2018/file/0c74b7f78409a4022a2c4c5a5ca3ee19-Paper.pdf. +Fu, J., Zheng, H., and Mei, T. Look closer to see better: Recurrent attention convolutional neural network for fine-grained image recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), July 2017. +Ge, W., Lin, X., and Yu, Y. Weakly supervised complementary parts models for fine-grained image classification from the bottom up. Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 3029-3038, 2019. +He, J., Chen, J.-N., Liu, S., Kortylewski, A., Yang, C., Bai, Y., Wang, C., and Yuille, A. Transfg: A transformer architecture for fine-grained recognition. arXiv preprint arXiv:2103.07976, 2021. +He, K., Zhang, X., Ren, S., and Sun, J. Deep residual learning for image recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 770-778, 2016. +Hinton, G., Vinyals, O., and Dean, J. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015. + +Itaya, H., Hirakawa, T., Yamashita, T., Fujiyoshi, H., and Sugiura, K. Visual explanation using attention mechanism in actor-critic-based deep reinforcement learning. arXiv preprint arXiv:2103.04067, 2021. +Jaderberg, M., Simonyan, K., Zisserman, A., et al. Spatial transformer networks. Advances in neural information processing systems, 28:2017-2025, 2015. +Ji, R., Wen, L., Zhang, L., Du, D., Wu, Y., Zhao, C., Liu, X., and Huang, F. Attention convolutional binary neural tree for fine-grained visual categorization. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 10468-10477, 2020. +Ke, G., Meng, Q., Finley, T., Wang, T., Chen, W., Ma, W., Ye, Q., and Liu, T.-Y. Lightgbm: A highly efficient gradient boosting decision tree. Advances in neural information processing systems, 30:3146-3154, 2017. +Khosla, A., Jayadevaprakash, N., Yao, B., and Li, F.-F. Novel dataset for fine-grained image categorization: Stanford dogs. In Proc. CVPR Workshop on Fine-Grained Visual Categorization (FGVC), volume 2. CiteSeer, 2011. +Kim, S., Jeong, M., and Ko, B. C. Lightweight surrogate random forest support for model simplification and feature relevance. Applied Intelligence, pp. 1-11, 2021. +Kontschieder, P., Fiterau, M., Criminisi, A., and Bulo, S. R. Deep neural decision forests. In 2015 IEEE International Conference on Computer Vision (ICCV), pp. 1467-1475, 2015. +Krause, J., Deng, J., Stark, M., and Fei-Fei, L. Collecting a large-scale dataset of fine-grained cars. 2013. +Liu, C., Xie, H., Zha, Z.-J., Ma, L., Yu, L., and Zhang, Y. Filtration and distillation: Enhancing region attention for fine-grained visual categorization. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pp. 11555-11562, 2020. +Liu, Z., Lin, Y., Cao, Y., Hu, H., Wei, Y., Zhang, Z., Lin, S., and Guo, B. Swin transformer: Hierarchical vision transformer using shifted windows. arXiv preprint arXiv:2103.14030, 2021. +Lundberg, S. M. and Lee, S.-I. A unified approach to interpreting model predictions. In Proceedings of the 31st international conference on neural information processing systems, pp. 4768-4777, 2017. +Lundberg, S. M., Erion, G., Chen, H., DeGrave, A., Prutkin, J. M., Nair, B., Katz, R., Himmelfarb, J., Bansal, N., and Lee, S.-I. From local explanations to global understanding with explainable ai for trees. Nature Machine Intelligence, 2(1):2522-5839, 2020. + +Luo, W., Yang, X., Mo, X., Lu, Y., Davis, L. S., Li, J., Yang, J., and Lim, S.-N. Cross-x learning for fine-grained visual categorization. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), October 2019. +Luo, W., Zhang, H., Li, J., and Wei, X.-S. Learning semantically enhanced feature for fine-grained image classification. IEEE Signal Processing Letters, 27:1545-1549, 2020. doi: 10.1109/LSP.2020.3020227. +Miller, G. A. Wordnet: a lexical database for english. Communications of the ACM, 38(11):39-41, 1995. +Nauta, M., van Bree, R., and Seifert, C. Neural prototype trees for interpretable fine-grained image recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 14933-14943, 2021. +Ribeiro, M. T., Singh, S., and Guestrin, C. "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, San Francisco, CA, USA, August 13-17, 2016, pp. 1135-1144, 2016. +Samek, W., Wiegand, T., and Müller, K.-R. Explainable artificial intelligence: Understanding, visualizing and interpreting deep learning models. arXiv preprint arXiv:1708.08296, 2017. +Selvaraju, R. R., Cogswell, M., Das, A., Vedantam, R., Parikh, D., and Batra, D. 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. +Shrikumar, A., Greenside, P., and Kundaje, A. Learning important features through propagating activation differences. In International Conference on Machine Learning, pp. 3145-3153. PMLR, 2017. +Tanno, R., Arulkumaran, K., Alexander, D., Criminisi, A., and Nori, A. Adaptive neural trees. In International Conference on Machine Learning, pp. 6166-6175. PMLR, 2019. +Touvron, H., Cord, M., Douze, M., Massa, F., Sablayrolles, A., and Jégou, H. Training data-efficient image transformers & distillation through attention. In International Conference on Machine Learning, pp. 10347-10357. PMLR, 2021. +Wah, C., Branson, S., Welinder, P., Perona, P., and Belongie, S. The caltech-ucsd birds-200-2011 dataset. 2011. + +Wan, A., Dunlap, L., Ho, D., Yin, J., Lee, S., Petryk, S., Bargal, S. A., and Gonzalez, J. E. NBDT: neural-backed decision tree. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021. OpenReview.net, 2021. URL https://openreview.net/forum?id=mCLVeEpplNE. +Wang, Y., Morariu, V. I., and Davis, L. S. Learning a discriminative filter bank within a cnn for fine-grained recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018. +Yang, Z., Luo, T., Wang, D., Hu, Z., Gao, J., and Wang, L. Learning to navigate for fine-grained classification. In Proceedings of the European Conference on Computer Vision (ECCV), September 2018. +Zhang, Y., Cao, J., Zhang, L., Liu, X., Wang, Z., Ling, F., and Chen, W. A free lunch from vit: Adaptive attention multi-scale fusion transformer for fine-grained visual recognition. arXiv preprint arXiv:2110.01240, 2021. +Zheng, H., Fu, J., Mei, T., and Luo, J. Learning multi-attention convolutional neural network for fine-grained image recognition. In 2017 IEEE International Conference on Computer Vision (ICCV), pp. 5209-5217, 2017. +Zheng, H., Fu, J., Zha, Z.-J., and Luo, J. Learning deep bilinear transformation for fine-grained image representation. In Wallach, H., Larochelle, H., Beygelzimer, A., d'Alché-Buc, F., Fox, E., and Garnett, R. (eds.), Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019a. URL https://proceedings.neurips.cc/paper/2019/file/959ef477884b6ac2241b19ee4fb776ae-Paper.pdf. +Zheng, H., Fu, J., Zha, Z.-J., and Luo, J. Looking for the devil in the details: Learning trilinear attention sampling network for fine-grained image recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2019b. +Zhuang, P., Wang, Y., and Qiao, Y. Learning attentive pairwise interaction for fine-grained classification. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pp. 13130-13137, 2020. \ No newline at end of file diff --git a/vitnetinterpretablevisiontransformerswithneuraltreedecoder/images.zip b/vitnetinterpretablevisiontransformerswithneuraltreedecoder/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..4597bdabf04457fc0b0a0cc2c20c7d39b156550e --- /dev/null +++ b/vitnetinterpretablevisiontransformerswithneuraltreedecoder/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0eb8c5d389fb616d44ac951749ec5aa6737e0c1af0688691ecdbdebe942d5fc3 +size 581472 diff --git a/vitnetinterpretablevisiontransformerswithneuraltreedecoder/layout.json b/vitnetinterpretablevisiontransformerswithneuraltreedecoder/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..7167ddde6b8f7f0348669806e4e2e2245223059e --- /dev/null +++ b/vitnetinterpretablevisiontransformerswithneuraltreedecoder/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:486ebef5290324df2579dbcd54084262697ea1fe187ce4b4fc8e9fbc60532695 +size 339002 diff --git a/volatilitybasedkernelsandmovingaveragemeansforaccurateforecastingwithgaussianprocesses/63a6014e-1682-4960-b55c-1eaa25f2b0de_content_list.json b/volatilitybasedkernelsandmovingaveragemeansforaccurateforecastingwithgaussianprocesses/63a6014e-1682-4960-b55c-1eaa25f2b0de_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..df0656c7ed6f83870e396f3f25c06c153d364d6b --- /dev/null +++ b/volatilitybasedkernelsandmovingaveragemeansforaccurateforecastingwithgaussianprocesses/63a6014e-1682-4960-b55c-1eaa25f2b0de_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c5f190c56f4c16d1c2e23f92c50d20ee4233c8d68e7e62eeda9ff4fec095be9c +size 121996 diff --git a/volatilitybasedkernelsandmovingaveragemeansforaccurateforecastingwithgaussianprocesses/63a6014e-1682-4960-b55c-1eaa25f2b0de_model.json b/volatilitybasedkernelsandmovingaveragemeansforaccurateforecastingwithgaussianprocesses/63a6014e-1682-4960-b55c-1eaa25f2b0de_model.json new file mode 100644 index 0000000000000000000000000000000000000000..8f5037155faa38961b35458860ff1ab21faa30b4 --- /dev/null +++ b/volatilitybasedkernelsandmovingaveragemeansforaccurateforecastingwithgaussianprocesses/63a6014e-1682-4960-b55c-1eaa25f2b0de_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:455ef7102c45915c3400db6529179c13bef34f9eadf45b4bc66d6acc3ccb86f6 +size 145852 diff --git a/volatilitybasedkernelsandmovingaveragemeansforaccurateforecastingwithgaussianprocesses/63a6014e-1682-4960-b55c-1eaa25f2b0de_origin.pdf b/volatilitybasedkernelsandmovingaveragemeansforaccurateforecastingwithgaussianprocesses/63a6014e-1682-4960-b55c-1eaa25f2b0de_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b3dce7dc195a0b068087850790ca0fcb6e3e152f --- /dev/null +++ b/volatilitybasedkernelsandmovingaveragemeansforaccurateforecastingwithgaussianprocesses/63a6014e-1682-4960-b55c-1eaa25f2b0de_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a513d2e46bc3ef9161ea52821df1cba813ed738951707a4cba3d60d9addb5d1d +size 934783 diff --git a/volatilitybasedkernelsandmovingaveragemeansforaccurateforecastingwithgaussianprocesses/full.md b/volatilitybasedkernelsandmovingaveragemeansforaccurateforecastingwithgaussianprocesses/full.md new file mode 100644 index 0000000000000000000000000000000000000000..6a0537c56f1f58a8eefb4677ef553ccea67e3012 --- /dev/null +++ b/volatilitybasedkernelsandmovingaveragemeansforaccurateforecastingwithgaussianprocesses/full.md @@ -0,0 +1,558 @@ +# Volatility Based Kernels and Moving Average Means for Accurate Forecasting with Gaussian Processes + +Greg Benton $^{*1}$ Wesley J. Maddox $^{*1}$ Andrew Gordon Wilson + +# Abstract + +A broad class of stochastic volatility models are defined by systems of stochastic differential equations. While these models have seen widespread success in domains such as finance and statistical climatology, they typically lack an ability to condition on historical data to produce a true posterior distribution. To address this fundamental limitation, we show how to re-cast a class of stochastic volatility models as a hierarchical Gaussian process (GP) model with specialized covariance functions. This GP model retains the inductive biases of the stochastic volatility model while providing the posterior predictive distribution given by GP inference. Within this framework, we take inspiration from well studied domains to introduce a new class of models, Volt and Magpie, that significantly outperform baselines in stock and wind speed forecasting, and naturally extend to the multitask setting. + +# 1. Introduction + +Gaussian processes (GP) have had significant success in time series modeling, making them strong candidates for the challenging tasks of modeling and forecasting time dependent financial and climatological data. However, building GPs has historically relied on selecting out-of-the-box kernels and mean functions that make assumptions that do not hold for all cases; for example, Matérn and RBF kernels assume stationarity of the data, and constant or linear means assume that the underlying trends in the data are not time-varying. While the quest to build more flexible GPs has led to a significant amount of research into kernel functions such as spectral mixture and deep kernels, these kernels have been primarily developed for general problems, rather than constructing a kernel from prior knowledge about the + +![](images/87c016ea19ef2278b07d441ba8c2a8b703f7d275b28f21e211f06729fcb04b57.jpg) +Figure 1. An overview of stochastic volatility, Volt, and forecasting. Top: the observed data over and the corresponding volatility path. Middle: the learned volatility from the data, and volatility forecasts. Bottom: the data over 1 year and forecasts, with each sample path corresponding to a distinct sample from the volatility forecast. + +task at hand. In this work, we approach GP modeling by building on domain knowledge to construct a novel set of kernel and mean functions with inductive biases well suited for forecasting in domains such as finance and climatology, where the data evolves stochastically through time. + +Both financial and climatological time series are nonstationary, and are characterized by having time-varying and stochastic volatilities, or degrees of variation. Motivated by stochastic volatility (SV) models, we develop a hierarchical GP model with specialized kernels, terming the model Volt Bollerslev (1986); Wilson and Ghahramani (2010); Hagan et al. (2002). Volt uses forecasts of volatility to specify the covariance structure over future data observations. By considering not only a single volatility forecast, but a distribution of volatility forecasts, we induce a distribution over covariance functions in the data domain. Accounting for un + +certainty in volatility and propagating it to our data forecasts yields projected distributions that are well calibrated to the data, providing critical tools for understanding risk levels and simulating potential outcomes. For further information on stochastic volatility see Appendix A.1. + +Figure 1 provides a graphical representation of the hierarchical GP model described by Volt. Given a set of observations (top row) we infer a volatility path over those returns (middle row), and form a hierarchical GP model where the first GP models volatility, and the second GP is used to forecast distributions over the data given samples from the volatility GP (bottom row). + +The covariance structure described by Volt provides a faithful representation of the uncertainty in forecasts, but overlooks the mean function of the data space GP, which is a powerful tool for capturing trends in data. To that end, we jointly introduce Moving Average Gaussian Processes, or Magpie, in which we replace the standard parametric mean function in GPs with a moving average. Moving averages are a widely used technique in domains such as climatology and finance (Nau, 2014). By joining the trend fitting capabilities of moving averages with the probabilistic framework of GPs we can produce forecasts that are both accurate and have calibrated uncertainties. + +While Volt and Magpie can be used separately, we present them as a single work because it is specifically their combination that solves challenging forecasting problems. In time evolving domains like stock prices or wind speeds, the inherent randomness of the processes prevents us from producing accurate point estimates far out into the future, and we need just accuracy, but uncertainty that is faithful to the stochasticity of the data. For this reason one needs both the accurate trend capture provided by Magpie, and the accurate uncertainty representation provided by Volt + +Our key contributions are as follows: + +- Deriving a hierarchical GP model, Volt, inspired by stochastic volatility models that produces calibrated forecasts of stochastic time series (Section 3). +- Describing a simple but powerful mean function, Magpie, that enables Gaussian process models to accurately forecast trends (Section 3). +- Using Volt and Magpie to produce highly calibrated forecasts in financial and climatological domains (Section 4). +- Extending our procedure to multitask problems by accounting for correlations in both volatility and price across different financial assets and different spatial locations (Section 5). +- We make code available here. + +# 2. Related Work + +Early autoregressive approaches to modeling the volatility of time series returns such as GARCH have seen widespread success (Bollerslev, 1986). These approaches typically view the volatility process as a time-evolving series, and are effective for inferring and forecasting volatility, but do not typically interface directly with a model over data as we have with Volt. + +Volatility models have been extended to use both neural networks or Gaussian processes as their base components. For example, Cao et al. (2020) use a multi-layer perceptron to estimate volatility surfaces while Luo et al. (2018) use RNNs with rollouts to forecast volatility into the future but only considered one-step lookahead price forecasts. Wilson and Ghahramani (2010) use Gaussian processes to parameterize the volatility using Laplace approximations and MCMC sampling introducing the Gaussian process copula volatility model (GPCV), while Wu et al. (2014) used GP state space models and particle filters to estimate volatility. Similar to Wilson and Ghahramani (2010), Lázaro-Gredilla and Titsias (2011) used Gaussian processes to parameterize volatility models with an exponential link, but used a highly structured variational approximation for inference. Liu et al. (2020) used multi-task Gaussian processes to forecast volatility into the future, applying their models to foreign exchange currency returns, again with one-step lookahead forecasts in price. Crucially, predicting volatility alone does yield a straightforward path to forecast data, which is our central aim with Volt. Furthermore, Volt builds off of the GPCV, but other volatility estimation methods such as the ones described here could also be used. + +Stochastic volatility models such as the Heston model (Heston, 1993) and SABR (Hagan et al., 2002), treat the evolution of the price of a security and the associated volatility as a coupled system of SDEs. Such SDEs are commonly used as methods for pricing financial derivatives. Differing from our viewpoint, these models are typically used to price stock options under risk-neutral measures, with Volt and Magpie we are focused on performing predictive inference by conditioning on observations. + +The connection between Gaussian processes and SDEs has been extensively studied by Särkkä and Solin (2019) who suggest Kalman filtering based approaches for estimating GP hyperparameters in SDE-inspired GP models, which we do not consider here, preferring simply marginal likelihood based estimation. Systems of linear differential equations have been integrated into GP models previously via latent force models both for ordinary differential equations (Alvarez et al., 2009) and partial differential equations (Särkkä, 2011). To perform inference, Alvarez et al. (2009) derive covariances corresponding to the linear projection of the differential operator onto a specific kernel, while Särkkä + +(2011); Särkkä and Solin (2019) use the projection operator explicitly to develop kernel functions to emulate systems of SDEs. Similarly, Zhu and Dunson (2013) use SDEs to derive a nested GP, but their approach produces a standard GP with a non-deep, but structured, covariance function. Autoregressive mean functions for GPs have been explored in Gonzalvez et al. (2019), however in their approach they use autoregressive features as inputs to a GP model, rather than as a way to specify the prior functions. + +While many of the references above are focused specifically on finance, Volt and Magpie are applicable to a broad set of domains including climate modeling. Autoregressive and volatility models have successfully been applied to domains such as wind and precipitation forecasting as in Mehdizadeh et al. (2020); Liu et al. (2011) and Tian et al. (2018). + +The Gaussian process autoregressive model (Requeima et al., 2019) stacks Gaussian processes of different tasks, using the GP for one task as the mean function for the next. It thus bears only slight resemblance to our moving average or multi-task approaches. Furthermore, many well-studied autoregressive models, e.g. the AR(p) family, can be written as Gaussian processes (Williams, 2010). As an alternative to developing domain specific kernel functions, one could alternatively construct manual combinations of generic kernels, which either requires significant amounts of hand-tuning as in Rasmussen and Williams (2008, Ch 5.4,) or solving discrete optimization problems (Lloyd et al., 2014; Sun et al., 2018). As we wish to develop our models efficiently and succinctly, we also do not consider these models. + +# 3. Methods + +We first begin with a brief overview of Gaussian process regression models, before deriving the Volt kernel and Magpie mean functions in Section 3.1. After deriving the Volt kernel and Magpie mean, we explain the inference procedure in Section 3.2 and how we perform forecasting in Section 3.3. + +Gaussian Processes Please see Rasmussen and Williams (2008) for a more detailed introduction to Gaussian processes (GPs). We assume noisy observations $y(t)\sim \mathcal{N}(f(t),\sigma^2)$ , where $f\sim \mathcal{GP}(\mu (t),k(t,t'))$ , so that $\sigma$ is the observation noise and $f$ is drawn from a GP with mean function $\mu (t)$ and $k(t,t')$ as the covariance function. When using GPs, we can compute the posterior predictive distribution, $p(f(\mathbf{t}^{*})|\mathcal{D})$ , $\mathcal{D}\coloneqq \{\mathbf{t},\mathbf{y}\}$ , over new data points $\mathbf{t}^*$ is given by $p(f(\mathbf{t}^{*})|\mathcal{D},\theta) = \mathcal{N}(\mu_{f|\mathcal{D}}^{*},\Sigma_{f|\mathcal{D}}^{*})$ where $\mu_{f|\mathcal{D}}^{*} = K_{\mathbf{t}^{*}\mathbf{t}}(K_{\mathbf{tt}} + \sigma^{2}I)^{-1}(\mathbf{y} - \mu (\mathbf{t})) + \mu (\mathbf{t}^{*})$ and $\Sigma_{f|\mathcal{D}}^{*} = K_{\mathbf{t}^{*}\mathbf{t}^{*}} - K_{\mathbf{t}^{*}\mathbf{t}}(K_{\mathbf{tt}} + \sigma^{2}I)^{-1}K_{\mathbf{tt}^{*}}$ with $K_{A,B}\coloneqq k(A,B)$ . + +# 3.1. Volt and Magpie + +We make the common assumption that both the data $S(t)$ , and volatility $V(t)$ , have paths with log-normal marginal distributions. We therefore place the following joint SDE structure over $s(t) = \log S(t)$ and $v(t) = \log V(t)$ , + +$$ +d s (t) = \mu_ {s} d t + V (t) d W (t) +$$ + +$$ +d v (t) = - \frac {\sigma^ {2}}{2} d t + \sigma d Z (t). \tag {1} +$$ + +The drift term in Equation (1), $-\frac{\sigma^2}{2} dt$ , arises from the log-transformation of the volatility, and ensures that forecast distributions over volatility have a constant mean (for further details see Appendix B.2). Furthermore, this structure allows us to derive closed form expressions for and auto-covariance functions associated with both log-data and log-volatility, allowing us to define the Volt model. + +Equation (1) gives a relationship between the log-price and log-volatility that is mirrored by many stochastic volatility models, including GARCH and SABR, where the volatility of the price is itself governed by an SDE (Bollerslev, 1986; Hagan et al., 2002). By recasting Equation (1) as a system of GPs we can move from an SDE sampling approach to a proper forecasting system based on historical observations. + +A Gaussian Process Perspective Since for any finite collection of time points, $\mathbf{t} = \{t_i\}_{i=1}^N$ , the observations $v = v(\mathbf{t})$ and $s = s(\mathbf{t})$ each have a multivariate normal distribution, $v$ and $s$ now correspond to Gaussian processes. Therefore we only need to derive the mean and covariance functions of the two processes to fully cast our problem as one of forming predictive distributions from GPs. + +As $v(t)$ is a scaled Wiener process with constant drift term, the autocovariance function is + +$$ +K _ {v} \left(t, t ^ {\prime}\right) = \sigma^ {2} \min \left\{t, t ^ {\prime} \right\} \tag {2} +$$ + +and the mean is $\mu_v(t) = -t\frac{\sigma^2}{2}$ so that, $v(t)\sim$ $\mathcal{GP}(\mu_v(t),K_v(t,t'))$ Conditional on a realization of $V(t) = \exp v(t)$ $s(t)$ is also described by a Gaussian process with $\mathbb{E}[s(t)] = \int_0^t\mu_sdt = t\mu_s$ and, + +$$ +C o v (s (t), s \left(t ^ {\prime}\right)) = \int_ {0} ^ {\min \left\{t, t ^ {\prime} \right\}} V (t) ^ {2} d t = K _ {s} \left(t, t ^ {\prime}; V (t)\right), \tag {3} +$$ + +producing our model over log-data: + +$$ +s (t) \sim \mathcal {G P} \left(t \mu_ {s} + s (0), K _ {s} \left(t, t ^ {\prime}; V (t)\right)\right). \tag {4} +$$ + +The final Volt model is then a hierarchical composition of + +Gaussian processes: + +$$ +v (t) \sim \mathcal {G P} \left(m _ {v} (t), K _ {v} \left(t, t ^ {\prime}\right)\right) +$$ + +$$ +V (t) = \exp (v (t)) \tag {5} +$$ + +$$ +s (t) \sim \mathcal {G P} \left(m _ {s} (t), K _ {s} \left(t, t ^ {\prime}; V (t)\right)\right) \tag {5} +$$ + +$$ +S (t) = \exp {(s (t))}, +$$ + +The log-volatility is distributed as a Gaussian process dependent on the time inputs, the mean $m_v$ , and the volvol hyperparameter $\sigma$ and has a Brownian motion covariance (Eq. 2). Given a realization of a volatility path over time and the parameters of the log-linear mean, the log-price is also distributed as a Gaussian process with covariance given by Eq. 3. To generate predictions using the log-volatility and log-price GPs we first must infer both a volatility path from the observed time series, $S = S(\mathbf{t})$ , and the hyperparameters of both the data and volatility models. A complete derivation of the GPs in Equation (5) is in Appendix B.2. + +Magpie For the sake of deriving the covariance functions associated with the log-data and log-volatility processes, we have left the mean functions of the data GP in Equation (5) as a simple linear function. While we may believe that there are nontrivial trends in the data over time, we also believe that these trends may be more complex than simple polynomial or periodic functions, and in the context of applications like finance and climatology are likely to change over time with evolving market or climatological conditions. + +To address these deficiencies in using simple mean functions in modeling nonstationary signals we replace the simple mean functions typically found in GP models with exponential moving averages (EMA) (Nau, 2014). We use the EMA with a limited number of terms, defined as + +$$ +\begin{array}{l} E M A (\mathbf {s}) _ {i + 1} = \alpha \left[ s _ {i} + (1 - \alpha) s _ {i - 1} + (1 - \alpha) ^ {2} s _ {i - 2} \right. \tag {6} \\ \left. + \dots + (1 - \alpha) ^ {k - 1} s _ {i - (k - 1)} \right] \\ \end{array} +$$ + +where $\alpha = 2 / (k + 1)$ is a hyperparameter governing the smoothing of the moving average. A smaller value of $k$ uses only more recent observations, enabling a closer match of the data, whereas a larger value of $k$ uses more data and smooths the data more. + +While we focus on the EMA in Equation (6), Magpie naturally extends to alternate moving averages, such as lag-corrected moving averages. We provide comparisons of these alternate moving averages, as well as the effect of the $k$ hyperparameter in Appendix Figure 8 and in the extended results of Section 4. With Equation (6) we can define the Magpie mean function as $m_{EMA}(t_{i + 1},\mathbf{s}) = EMA(\mathbf{s})_{i + 1}$ . + +We close this section by noting that moving from a linear to a exponential moving average mean for the GPs breaks the connection with the SDEs described in Section 3.1, making the combination of Volt and Magpie necessarily a practical + +approach, rather than an entirely theoretically motivated approach. + +# 3.2. Inference + +Here we outline the procedure for using a series of price observations to train the hyperparameters of the GPs in Equation 5, and form the associated posterior predictive distributions. In general the training procedure can be thought of as a three step process: a) use a Gaussian Process Copula Volatility (GPCV) model to infer a volatility path, $V$ , given a sequence of observations $S$ , b) learn the hyperparameters of the GP in log-volatility space by maximizing the Marginal Log-Likelihood (MLL) with respect to the GPCV inferred volatility, c) learn the hyperparameters of the GP in log-data space by maximizing the MLL with respect to the observed prices, using the kernel generated by the GPCV inferred volatility path. Note that our use of the GPCV to estimate volatility is a modelling choice and we could alternatively have used any other volatility estimation model such as GARCH. + +Inferring Volatility from Training Data One challenge in formulating the model outlined in Equation (5) is the need to have both data and volatility observations for some range of training observations. To estimate the volatility, we use a variant of Gaussian copula process volatility (GPCV) model first proposed by Wilson and Ghahramani (2010). Our GPCV model uses a warped Gaussian process to model the variability of the responses, $w(t)$ , according to: + +$$ +\begin{array}{l} f (t) \sim \mathcal {G P} \left(c, K _ {v} \left(t, t ^ {\prime}\right)\right) \\ \gamma (f (t)) = \exp \{f (t) \} \tag {7} \\ w (t) \sim \mathcal {N} (0, \gamma^ {2} (f (t))). \\ \end{array} +$$ + +We use the kernel derived from log-volatility SDE in Equation (5) to infer the latent function $f(t)$ , and use variational inference (Hensman et al., 2013; 2015) to train the model. See Appendix B.3 for further details. + +Following Wilson and Ghahramani (2010), we consider the responses as the log-returns of the data, that is: $w(t_{i}) = \log S(t_{i}) - \log S(t_{i - 1})$ . We construct a volatility prediction over times $0,\dots ,t - 1$ by drawing posterior samples from $f(t)$ and passing them through the warping function $\sigma (\cdot)$ ; so our estimate for $V(t)$ is + +$$ +\hat {V} (t) := \frac {1}{J} \sum_ {j = 1} ^ {J} \gamma \left(f _ {j} (t)\right), f _ {j} (t) \sim q (f (t) | w (t), v, \theta), \tag {8} +$$ + +where $q(f(t)|w(t), v, \theta)$ is our approximate posterior distribution over the latent function $f(t)$ . We demonstrate that our approach is able to correctly estimate the true volatility in Figure 1, where the volatility and price are drawn from a SABR volatility model (Hagan et al., 2002). + +Training the Gaussian Processes Given the volatility path associated with the training data learned using a GPCV, we assume a Gaussian process priors over the log-volatility and log-data according to Equation (5). Given the volatility over the training data, the single hyperparameter of the log-volatility model is the $\sigma^2$ term describing the volvol. The hyperparameters of the log-data model are just the parameters of the mean in Equation (5), of which there are none if we are using a non-parametric mean like Magpie. To train we maximize the MLL of the models with respect to their hyperparameters using gradient based optimization (Rasmussen and Williams, 2008, Chapter 5). The total computational cost for inference in Volt, regardless of the use of a Magpie mean, is just the cost of training one variational GP and two standard GP models on evenly spaced data, which can be done efficiently via exploiting the (Toeplitz) structure of the data (Wilson and Nickisch, 2015). + +# 3.3. Predictions + +In Volt, we condition the log-volatility GP on a log-path inferred by GPCV and the log-data GP on historical observations of log-price and draw samples from the posterior distributions, producing a mixture of log-normal distributions over data. Sampling the posterior requires sample $N_{v}$ log-volatility paths, $v^{*}$ , over the test inputs and for each of these we generate a kernel $K_{s}(t,t^{\prime},V^{*})$ , and sample $N_{s}$ data paths, $S^{*} = \exp (s^{*})$ , producing $N_{v}\times N_{s}$ samples. + +In the Gaussian process viewpoint of Section 3.1, standard Monte Carlo simulation of an SDE procedure is equivalent to sampling log-volatility paths, $v^{*} = v(\mathbf{t}^{*})$ , from the prior distributions of Equation (5) up to time $T$ rather than the posterior distribution (Sauer, 2012). With the prior samples of $S_T^* = \exp (s_T^*)$ , we can form a Monte Carlo estimate of future distributions over price. However, the distinction between this type of approach and our approach for sampling with Volt is that Volt samples from the posterior distributions over volatility and data conditional on observations, while the SDE based approaches sample from the prior distribution over volatility. + +Rollout Predictions The Magpie mean only allows for predictions one step ahead, so we do our forecasting in a rollout fashion. That is, we use observations $s_0, \ldots, s_t$ to sample $\hat{s}_{t+1}$ from the GP posterior $p(s_{t+1}|s_0, \ldots, s_t)$ , then condition our GP (and Magpie mean) on $\hat{s}_{t+1}$ in order to sample $\hat{s}_{t+2}$ from the updated GP posterior $p(s_{t+2}|s_0, \ldots, s_t, \hat{s}_{t+1})$ , and so on. These rollout forecasts are critical to the Magpie framework. By sequentially sampling the price forecasts and updating the GP with each observation we allow for trend reversals in the moving average mean in a way that is not possible with other GPs. Rollouts are unnecessary for traditional means because the conditional means over each time step factorize into a single + +multivariate Gaussian distribution. + +# 4. Forecasting + +In both financial and climatological applications we are considering the data as stochastically evolving and are thus interested in forecasting distributions over outcomes, rather than point estimates. For this reason we use calibration and negative log likelihood as our primary measures of interest, rather than an accuracy metric like mean squared error. + +We compute the calibration at percentile $p$ by computing the frequency with which the true observation is less than the empirically computed $p^{th}$ quantile of the forecast distribution. More specifically, for a forecast of the price stock $S$ at time $T$ and percentile $p$ we compute the empirical quantile of the forecast $q_{T}$ where $\hat{\mathbb{P}}(S_{T} < q_{T}) = p$ . We can then compute the calibration at $p$ as the empirically observed frequency of the event $S_{T} < q_{T}$ by calculating $C_{p} = \frac{1}{K}\sum_{k}\mathbb{I}_{\{S_{T_{k}} < q_{T_{k}}\}}$ as the average frequency of $S_{T} < q_{T}$ over $K$ different forecasts. If our forecasts are well calibrated then this empirical frequency will be close to $p$ for each value of $p$ ; therefore by computing the calibration of our forecasts at a range of percentiles, $p$ , we can determine the overall calibration of the forecast distribution. Such a calibration metric is similar to those explored for regression in Kuleshov et al. (2018). + +Note that for accurate calibration to occur in this setting our forecast distribution must match the empirical observations at all quantiles. We could not, for example, just forecast that a price increases some fixed percentage of the time that matches the observed frequency of the price increased and expect to achieve accurate calibration. + +# 4.1. Stock Price and Foreign Exchange Rate Forecasting + +As Volt and Magpie are primarily inspired by financial time series models, forecasting distributions over stock prices is a core application of our approach. We compare Volt and Magpie to baseline models of GPs with standard kernel and mean functions. Along with these GP models, we include probabilistic LSTMs where we optimize a predicted mean and variance at each time step with respect to the negative log-likelihood (NLL) which have been previously used in a quantitative finance setting (Chauhan et al., 2020). All models assume the marginal distributions of the observations are normally distributed, thus we model the log-price of stocks in each case. + +Figure 2 provides a representative comparison of forecasts generated by GPs both with and without Volt and Magpie, and the probabilistic LSTMs used here. Simpler probabilistic models like standard GPs and probabilistic neural networks generally provide overconfident forecasts, and more + +![](images/ec15aecd074d1db56addf1e94f6eb48ac995c89e12bd4a1b935de7849f79f4ac.jpg) +Figure 2. Simulations and forecasts showing the mean and $95\%$ confidence region for various model choices. Probabilistic LSTMs perform well on the training data, but do not extrapolate far from observed data well. Matérn forecasts quickly revert to constant level of uncertainty which leads to overconfidence far away from observations, whereas Volt's increase in uncertainty as we move away from training data produces well calibrated to the data. The constant mean forecasts in both Matérn and Volt fail to pick up the long term trend in the data, which Magpie means accurately capture. The combination of Volt and Magpie, with correct inductive biases in both the kernel and mean functions produces forecasts consistent with trends in the data and with well calibrated uncertainty. + +![](images/2ee1d476c05faf430ba697ef27fceabe4147de48f7c9798c290c0c3cbfa5b4d5.jpg) + +![](images/67f9a2427153ec819b7ad1a99983abdcd5ecc981ea71fa78aad0aad7d1ff6a8f.jpg) + +![](images/55ba4f8b92c3b165b11fd54c70cb4653e804f27597973bf1dea180c7e6dfd88e.jpg) + +![](images/0f1add141d23ba779ff04302a1ef7351daa8f2dfc679c49410034f68bd1b23c7.jpg) + +![](images/d89cae489c8e3e2c51930878a9d34116d3a85802ac5f874106bba1891a699c15.jpg) + +![](images/62c716456a5dffc156992bbd6ca41c95b62c77d2a72863326b89d9cf0d14a4cd.jpg) +Figure 3. Calibration of various approaches on the 2 years of data from the NASDAQ 100. The forecasts generated by standard kernels and probabilistic LSTMs are significantly overconfident, leading to very poor calibration. + +traditional mean functions in GP models do not capture the long range trends that are commonly present in financial time-series data. + +Figure 3 shows the calibration of the compared methods aggregated over thousands of forecasts. We consider stocks in the NASDAQ 100 collection, and a history of two years of daily observations leading up to January 2022. For 25 evenly spaced days we forecast 1000 paths 100 days into the future and compute the calibration curves of the forecasts for the days 75 to 100 days out. + +We see in Figure 3 that Volt is able to remedy a significant overconfidence that is present in alternative methods such as standard GP kernels or probabilistic LSTMs. Furthermore, it is the Magpie mean function that enables the distributions to be centered at the correct values, which is why we see the LSTMs and constant mean GPs showing bias in the calibration plots. Note that for accurate calibration to occur in this setting our forecast distribution must match the empirical observations at all quantiles. We could not, for example, just forecast that a price increases some fixed percentage of the time that matches the observed frequency of the price increased and expect to achieve accurate calibration. + +Table 1 gives the average test negative log likelihood (NLL) values on the stock forecasting task and on the foreign exchange data from Lai et al. (2018). Both variants of the + +
Stock PricesWind Speeds
Volt + Magpie5.88 ± 0.024.28 ± 0.16
Volt + Con.4.69 ± 0.033.38 ± 0.05
Matérn + Magpie9.80 ± 0.2712.13 ± 0.81
Matérn + Con.7.74 ± 0.2118.03 ± 1.90
SM + Magpie147.84 ± 1.84110.07 ± 7.81
SM + Con.80.43 ± 0.5770.14 ± 5.03
LSTM49.95 ± 0.5945.13 ± 1.82
Volt-VHGP + Con.4.76 ± 3.055.75 ± 0.44
Volt-VHGP + Magpie6.97 ± 1.245.91 ± 0.34
GPCV5.45 ± 1.514.89 ± 0.04
+ +Table 1. Negative log likelihoods (NLLs) per test point with 2 standard deviations for the methods compared on both the stock forecasting and wind speed tasks. By accounting for uncertainty in both the volatility and the data forecasts, Volt provides highly accurate test distributions relative to baseline approaches. Volt-VHGP indicates a Volt model where we use variational heteroscedastic GPs from Lázaro-Gredilla and Titsias (2011) in place of GPCV. We provide expanded results including foreign exchange data in Appendix C. In each case the mean and standard deviation are computed over approximately 2 thousand time series 75 to 100 time steps into the future, yielding tens of thousands of individual forecasts. + +Volt model outperform competing methods such as LSTMs, and GPs with Matérn and Spectral Mixture (SM) kernels (Wilson and Nickisch, 2015). Volt with a constant mean is slightly better than with a Magpie mean in terms of NLL, the Magpie mean is key to achieving high calibration, as we see in Figure 3. SM kernels are a highly class of flexible kernel, but rely on there being frequency components in the data, with non-stationary data such as those studied here, the lack of regularity in the data leads to weak performance. + +# 4.2. Wind Speed Forecasting + +Probabilistic forecasting models play an important role in statistical climatology in providing forecast distributions over quantities of interest, such as rainfall or wind speed, that can be used to generate synthetic data or estimate the risk of extreme events. Stochastic volatility models have a + +![](images/0eb54366f90a3c8e753c8786abada496de19c2cd96755e74ed85643f2ae8c167.jpg) +Figure 4. A representative example of observed wind speed and samples of multitask Volt forecasts for two related observation stations. While none of the Volt forecasts perfectly fit the true future observations of wind, each individual roll is a realistic potential realization of wind speed. By generating many plausible outcomes we are able to forecast distributions over wind speed that are highly calibrated to held out test observations. + +history of use in modeling wind speed, but typically these models have been limited to GARCH based approaches (Liu et al., 2011; Tian et al., 2018), and are thus focused on the volatility of wind, rather than forecasting distributions of wind speed itself. + +Here we apply Volt and Magpie to the problem of developing a stochastic weather model for wind speed. We source historical wind data from the U.S. Climate Reference Network (USCRN), with observations taken at 5 minute intervals over the 2021 calendar year at 154 spatial locations in the United States (Diamond et al., 2013). Figure 4 provides an example of what the wind speed observations look like, as well as example Volt forecasts in comparison to ground truth held out data. Each forecast path represents a realistic scenario drawn from a distribution over paths from which the true data would, hypothetically, be a representative candidate. By sampling paths from the forecast distribution over wind speeds we can simulate future observations with accurate probability enabling us to estimate statistics of interest, such as expected wind speed or the probability of extreme events. + +As with stock price forecasting, we are interested in producing forecast distributions that match the ground truth of the data, rather than attempting to generate point predictions. In Figure 5 we compare the calibration of forecasts against the ground truth wind speeds in the forecast windows. Table 1 provides the NLL values of the various approaches. As with stock forecasting, we see that constant means do provide slightly better NLL values than Magpie means, but Volt models are key to producing accurate forecasts. Distinct from stock price forecasting however, is the bounded nature of wind speed. As we do not expect wind speed to grow + +![](images/68a6086305c9922c55699848b0fcfa340eed2e876a0d0db8858d89dc5cb67d33.jpg) +Figure 5. A calibration plot for wind speed, aggregated over hundreds of thousands of distinct forecasts. While probabilistic LSTMs and standard GP models provide competitive baselines, the Volt and Magpie model generates wind speed distribution forecasts that are extremely well calibrated. These calibrated distributions enable us to quickly simulate thousands of scenarios that can be trusted to faithfully represent potential outcomes. + +indefinitely (as we may see with stocks) we forecast with a small amount of mean reversion applied to the GP models. Experimental details, including a sensitivity to the mean reversion can be found in Appendix C.2. + +# 5. Multi-Task Volatility Modelling + +Finally, we extend Volt to model several asset prices at once by using multi-task Gaussian processes with the goal of jointly modelling different time series at once, such as the wind speeds for the continental United States. + +First, we extend the GPCV of Wilson and Ghahramani (2010) to several tasks before then placing a multi-task model over volatility in the hierarchical GP formulation. Our approach enables simultaneous estimation of the time series, its volatility, and the relationships between the time series themselves. + +# 5.1. A Multitask GPCV + +We extend the Gaussian process copula volatility model (GPCV) described in Section 3.2 to model several jointly related volatilities at once by using multi-task Gaussian processes (Bonilla et al., 2007; Alvarez et al., 2012). We assume that all returns and volatilities are observed at once, with $P$ different responses, so that the covariance between the $p$ th and $p'$ th latent Gaussian process is given by: $k([t,p],[t',p']) = K_v(t,t')K_i(p,p')$ where $K_{i}(p,p')$ is a lookup table describing the intertask covariance. The intertask covariance is a $P\times P$ matrix; we can regularize it with a LKJ prior (Lewandowski et al., 2009) or to incorporate side information such as geographic coordinates. + +![](images/db063cb1f80dc4c85d97230effaec64a1009df4ad5343dcb3016b1bb842fd518.jpg) +Figure 6. Left panel: Calibration error of both Volt and MT Volt at the $95\%$ confidence level as a function of time step lookahead over 30 stocks from an entire sector ETF (XLF). While both are well-calibrated, MT Volt preserves well-calibration to longer time steps. Center panel: Estimated correlation matrix of stocks from two different sectors. MT-Volt successfully learns the high volatility correlation amongst the finance sector stocks (first five) with lower correlations between the energy sector stocks (second five). Right panel: Estimated volatility covariance with Boulder, CO. Correlations decrease as the stations go further away. + +![](images/51c3c2f68d9c5f4f2289b640b95f50bd467ab22d4ccabe29d8fe424b42e41060.jpg) + +![](images/5372f0064a0ad49d6ebc4b3d37b105d953de3f04f43e44109bcaa1c514aa982d.jpg) + +We have the multi-task probabilistic model: + +$$ +f _ {p} (t) \sim \mathcal {G P} \left(c, K _ {v} \left(t, t ^ {\prime}\right) K _ {i} \left(p, p ^ {\prime}\right)\right) \tag {9} +$$ + +$$ +w _ {p} (t) \sim \mathcal {N} (0, \exp^ {2} (f _ {p} (t)). +$$ + +Again, we use variational inference to infer the latent posterior distribution over each price's latent Gaussian process, see Appendix B.3 for more details. We also use posterior samples from this multi-task GPCV to estimate volatility, $\hat{V}_p(t)$ , for each stock price $p$ by following Eq. 8. + +In Appendix Figure 11, we simulate price data from a correlated SABR volatility model and use our multi-task GPCV to recover both the volatility as well as the latent correlation structures. This suggests that our inference scheme enables us to accurately recover latent correlations. + +# 5.2. Multi-Task Stock Modeling + +After using a multi-task GPCV to estimate the volatility for us, we then use a multi-task Gaussian process model (Bonilla et al., 2007) to estimate volatility, producing the following probabilistic model: + +$$ +v _ {p} (t) \sim \mathcal {G P} (m _ {v}, K _ {v} (t, t ^ {\prime}) K _ {p} (t, t ^ {\prime})) +$$ + +$$ +V _ {p} (t) = \exp \left(v _ {p} (t)\right) \tag {10} +$$ + +$$ +s _ {p} (t) \sim \mathcal {G P} \left(m _ {s, p} (t), K _ {s, p} \left(t, t ^ {\prime}; V _ {p} (t)\right)\right) \tag {10} +$$ + +$$ +S _ {p} (t) = \exp \left(s _ {p} (t)\right). +$$ + +Conditional on the correlated volatility paths, the prices themselves are independent, so we use $P$ independent Gaussian process models to model the prices. Intuitively, this dependency structure makes sense as we expect exogenous shocks (for example, large scale macroeconomic trends) to affect variability in an asset prices, rather than just directly producing an increase or decrease. + +# 5.3. Multitask Stock Price Prediction + +In Figure 6 left panel, we consider the calibration of both Volt and MT Volt on predictions across five different groupings of stocks each with between 5 and 30 different stocks + +in each group, finding that all models are fairly well calibrated in terms of the calibration error, which is the squared error of the average calibration across bins of the empirical observed calibration of the forecast (Kuleshov et al., 2018). The multi-task models tend to improve calibration over independent models, especially when using Magpie means. We display the results for calibration across time steps, mean absolute error (MAE) and negative log likelihood (NLL) in Appendix C.3. + +In Figure 6 center, we showcase how the multi-task Volt model of volatility can be used to measure the relationships between assets. We considered 10 stocks, five from the financial sector and five from the energy sector. Volt learns strong correlations amongst the stocks in the financial sector and much weaker cross-correlations with the energy stocks. + +# 5.4. Spatiotemporal Wind Modelling + +Finally, we consider multi-task modelling for stochastic weather generation. Here, as we have longitude and latitude coordinates for each of the weather locations, we can incorporate this information into the inter-task covariance matrix by using a geodesic exponential kernel, which is given as $k(x,y) = \exp \{-\arccos (x^{\top}y) / 2\sigma^{2}\}$ for $x,y\in \mathbb{S}^2$ , that is points on the unit sphere (Jayasumana et al., 2013). Note that we have no restrictions on kernel choice and could alternatively consider non-stationary kernels here instead. + +We model 110 stations across the United States in the year 2021 again at 5 minute intervals, estimating the relationship between each station using the geodesic exponential kernel described above, and learning the lengthscale. We display the results in Figure 6 right panel with the stations described on a map of the United States. Further experimental results are shown in Appendix C.3. + +# 6. Conclusion + +We have proposed Volt and Magpie, which use kernels and mean functions derived from stochastic volatility, in order + +to introduce a powerful forecasting method for stochastically generated time series. Volt deviates from the usual assumptions of stochastic differential equation (SDE) models for financial and climatological models, and incorporates historical data through GPs, allowing us to better estimate expectations and forecast distributions. Magpie allows us to replace the often over-simplified mean functions in Gaussian process models with a nonstationary mean leading to forecasts that more closely represent the data. + +We have demonstrated that Volt and Magpie can outperform competing methods in generating forecast distributions of stochastically generated processes, with an emphasis on financial and climatological applications. The strong predictive uncertainties allow our method to be used for price forecasting and weather generation in a reliable way that produces trustworthy forecasts that are well calibrated to observations. Finally, we proposed a multi-task extension to Volt that improves on Volt's predictive calibration while additionally allowing for the estimation of the relationships between several assets at once. + +The potential applications of our approach are broad, with potential uses in financial domains such as automated trading and strategy development, and climatological research in which Volt and Magpie could serve as a backbone for large spatiotemporal climate models. In the future, it would be useful to extend both the single and multi-task models to use online variational inference (Bui et al., 2017; Maddox et al., 2021b) to enable online deployment of scalable forecasting strategies. We hope our work will catalyze further development of domain based prior kernels for Gaussian processes, and applications of probabilistic machine learning to financial climatological data. + +# Acknowledgements + +We would like to thank Andres Potapczynski for helpful discussions. This research is supported by an Amazon Research Award, Facebook Research, Google Research, Capital One, NSF CAREER IIS-2145492, NSF I-DISRE 193471, NIH R01DA048764-01A1, NSF IIS-1910266, and NSF 1922658 NRT-HDR. + +# References + +Alberg, J. and Lipton, Z. C. (2017). Improving factor-based quantitative investing by forecasting company fundamentals. arXiv preprint arXiv:1711.04837. +Alvarez, M., Luengo, D., and Lawrence, N. D. (2009). Latent force models. In Artificial Intelligence and Statistics, pages 9-16. PMLR. +Alvarez, M., Rosasco, L., and Lawrence, N. (2012). Kernels + +for vector-valued functions: a review. Foundations and Trends® in Machine Learning, 4(3):195-266. +Balandat, M., Karrer, B., Jiang, D., Daulton, S., Letham, B., Wilson, A. G., and Bakshy, E. (2020). Botorch: A framework for efficient monte-carlo bayesian optimization. Advances in neural information processing systems, 33. +Benton, G., Maddox, W. J., Salkey, J., Albinati, J., and Wilson, A. G. (2019). Function-space distributions over kernels. Advances in Neural Information Processing Systems, 32:14965-14976. +Bollerslev, T. (1986). Generalized autoregressive conditional heteroskedasticity. Journal of econometrics, 31(3):307-327. +Bonilla, E. V., Chai, K. M., and Williams, C. (2007). Multitask gaussian process prediction. Advances in neural information processing systems, pages 153-160. +Bui, T. D., Nguyen, C. V., and Turner, R. E. (2017). Streaming sparse gaussian process approximations. In Proceedings of the 31st International Conference on Neural Information Processing Systems, pages 3301-3309. +Cao, J., Chen, J., and Hull, J. (2020). A neural network approach to understanding implied volatility movements. Quantitative Finance, 20(9):1405-1413. +Chandorkar, M., Camporeale, E., and Wing, S. (2017). Probabilistic forecasting of the disturbance storm time index: An autoregressive gaussian process approach. *Space Weather*, 15(8):1004–1019. +Chauhan, L., Alberg, J., and Lipton, Z. (2020). Uncertainty-aware lookahead factor models for quantitative investing. In International Conference on Machine Learning, pages 1489-1499. PMLR. +Dai, Z., Álvarez, M. A., and Lawrence, N. D. (2017). Efficient modeling of latent information in supervised learning using gaussian processes. In Proceedings of the 31st International Conference on Neural Information Processing Systems, pages 5137-5145. +Diamond, H. J., Karl, T. R., Palecki, M. A., Baker, C. B., Bell, J. E., Leeper, R. D., Easterling, D. R., Lawrimore, J. H., Meyers, T. P., Helfert, M. R., et al. (2013). Us climate reference network after one decade of operations: Status and assessment. Bulletin of the American Meteorological Society, 94(4):485-498. +Elliott, R. J. and Kopp, P. E. (2001). Mathematics of financial markets. pages 361-380. Springer. + +Engle, R. F. (1982). Autoregressive conditional heteroscedasticity with estimates of the variance of united kingdom inflation. *Econometrica: Journal of the econometric society*, pages 987-1007. +Gardner, J., Pleiss, G., Weinberger, K. Q., Bindel, D., and Wilson, A. G. (2018). Gpytorch: Blackbox matrix-matrix gaussian process inference withgpu acceleration. Advances in Neural Information Processing Systems, 31:7576-7586. +Gonzalvez, J., Lezmi, E., Roncalli, T., and Xu, J. (2019). Financial applications of gaussian processes and bayesian optimization. arXiv preprint arXiv:1903.04841. +Hagan, P. S., Kumar, D., Lesniewski, A. S., and Woodward, D. E. (2002). Managing smile risk. The Best of Wilmott, 1:249-296. +Hamilton, J. D. (2020). Time series analysis. Princeton university press. +Heaukulani, C. and van der Wilk, M. (2019). Scalable bayesian dynamic covariance modeling with variational wishart and inverse wishart processes. In Proceedings of the 33rd International Conference on Neural Information Processing Systems, pages 4582-4592. +Hensman, J., Fusi, N., and Lawrence, N. D. (2013). Gaussian processes for big data. In Proceedings of the Twenty-Ninth Conference on Uncertainty in Artificial Intelligence, pages 282-290. +Hensman, J., Matthews, A., and Ghahramani, Z. (2015). Scalable variational gaussian process classification. In Artificial Intelligence and Statistics, pages 351-360. PMLR. +Heston, S. L. (1993). A closed-form solution for options with stochastic volatility with applications to bond and currency options. The review of financial studies, 6(2):327-343. +Jayasumana, S., Hartley, R., Salzmann, M., Li, H., and Harandi, M. (2013). Combining multiple manifold-valued descriptors for improved object recognition. In 2013 International Conference on Digital Image Computing: Techniques and Applications (DICTA), pages 1-6. IEEE. +Kuleshov, V., Fenner, N., and Ermon, S. (2018). Accurate uncertainties for deep learning using calibrated regression. In International Conference on Machine Learning, pages 2796-2804. PMLR. +Lai, G., Chang, W.-C., Yang, Y., and Liu, H. (2018). Modeling long-and short-term temporal patterns with deep neural networks. In The 41st International ACM SIGIR Conference on Research & Development in Information Retrieval, pages 95-104. + +Lázaro-Gredilla, M. and Titsias, M. K. (2011). Variational heteroscedastic gaussian process regression. In International Conference on Machine Learning. +Lewandowski, D., Kurowicka, D., and Joe, H. (2009). Generating random correlation matrices based on vines and extended onion method. Journal of multivariate analysis, 100(9):1989-2001. +Liu, B., Kiskin, I., and Roberts, S. (2020). An overview of gaussian process regression for volatility forecasting. In 2020 International Conference on Artificial Intelligence in Information and Communication (ICAIIC), pages 681-686. IEEE. +Liu, H., Erdem, E., and Shi, J. (2011). Comprehensive evaluation ofarma-garch(-m)approaches for modeling the mean and volatility of wind speed.Applied Energy, 88(3):724-732. +Lloyd, J., Duvenaud, D., Grosse, R., Tenenbaum, J., and Ghahramani, Z. (2014). Automatic construction and natural-language description of nonparametric regression models. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 28. +Luo, R., Zhang, W., Xu, X., and Wang, J. (2018). A neural stochastic volatility model. In Thirty-second AAAI conference on artificial intelligence. +Maddox, W. J., Balandat, M., Wilson, A. G., and Bakshy, E. (2021a). Bayesian optimization with high-dimensional outputs. Advances in neural information processing systems. +Maddox, W. J., Stanton, S., and Wilson, A. G. (2021b). Conditioning sparse variational gaussian processes for online decision-making. Advances in Neural Information Processing Systems, 34. +Matthews, A. G. d. G. (2017). Scalable Gaussian process inference using variational methods. PhD thesis, University of Cambridge. +Mehdizadeh, S., Kozekalani Sales, A., and Safari, M. J. S. (2020). Estimating the short-term and long-term wind speeds: implementing hybrid models through coupling machine learning and linear time series models. *SN Applied Sciences*, 2:1-15. +Nau, R. (2014). Forecasting with moving averages. *Fuqua School of Business*, Duke University, pages 1-3. +Paszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J., Chanan, G., Killeen, T., Lin, Z., Gimelshein, N., Antiga, L., et al. (2019). Pytorch: An imperative style, high-performance deep learning library. Advances in neural information processing systems, 32:8026-8037. + +Philipov, A. and Glickman, M. E. (2006). Multivariate stochastic volatility via wishart processes. Journal of Business & Economic Statistics, 24(3):313-328. +Rakitsch, B., Lippert, C., Borgwardt, K., and Stegle, O. (2013). It is all in the noise: Efficient multi-task gaussian process inference with structured residuals. Advances in neural information processing systems, 26:1466-1474. +Rasmussen, C. E. and Williams, C. K. I. (2008). Gaussian processes for machine learning. Adaptive computation and machine learning. MIT Press, Cambridge, Mass., 3. print edition. +Requeima, J., Tebbutt, W., Bruinsma, W., and Turner, R. E. (2019). The gaussian process autoregressive regression model (gpar). In *The 22nd International Conference on Artificial Intelligence and Statistics*, pages 1860–1869. PMLR. +Rosenkrantz, W. A. (2003). Why stock prices have a lognormal distribution. Department of Mathematics and Statistics, University of Massachusetts at Amher. +Rouah, F. D. (2007). The sabr model. https://www.frouah.com/finance%20notes/The%20SABR%20Model.pdf. +Särkkä, S. (2011). Linear operators and stochastic partial differential equations in gaussian process regression. In International Conference on Artificial Neural Networks, pages 151-158. Springer. +Särkkä, S. and Solin, A. (2019). Applied stochastic differential equations, volume 10. Cambridge University Press. +Sauer, T. (2012). Numerical solution of stochastic differential equations in finance. In Handbook of computational finance, pages 529-550. Springer. +Sharpe, W. F. (1994). The sharpe ratio. Journal of portfolio management, 21(1):49-58. +Steinruecken, C., Smith, E., Janz, D., Lloyd, J., and Ghahrami, Z. (2019). The automatic statistician. In *Automated Machine Learning*, pages 161–173. Springer, Cham. +Sun, S., Zhang, G., Wang, C., Zeng, W., Li, J., and Grosse, R. (2018). Differentiable compositional kernel learning for gaussian processes. In International Conference on Machine Learning, pages 4828-4837. PMLR. +Tian, S., Fu, Y., Ling, P., Wei, S., Liu, S., and Li, K. (2018). Wind power forecasting based on arima-lgarch model. In 2018 International Conference on Power System Technology (POWERCON), pages 1285-1289. IEEE. + +Williams, C. (2010). Probabilistic Modelling and Reasoning Time Series Modelling: AR, MA, ARMA and All That. +Wilson, A. and Adams, R. (2013). Gaussian process kernels for pattern discovery and extrapolation. In International conference on machine learning, pages 1067-1075. PMLR. +Wilson, A. and Ghahramani, Z. (2010). Copula Processes. In Advances in Neural Information Processing Systems, volume 23, page 9. +Wilson, A. and Nickisch, H. (2015). Kernel interpolation for scalable structured gaussian processes (kiss-gp). In International Conference on Machine Learning, pages 1775-1784. PMLR. +Wilson, A. G. and Ghahramani, Z. (2011). Generalised wishart processes. In Proceedings of the Twenty-Seventh Conference on Uncertainty in Artificial Intelligence, pages 736-744. +Wu, Y., Hernández-Lobato, J. M., and Ghahramani, Z. (2014). Gaussian process volatility model. Advances in Neural Information Processing Systems, 27:1044-1052. +Zhu, B. and Dunson, D. B. (2013). Locally adaptive bayes nonparametric regression via nested gaussian processes. Journal of the American Statistical Association, 108(504):1445-1456. + +# A. Tutorial + +This section should serve as a useful reference on much of the more domain-specific language and methodology used throughout the paper. + +# A.1. Volatility + +In the context of a time series $S_{t}$ , we use volatility, denoted $V_{t}$ , to refer to the standard deviation of the variability in price over some time period. In financial applications we consider stock prices on the daily time scale, and as is standard report volatility as annualized volatility, which corresponds to the volatility of a stock over the course of a year. + +More specifically, we assume that the log returns in observations, $\log \left(\frac{S_{t + 1}}{S_t}\right)$ , are normally distributed with standard deviation $V_{t}$ . In this paper we make the common assumption that the volatility itself is a time varying stochastic process, meaning we expect the magnitude of the daily returns to vary over time. + +Figure 7 provides an example of the connection between price, log returns, and volatility. On the left we have a simulated set of price observations over one year, and in the center we have the associated log returns. Finally, on the right, we have the volatility path overlaid on the returns. We can see that where volatility is high we have larger returns (both positive and negative), and where volatility is low the returns tend to be small. Naturally if we wish to understand how the price will evolve in the future we need to also understand how volatility will evolve. + +![](images/847844ad989b8916ac19308c280b01f6fdfd3fc151ae9d63d10fb5cc0b2dc9f5.jpg) +Figure 7. Left: Price movements over time. Movements tend to be larger up to time $t = 0.5$ Center: Returns over time, as calculated by $S_{t+1} / S_t$ . Here, returns are clearly larger in the first half of the time series. Right: Volatility overlaid with returns for the same price. Volatility is clearly higher when the returns have a larger absolute magnitude, whether positive or negative. + +![](images/effbc5a528b2771980e51f45c2fc891411112183144418a46db624cb70de87af.jpg) + +![](images/0fc3607395c1e0764e0e991b9b95565a8154716620efd4cf3b58be65a4d54c48.jpg) + +# B. Extended Methods + +# B.1. Moving Average Gaussian Processes + +Figure 8 gives an example of how various moving averages (or Magpie prior means) appear given a series of price observations for a stock. On the left, the standard EMA formulation displays a clear lag effect, that is ameliorated by using either Double or Triple moving averages (DEMA and TEMA). On the right, we see how the DEMA moving average varies for different smoothing parameters $k$ ; for larger values the moving average is less sensitive to fluctuations in the data, but exhibits more bias, similarly smaller values of $k$ produce moving averages that more closely match the data, but are susceptible to outliers. + +# B.2. Proofs from Derivations + +Log-Volatility Kernel Function Recall the SDE governing movements in the log-volatility: + +$$ +d v (t) = - \frac {\sigma^ {2}}{2} d t + \sigma d Z (t). \tag {11} +$$ + +We now derive the covariance function $\operatorname{Cov}(v(t), v(t'))$ , assuming without loss of generality, that $t < t'$ . For ease of notation, and as the mean does not affect the covariance structure, let $\tilde{v}(t)$ be the same process as $v(t)$ with the mean trend removed. + +![](images/f689bfbee39a5bb00d87acc57665496df6c3b10f445c132a8330aae14f6c4aca.jpg) +Figure 8. Left: a comparison of EMA, DEMA, and TEMA methods for producing moving averages for $k = 200$ . Note that for a fixed value of $k$ the DEMA and TEMA curves resolve a portion of the lag issue seen in the EMA curve. Right: DEMA curves for various values of $k$ . Increasing $k$ averages over more historical data. + +![](images/36e37571de5da4755fecd79d2db704cb0fe5fd112db4223e2dd5dfc2cbe0ddba.jpg) + +Using independence of increments of the SDE we can determine the covariance as follows: + +$$ +\begin{array}{l} \operatorname {C o v} (v (t), v \left(t ^ {\prime}\right)) = \operatorname {C o v} (v (t) - E [ v (t) ], v \left(t ^ {\prime}\right) - E [ v \left(t ^ {\prime}\right) ]) \\ = \operatorname {C o v} (\tilde {v} (t), \tilde {v} (t ^ {\prime})) \\ = E [ \tilde {v} (t) \tilde {v} (t ^ {\prime}) ] - E [ \tilde {v} (t) ] E [ \tilde {v} (t ^ {\prime}) ] \\ = E [ \tilde {v} (t) \tilde {v} (t ^ {\prime}) ] \\ = E [ \tilde {v} (t) (\tilde {v} (t ^ {\prime}) - \tilde {v} (t)) ] + E [ \tilde {v} (t ^ {\prime}) ^ {2} ] \\ = E [ \tilde {v} (t ^ {\prime}) ^ {2} ] = t ^ {\prime} \sigma^ {2} = \min \{t, t ^ {\prime} \} \sigma^ {2}. \\ \end{array} +$$ + +So finally we have $\operatorname{Cov}(v(t), v(t')) = K_v(t, t') = \min \{t, t'\} \sigma^2$ . + +# Log-Price Kernel Function + +$$ +d s (t) = \mu_ {s} d t + V (t) d W (t) \tag {12} +$$ + +The covariance function of $s(t)$ can be derived using the fact that the $s(t)$ diffusion has independent increments; first assume that $t < t'$ and that $\tilde{s}(t)$ is the same process as $s(t)$ with the mean trend removed. Therefore, + +$$ +\begin{array}{l} \operatorname {C o v} (s (t), s \left(t ^ {\prime}\right)) = \operatorname {C o v} (s (t) - E [ s (t) ], s \left(t ^ {\prime}\right) - E [ s \left(t ^ {\prime}\right) ]) \\ = \operatorname {C o v} \left(\tilde {s} (t), \tilde {s} \left(t ^ {\prime}\right)\right) \\ = E [ \tilde {s} (t) \tilde {s} (t ^ {\prime}) ] - E [ \tilde {s} (t) ] E [ \tilde {s} (t ^ {\prime}) ] \\ = E [ \tilde {s} (t) \tilde {s} (t ^ {\prime}) ] \\ = E [ \tilde {s} (t) (\tilde {s} (t ^ {\prime}) - \tilde {s} (t)) ] + E [ \tilde {s} (t ^ {\prime}) ^ {2} ] \\ = E \left[ \tilde {s} \left(t ^ {\prime}\right) ^ {2} \right], \\ \end{array} +$$ + +now since $E[\tilde{s}(t)] = 0$ , $E[\tilde{s}(t)^2] = \operatorname{Var}(\tilde{s}(t)) = \operatorname{Var}(s(t))$ which is just the integral of the variance of the diffusion in Equation (1), leaving us with + +$$ +C o v (s (t), s \left(t ^ {\prime}\right)) = \int_ {0} ^ {\min \{t, t ^ {\prime} \}} V (t) ^ {2} d t = K _ {s} \left(t, t ^ {\prime}; V (t)\right). +$$ + +# B.3. GPCV Training + +GPCV Likelihood As described in the main text, we model the log returns, $w(t)$ , at time $t$ as independently distributed following the construction of Wilson and Ghahramani (2010). That is, $w(t) \sim \mathcal{N}(0, \gamma^2(t))$ , where $\gamma(t)$ is the latent standard deviation. We choose $\gamma(t) = \exp\{f(t)\}$ , which is equivalent to the parameterization used in Lázaro-Gredilla and Titsias (2011). The exponential parameterization has the nice property that we are also modelling the log prices in the SDE + +formulation described in the rest of the paper, unlike Wilson and Ghahramani (2010)'s softplus transformation of the latent process. Wilson and Ghahramani (2010) also study the exponential parameterization for a few experiments. + +We note that $\gamma(t)$ is a daily volatility and to convert to an annualized volatility like in the rest of the paper, we need to rescale it by a factor of $1 / \sqrt{t}$ , so that $\hat{\gamma}(t) = \gamma(t) / \sqrt{t}$ . + +Inference Scheme Following Hensman et al. (2013; 2015), we want to compute the ELBO as + +$$ +\log p (y) \geq \mathbb {E} _ {q (f)} (\log p (y | f)) - \operatorname {K L} (q (u) | | p (u)), \tag {13} +$$ + +where $p(y|f)$ is the GPCV volatility likelihood and $\mathrm{KL}(q(u)||p(u))$ is the Kullback-Leibler divergence between the variational distribution $q(u) = \mathcal{N}(m,S)$ and the prior $p(u)$ . We need to optimize $q(u)$ , our free form variational distribution and estimate $\mathbb{E}_{q(f)}(\log p(y|f))$ using Bayesian quadrature as in Hensman et al. (2015). + +As $T$ is generally pretty small, we set the inducing points, $u$ , to be the training data points, e.g. $\{t_i\}_{i=1}^T$ . We initialize the variational mean $m$ to be the logarithm of the running standard deviation of the log returns, and the variational covariance to be $K_{uu}(K_{uu} + K_{uu}\Sigma_yK_{uu})^{-1}K_{uu}$ where $\Sigma_y$ is the negative Hessian at the initial value of $m$ . + +Computational and memory costs then run at about $\mathcal{O}(T^3)$ time. In the future, we hope to use sliding windows for the inducing points, enabling mini-batching, reducing the cost to $\mathcal{O}(T_{\mathrm{window}}^3)$ time (Hensman et al., 2015). Finally, our inference scheme is simply a more flexible version of the fixed-form heteroscedastic scheme used in Lázaro-Gredilla and Titsias (2011), which we found to be too inflexible to fit rougher volatility paths well. + +Multi-task Parameterization We follow the ICM-like model parameterization of Dai et al. (2017) by parameterizing $q(u) = \mathcal{N}(m, S_x \otimes S_T)$ and assume that $p(u) = \mathcal{N}(\mu(u), K_{uu} \otimes K_{TT})$ . Then we need to compute $q(f)$ which can be done for single-task models as $q(f) = \mathcal{N}(K_{fu}K_{uu}^{-1}m, K_{ff} + K_{fu}K_{uu}^{-1}(S - K_{uu})K_{uu}^{-1}K_{uf})$ . In the multi-task setting, this is algebraically written as: + +$$ +\begin{array}{l} q (f) = \mathcal {N} ((K _ {f u} \otimes K _ {T T}) (K _ {u u} \otimes K _ {T T}) ^ {- 1} m, \\ \left. \left(K _ {f f} \otimes K _ {T T}\right) + \left(K _ {f u} \otimes K _ {T T}\right) \left(K _ {u u} \otimes K _ {T T}\right) ^ {- 1} \left(S _ {x} \otimes S _ {t} - \left(K _ {u u} \otimes K _ {T T}\right)\right) \left(K _ {u u} \otimes K _ {T T}\right) ^ {- 1} \left(K _ {f u} \otimes K _ {T T}\right) ^ {\top}\right) \\ = \mathcal {N} \left(\left(K _ {f u} K _ {u u} ^ {- 1} \otimes I\right) m, \left(K _ {f f} \otimes K _ {T T}\right) + \left(K _ {f u} K _ {u u} ^ {- 1} \otimes I\right) \left(S _ {x} \otimes S _ {t} - \left(K _ {u u} \otimes K _ {T T}\right)\right) \left(K _ {f u} K _ {u u} ^ {- 1} \otimes I\right) ^ {\top}\right) \\ = \mathcal {N} \left(\left(K _ {f u} K _ {u u} ^ {- 1} \otimes I\right) m, \left(K _ {f f} - K _ {f u} K _ {u u} ^ {- 1} K _ {u f} \otimes K _ {T T}\right) + \left(K _ {f u} K _ {u u} ^ {- 1} S _ {x} K _ {u u} ^ {- 1} K _ {u f} \otimes S _ {t}\right)\right) \tag {14} \\ \end{array} +$$ + +Note that the variational mean term is a batch matrix vector multiplication, while the variational covariance form is a sum of two Kronecker products. Together we can sample from the posterior distribution in $\mathcal{O}(T^3 + P^3)$ time by using Kronecker identities as described in Rakitsch et al. (2013). + +In the multi-task setting, we also initialize the variational covariance to be the average initial covariance across tasks and the variational intertask covariance to be the covariance of $m$ across tasks. The intertask covariance is a $P \times P$ matrix parameterized as rank one plus diagonal; we regularize it with a LKJ prior with $\eta = 5.0$ (Lewandowski et al., 2009). + +Additionally, we exploit Kronecker identities to efficiently compute the KL divergence in the variational distribution so that training stays at $\mathcal{O}(T^3 + P^3)$ time by broadly following the approach of Dai et al. (2017). + +# B.4. Model Training + +All models were trained in GPyTorch (Gardner et al., 2018) and PyTorch (Paszke et al., 2019) on either a single 24GB GPU or a single 12GB GPU; the multi-task wind experiment used a 48GB Titan RTX GPU. Training time was negligible, with models typically taking less than 1 minute to train. For training, we use 500 steps of Adam with learning rate 0.1 and optimize through the log marginal likelihood. + +Multitask GPs We use the ICM model of Bonilla et al. (2007). Like in the GPCV setting, we use a rank one plus diagonal intertask covariance, regularized with a LKJ prior (Lewandowski et al., 2009). By structure exploitation, these models cost $\mathcal{O}(P^3 + T^3)$ for fitting and $\mathcal{O}(P^3 + T^3)$ for posterior sampling when using Matheron's rule (Maddox et al., 2021a). + +Data Space GPs We use a standard Gaussian likelihood for these responses on the log transformed data and optimize both the scale of the volatility as well as the noise term, initializing the noise to be $10^{-4}$ . As these models reduce to a standard exact GP conditional on volatility, computational and memory costs then run at $\mathcal{O}(T^3)$ time. + +# C. Experimental Details + +# C.1. Details from Section 4.1 + +We source daily closing prices for stocks in the Nasdaq 100 for 2 years prior to January 2022. Volt models are trained according to the outline in Section 3.2, and standard GPs are implemented and trained via GPyTorch and BoTorch (Gardner et al., 2018; Balandat et al., 2020). The LSTM model is implemented with 2 hidden layers each with 128 units and takes the form + +$$ +f (s _ {t}, s _ {t - 1}, s _ {t - 2}, s _ {t - 3}, s _ {t - 4}) = \{\hat {\mu} _ {t + 1} \hat {\sigma} _ {t + 1} \} +$$ + +where $\hat{\mu}_{t + 1}$ is the predicted mean at time $t + 1$ , and $\hat{\sigma}_{t + 1}$ is the predicted standard deviation at time $t + 1$ . + +For each stock in our universe we select 25 cutoff times at which we generate forecasts, using the preceding 400 observations as training data. At each cutoff time we forecast the log closing price 100 days into the future, and compute the calibration and negative log likelihood of the forecasts 75 to 100 days out. We specifically focus on longer horizon forecasts, as it is generally a harder task for which out of the box methods are ill-suited. + +
Stock PricesWind SpeedsFX
Volt + Magpie5.88 ± 0.024.28 ± 0.16-1.69 ± 0.02
Volt + Con.4.69 ± 0.033.38 ± 0.05-1.60 ± 0.02
Matérn + Magpie9.80 ± 0.2712.13 ± 0.814.23 ± 0.30
Matérn + Con.7.74 ± 0.2118.03 ± 1.90-0.36 ± 0.04
SM + Magpie147.84 ± 1.84110.07 ± 7.81562.67 ± 15.71
SM + Con.80.43 ± 0.5770.14 ± 5.03356.55 ± 11.98
LSTM49.95 ± 0.5945.13 ± 1.8210.66 ± 0.44
Volt-VHGP + Con.4.76 ± 3.055.75 ± 0.44-1.58 ± 0.03
Volt-VHGP + Magpie6.97 ± 1.245.91 ± 0.34-1.66 ± 0.02
GPCV5.45 ± 1.514.89 ± 0.04-1.79 ± 0.02
+ +Table 2. Negative log likelihoods (NLLs) per test point for the methods compared on both the stock forecasting and wind speed tasks, averaged of tens of thousands of forecasts. While there is a slight improvement in NLL from using a constant mean, the inclusion of Magpie is central to achieving high calibration. + +# C.2. Details from Section 4.2 + +We source data from Diamond et al. (2013) for the 2021 calendar year. Wind measurements are taken at 15 minute intervals for all 154 stations in the observation network. In order to treat the observed wind speed as log-normally distributed we add 1 to each observation (to shift the $0\mathrm{m / s}$ observations to a value of 1), and then model the log of the resulting time series. + +Figure 9 compares the performance of Volt alone and Volt with Magpie mean functions with various smoothing parameters. Magpie means aid in calibration, although the effect is less pronounced as we see with stock forecasting in Figure 3. + +A key distinction between wind speed forecasting and stock price forecasting is that wind speeds tend to revert to a consistent level, whereas stock prices may increase by thousands then stabilize at a new level. For this reason we explore the use of mean reversion in our rollout forecasts. To add mean reversion to the rollouts we simply adjust the posterior mean of the GP towards the mean of the training data by a factor of $\theta$ . That is, rather than sampling from the GP posterior $s_{t^*} \sim \mathcal{N}(\mu_{f|\mathcal{D}}^* |\Sigma_{f|\mathcal{D}}^*)$ we sample from $s_{t^*} \sim \mathcal{N}(\mu_{f|\mathcal{D}}^* - \theta(\mu_{f|\mathcal{D}}^* - \frac{1}{N}\sum_i s_i) | \Sigma_{f|\mathcal{D}}^*)$ . + +In this mean reversion setting, $\theta$ controls the speed at which rollouts tend to revert towards the mean. At $\theta = 0$ we are in the standard GP prediction case, at $\theta = 1$ , we only ever sample from a distribution centered around the mean of the training observations. Figure 10 provides a comparison of the calibration under differing levels of mean reversion for Volt. The standard Volt rollouts are in general well calibrated for this problem, but we see that just a small amount of mean reversion can increase the overall calibration notably. + +# C.3. Details from Section 5 + +In Figure 11, we construct a multi-task SABR volatility model with correlations given by the farthest right panel and volatility processes given as the blue lines in the left three panels. We then use our multi-task GPCV model to estimate and predict the true volatilities for each task in the left three panels, while also estimating the true relationships between + +![](images/690644c6fd80475a625eae8053d1895c29407dc7aa9932f31fa9a22071b3187a.jpg) +Figure 9. A comparison of Volt with a constant mean, and Volt with various Magpie means in terms of calibration in wind forecasts. While Volt with a constant mean is well calibrated, it is aided by the inclusion of a Magpie mean with large smoothing parameter. + +![](images/818589e84ee73c9d3491f49d1b6ea470e8fcb53a5d90c8b1e624fc2009a30a81.jpg) +Figure 10. Calibration of different mean reversion $\theta$ values across stock prices. + +![](images/6bd3e68ad10bf66f367e29d390ccebd34656a28bb5b4468185f6cf3c066bec58.jpg) +Figure 11. Left three panels: Predicted correlated volatility models. Fourth panel: Estimated correlation matrix between volatility models. Fifth panel: True volatility correlation. Multitask GPCVs are able to both predict volatility while also estimating the true correlation between volatility. + +![](images/61c0f60da76e4851b91d06750bc6ea943fd2e887a6bd03fa6d33b9ce0001496d.jpg) + +![](images/290409b42f774b2bb0fe25e44aa460df306d2377590eb4d76f54cb86376b2971.jpg) + +![](images/a8b41f783f09dacd912b74e15368bf11c4fd59d9a1d93b68a9dbf6f01c1773c6.jpg) + +![](images/e3aa384e47080b27bf2af55278bbd23ae442c1509fbfb7f911d4452de9e9e3a0.jpg) + +each volatility. The estimated relationships are shown in the fourth panel from left, which is pleasingly similar to the true correlation shown at far right. + +For Figure 6left and Figures 12, 14a, 14b, we fit stocks comprising of five different exchange traded fund SPDRs1 collected over 5 years of daily data from 09/2016 to 09/2021. These SPDRS are XLE, XLF, XLK, XLRE, XLY; each had six stocks in it except for XLF which had 30. We fit on 300 days and evaluated 100 days into the future, with 5 rolling testing sets for each prediction. + +For Figure 6center, we used the same training data except used only five stocks from the XLE SPDR and five from the XLE SPDR. + +For Figure 6right and Figures 13, 15 we fit about 100 different wind stations (depending on amount of missing data) at 5 minute intervals across 2021 with 25 independent rolling splits. We fit on 252 increments and tested on 100 increments. Here, on the multi-task ones, we used a larger RTX 8000 GPU. + +Figure 12. Calibration of multi-task Volt and independent models across time step lookaheads for 5 different SPDRS. +![](images/a6131c8206f9982beb54210f7c6f6e46664b2f0a14ff7230055eb152323ea116.jpg) +- Ind + Constant ● Ind + Magpie ● MT + Constant ● MT + Magpie + +![](images/1988cdda459f1203dd04ebe1ac96303c7d7d3623595790e621a41e27ee8c54ea.jpg) + +![](images/5e678e6a0ce58935f8fbd7550b0c56f7d0783224dd567061d73ad1df0ab75d2a.jpg) + +![](images/76d43d890a9bff1474ba10474c6129aee57a8a74ada3bd81f76834ab51794687.jpg) + +![](images/b4fdc05a8f75d599d592b334da21ca638bebbe2de3c88e182f518a4e043b1bf5.jpg) +Figure 13. Calibration of multi-task Volt and independent models across time step lookaheads for the wind forecasting datasets. + +![](images/9cca5b5d51f5b886b5af2bad1de9d187c36061e478682e8f78c4710adbfbe57c.jpg) +(a) MAE + +![](images/582454b86d1e442c603f0b4752dac015db8fdc82123079a59671c54dbd9a08b1.jpg) +(b) NLL +Figure 14. Left panel: Mean absolute error of rollouts. Right panel: Negative log likelihood of rollouts. + +![](images/0bd2f2339ee48f137c1fb770d9bdee78843d07bde3f3e5ba069ecf5af866fdea.jpg) +Figure 15. Calibration error of the models across different time step lookahead for the wind forecasting task. \ No newline at end of file diff --git a/volatilitybasedkernelsandmovingaveragemeansforaccurateforecastingwithgaussianprocesses/images.zip b/volatilitybasedkernelsandmovingaveragemeansforaccurateforecastingwithgaussianprocesses/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..e15b09b6a560017add6242e6742e010c5919f7cb --- /dev/null +++ b/volatilitybasedkernelsandmovingaveragemeansforaccurateforecastingwithgaussianprocesses/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb81b3fbca4124d30f3baa7457e9e50ae4e8cff0b82d1552ec4612a8062cfcf8 +size 812399 diff --git a/volatilitybasedkernelsandmovingaveragemeansforaccurateforecastingwithgaussianprocesses/layout.json b/volatilitybasedkernelsandmovingaveragemeansforaccurateforecastingwithgaussianprocesses/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..8f87f95be055385b9a047d9a58c8546168b72e74 --- /dev/null +++ b/volatilitybasedkernelsandmovingaveragemeansforaccurateforecastingwithgaussianprocesses/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:68ec0cf84c8a35c33556db15aa8f1df5a56f99cc489fddff6169119e0fbb8dac +size 628662 diff --git a/weisfeilerlehmanmeetsgromovwasserstein/d34cc4ed-27c8-48f5-9ad5-771b18f7d84b_content_list.json b/weisfeilerlehmanmeetsgromovwasserstein/d34cc4ed-27c8-48f5-9ad5-771b18f7d84b_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..8d624bc771995ce18907c9c4deca9fa3103442ce --- /dev/null +++ b/weisfeilerlehmanmeetsgromovwasserstein/d34cc4ed-27c8-48f5-9ad5-771b18f7d84b_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b529daaf05c489d6a66182339afc5ff997d1b124a0d9e0c4dc592d997ccc3e43 +size 397759 diff --git a/weisfeilerlehmanmeetsgromovwasserstein/d34cc4ed-27c8-48f5-9ad5-771b18f7d84b_model.json b/weisfeilerlehmanmeetsgromovwasserstein/d34cc4ed-27c8-48f5-9ad5-771b18f7d84b_model.json new file mode 100644 index 0000000000000000000000000000000000000000..052427240de36a6f6a4d56ad7880e2377fa4e95d --- /dev/null +++ b/weisfeilerlehmanmeetsgromovwasserstein/d34cc4ed-27c8-48f5-9ad5-771b18f7d84b_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e35091fc7515cad7832688c31e0745b01b14d3674943ac5ba362386f6e536558 +size 446930 diff --git a/weisfeilerlehmanmeetsgromovwasserstein/d34cc4ed-27c8-48f5-9ad5-771b18f7d84b_origin.pdf b/weisfeilerlehmanmeetsgromovwasserstein/d34cc4ed-27c8-48f5-9ad5-771b18f7d84b_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..ab14ee5168c05d6e3de5dc861f526b2425862551 --- /dev/null +++ b/weisfeilerlehmanmeetsgromovwasserstein/d34cc4ed-27c8-48f5-9ad5-771b18f7d84b_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f0df3f6cc1bea046bd348353cfd2b963f89cb7377d86755a31b6cb2819011d3e +size 731384 diff --git a/weisfeilerlehmanmeetsgromovwasserstein/full.md b/weisfeilerlehmanmeetsgromovwasserstein/full.md new file mode 100644 index 0000000000000000000000000000000000000000..91e6520c66a1f66875d43f150d75e3786e0ecdd8 --- /dev/null +++ b/weisfeilerlehmanmeetsgromovwasserstein/full.md @@ -0,0 +1,2135 @@ +Samantha Chen $^{*1}$ Sunhyuk Lim $^{*2}$ Facundo Memoli $^{*3}$ Zhengchao Wan $^{*4}$ Yusu Wang $^{*14}$ + +# Abstract + +The Weisfeiler-Lehman (WL) test is a classical procedure for graph isomorphism testing. The WL test has also been widely used both for designing graph kernels and for analyzing graph neural networks. In this paper, we propose the Weisfeiler-Lehman (WL) distance, a notion of distance between labeled measure Markov chains (LMMCs), of which labeled graphs are special cases. The WL distance is polynomial time computable and is also compatible with the WL test in the sense that the former is positive if and only if the WL test can distinguish the two involved graphs. The WL distance captures and compares subtle structures of the underlying LMMCs and, as a consequence of this, it is more discriminating than the distance between graphs used for defining the state-of-the-art Wasserstein Weisfeiler-Lehman graph kernel. Inspired by the structure of the WL distance we identify a neural network architecture on LMMCs which turns out to be universal w.r.t. continuous functions defined on the space of all LMMCs (which includes all graphs) endowed with the WL distance. Finally, the WL distance turns out to be stable w.r.t. a natural variant of the Gromov-Wasserstein (GW) distance for comparing metric Markov chains that we identify. Hence, the WL distance can also be construed as a polynomial time lower bound for the GW distance which is in general NP-hard to compute. + +*Equal contribution $^{1}$ Department of Computer Science and Engineering, University of California San Diego, La Jolla, California, USA $^{2}$ Max Planck Institute for Mathematics in the Sciences, Leipzig, Saxony, Germany $^{3}$ Department of Mathematics and Department of Computer Science and Engineering, The Ohio State University, Columbus, Ohio, USA $^{4}$ Halicioglu Data Science Institute, University of California San Diego, La Jolla, California, USA. Correspondence to: Zhengchao Wan . + +Proceedings of the $39^{th}$ International Conference on Machine Learning, Baltimore, Maryland, USA, PMLR 162, 2022. Copyright 2022 by the author(s). + +# 1. Introduction + +The Weisfeiler-Lehman (WL) test (Lehman & Weisfeiler, 1968) is a classical procedure which provides a polynomial time proxy for testing graph isomorphism. It is efficient and can distinguish most pairs of graphs in linear time (Babai & Kucera, 1979; Babai & Luks, 1983). The WL test has a close relationship with graph neural networks (GNNs), both in the design of GNN architectures and in terms of characterizing their expressive power. For example, Xu et al. (2018) showed that graph isomorphism networks (GINs) have the same discriminative power as the WL test in distinguishing whether two graphs are isomorphic or not. Recently, Azizian et al. (2020) showed that message passing graph neural networks (MPNNs) are universal with respect to the continuous functions defined on the set of graphs (with the topology induced by a specific variant of the graph edit distance) that have equivalent to or less discriminative power than the WL test. + +However, the WL test is only suitable for testing graph isomorphism and cannot directly quantitatively compare graphs. This state of affairs naturally suggests identifying a distance function between graphs so that two graphs have positive distance iff they can be distinguished by the WL test. We note that there have been WL-inspired graph kernels which can quantitatively compare graphs (Shervashidze et al., 2011; Togninalli et al., 2019). However, these either cannot handle continuous node features naturally or they do not have the same discriminative power as the WL test. + +New work and connections to related work. Our work provides novel connections between the WL test, GNNs and the Gromov-Wasserstein distance. The central object we define in this paper is a distance between graphs which has the same discriminative power as the WL test. We do this by combining ideas inherent to the WL test with optimal transport (OT) (Villani, 2009). We call this distance the Weisfeiler-Lehman (WL) distance. We show that two graphs are at zero WL distance if and only if they cannot be distinguished by the WL test. Moreover, the WL distance can be computed in polynomial time. Furthermore, our WL distance is actually defined on a more general and flexible type of objects called the labeled measure Markov chains (LMMCs), of which labeled graphs (i.e., graph with node features) are special cases. LMMCs can naturally model + +the interaction between graphs and their node labels (node features), and thus provides a new OT based perspective for comparing node labeled graphs. Besides graphs, the LMMC framework also encompasses continuous objects such as Riemannian manifolds and graphons. It is worth noting that the idea of combining OT and Markov chains/heat kernels has long been used to study notions of curvature of geometric objects, e.g., graphs or Riemannian manifolds (von Renesse & Sturm, 2005; Ollivier, 2009). + +Our definition of the WL distance is able to capture and compare subtle geometric and combinatorial structures from the underlying LMMCs. This allows us to establish various lower bounds for the WL distance which are not just useful in practical computations but also clarify its discriminating power relative to existing approaches. In particular, we carry out experiments which demonstrate the effectiveness of our WL distance (and its lower bounds) in graph comparison tasks. $^{1}$ Furthermore, based on the hierarchy inherent to the WL distance, we are able to identify a neural network architecture on the collection of all LMMCs, which we call MCNNs (for Markov chain NNs). We show that MCNNs have the same discriminative power as the WL test when applied to graphs; while at the same time, they have the desired universal approximation property w.r.t. continuous functions defined on the space of all LMMCs (including the space of graphs) equipped with the WL distance. It turns out that from MCNNs, one can recover Weisfeiler-Lehman graph kernels (Togninalli et al., 2019) and in particular, we show that a slight variant of a key pseudo-distance between graphs defined in (Togninalli et al., 2019) serves as a lower bound for our WL distance. This indicates that the WL distance has a stronger discriminating ability than WWL graph kernels (see Appendix A.3 for an infinite family of examples). + +Finally, we observe that our formulation of the WL distance resembles the Gromov-Wasserstein (GW) distance (Mémoli, 2007; 2011; Peyré et al., 2016; Sturm, 2012; Vayer et al., 2020; Chowdhury & Mémoli, 2019) which is a OT-based distance between metric measure spaces and has been recently widely used in shape matching and machine learning. We hence identify a special variant of the GW distance between Markov chain metric spaces (MCMSs) (including all graphs). Our version of the GW distance implements a certain multiscale comparison of MCMSs, it vanishes only when the two MCMSs are isomorphic, but leads to NP-hard problems. Interestingly, it turns out that the poly-time computable WL distance is not only stable w.r.t. (i.e., upper bounded by) this variant of the GW distance, but can also be construed as a variant of the third lower bound (TLB) of this GW distance, as in (Mémoli, 2011). + +Proofs of results and details can be found in the Appendix. + +# 2. Preliminaries + +# 2.1. The Weisfeiler-Lehman Test + +A labeled graph is a graph $G = (V_G, E_G)$ endowed with a label function $\ell_G : V_G \to Z$ , where the labels (i.e., node features) are taken from some set $Z$ . Common label functions include the degree label (i.e., $\ell_G : V_G \to \mathbb{N}$ ) sends each $v \in V_G$ to its degree, denoted by $\deg_G(v)$ ) and the constant label (assigning a constant to all vertices). For a node $v \in V_G$ , let $N_G(v)$ denote the set of neighbors of $v$ in $G$ . Below, we describe the Weisfeiler-Lehman hierarchy for a given labeled graph $(G, \ell_G)$ . + +Definition 1 (Weisfeiler-Lehman hierarchy). Given any labeled graph $(G, \ell_G)$ , we consider the following hierarchy of multiset, which we call the Weisfeiler-Lehman hierarchy: + +Step 1 For each $v \in V_G$ we compute the pair + +$$ +\ell_ {(G, \ell_ {G})} ^ {(1)} (v) := (\ell_ {G} (v), \{\{\ell_ {G} (v ^ {\prime}): v ^ {\prime} \in N _ {G} (v) \}) \}. +$$ + +. + +Step $k$ For each $v\in V$ we compute the pair + +$$ +\ell_ {(G, \ell_ {G})} ^ {(k)} (v) := \left(\ell_ {(G, \ell_ {G})} ^ {(k - 1)} (v), \left\{\left\{\ell_ {(G, \ell_ {G})} ^ {(k - 1)} \left(v ^ {\prime}\right): v ^ {\prime} \in N _ {G} (v) \right\} \right\}\right). +$$ + +Here, $\{\cdot\}$ denotes multisets. In the literature, $\ell_{(G,\ell_G)}^{(k)}(v)$ is usually often mapped to a common space of labels such as $\mathbb{N}$ through a hash function, a step which we do not require in this paper. We induce, at each step $k$ , a multiset + +$$ +L _ {k} ((G, \ell_ {G})) := \left\{\left\{\ell_ {(G, \ell_ {G})} ^ {(k)} (v): v \in V _ {G} \right\} \right\}. +$$ + +Definition 2 (Weisfeiler-Lehman test). For each integer $k \geq 0$ , we compare $L_{k}((G_{1},\ell_{G_{1}}))$ with $L_{k}((G_{2},\ell_{G_{2}}))$ . If $\exists k \geq 0$ so that $L_{k}((G_{1},\ell_{G_{1}})) \neq L_{k}((G_{2},\ell_{G_{2}}))$ then we conclude that the two label graphs are non-isomorphic; otherwise we say that the two labeled graphs pass the WL test and that the two graphs are "possibly isomorphic". + +# 2.2. Probability Measures and Optimal Transport + +For any measurable space $Z$ , we will denote by $\mathcal{P}(Z)$ the collection of all probability measures on $Z$ . When $Z$ is a metric space $(Z, d_Z)$ , we further require that every $\alpha \in \mathcal{P}(Z)$ has finite 1-moment, i.e., $\int_Z d_Z(z, z_0) \alpha(dz) < \infty$ for any $\alpha \in \mathcal{P}(Z)$ and any fixed $z_0 \in Z$ . + +Pushforward Maps. Given two measurable spaces $X$ and $Y$ and a measurable map $\psi : X \to Y$ , the pushforward map induced by $\psi$ is the map $\psi_{\#} : \mathcal{P}(X) \to \mathcal{P}(Y)$ sending $\alpha$ to $\psi_{\#} \alpha$ where for any measurable $B \subseteq Y$ , $\psi_{\#} \alpha(B) :=$ + +$\alpha \left(\psi^{-1}(B)\right)$ . In the case when $X$ is finite and $Y$ is a metric space, $\psi_{\#}\alpha$ obviously has finite 1-moment and is thus an element of $\mathcal{P}(Y)$ . + +Couplings and the Wasserstein Distance. For measurable spaces $X$ and $Y$ , given $\alpha \in \mathcal{P}(X)$ and $\beta \in \mathcal{P}(Y)$ , $\gamma \in \mathcal{P}(X \times Y)$ is called a coupling between $\alpha$ and $\beta$ if $(p_X)_\# \gamma = \alpha$ and $(p_Y)_\#\gamma = \beta$ , where $p_X: X \times Y \to X$ and $p_Y: X \times Y \to Y$ are the canonical projections, e.g., the product measure $\alpha \otimes \beta$ is one such coupling. Let $\mathcal{C}(\alpha, \beta)$ denote the set of all couplings between $\alpha$ and $\beta$ . + +Given a metric space $(Z,d_Z)$ , for $\alpha, \beta \in \mathcal{P}(Z)$ , we define the $(\ell^1)$ -Wasserstein distance between them as follows: + +$$ +d _ {\mathrm {W}} (\alpha , \beta) := \inf _ {\gamma \in \mathcal {C} (\alpha , \beta)} \int_ {Z \times Z} d _ {Z} (z, z ^ {\prime}) \gamma (d z \times d z ^ {\prime}). +$$ + +By (Villani, 2009, Proposition 2.1), the infimum above is always achieved by some $\gamma \in \mathcal{C}(\alpha, \beta)$ which we call an optimal coupling between $\alpha$ and $\beta$ . + +Hierarchy of Probability Measures. An important ingredient in this paper is the following construction: Given a finite set $X$ and a metric space $Z$ , a map of the form $\psi : X \to \mathcal{P}(Z)$ induces $\psi_{\#} : \mathcal{P}(X) \to \mathcal{P}(\mathcal{P}(Z))$ which involves the space of probability measures over probability measures, i.e., $\mathcal{P}(\mathcal{P}(Z))$ . Inductively, we define the family of spaces $\mathcal{P}^{\circ k}(Z)$ , called the hierarchy of probability measures: + +1. $\mathcal{P}^{\circ 1}(Z) \coloneqq \mathcal{P}(Z)$ ; +2. $\mathcal{P}^{\circ (k + 1)}(Z)\coloneqq \mathcal{P}\left(\mathcal{P}^{\circ k}(Z)\right)$ for $k\geq 1$ + +If $Z$ is complete and separable then, when endowed with $d_{\mathrm{W}}$ , $\mathcal{P}(Z)$ is also complete and separable (Villani (2009, Theorem 6.18)). By induction, for each $k \in \mathbb{N}$ , $\mathcal{P}^{\circ k}(Z)$ is also a complete and separable metric space. This hierarchy will be critical in our development of the WL distance. + +The Gromov-Wasserstein Distance. We call a triple $\mathbf{X} = (X, d_X, \mu_X)$ a metric measure space (MMS) if $(X, d_X)$ is a metric space and $\mu_X$ is a (Borel) probability measure on $X$ with full support. Given any $\mathbf{X} = (X, d_X, \mu_X)$ and $\mathbf{Y} = (Y, d_Y, \mu_Y)$ , for any coupling $\gamma \in \mathcal{C}(\mu_X, \mu_Y)$ , we define its distortion by + +$$ +\operatorname {dis}(\gamma):= \int_{X\times Y} \int_{X\times Y}|d_{X}(x,x^{\prime}) - d_{Y}(y,y^{\prime})|\gamma (dx\times dy)\gamma (dx^{\prime}\times dy^{\prime}). +$$ + +Then, the $(\ell^1)$ -Gromov-Wasserstein (GW) distance between $\mathbf{X} = (X,d_X,\mu_X)$ and $\mathbf{Y} = (Y,d_Y,\mu_Y)$ is defined as follows (Mémoli, 2011) + +$$ +d _ {\mathrm {G W}} (\mathbf {X}, \mathbf {Y}) := \inf _ {\gamma \in \mathcal {C} \left(\mu_ {X}, \mu_ {Y}\right)} \operatorname {d i s} (\gamma), \tag {1} +$$ + +where we omit the usual $\frac{1}{2}$ factor for simplicity. + +# 2.3. Markov Chains + +Given a finite set $X$ , we call any map $m_{\bullet}^{X}: X \to \mathcal{P}(X)$ a Markov kernel on $X$ . Of course Markov kernels can be represented as transition matrices but we adopt this more flexible language. A probability measure $\mu_{X} \in \mathcal{P}(X)$ is called a stationary distribution w.r.t. $m_{\bullet}^{X}$ if for every measurable subset $A \subseteq X$ we have: + +$$ +\mu_ {X} (A) = \int_ {X} m _ {x} ^ {X} (A) \mu (d x). +$$ + +The existence of stationary distributions is guaranteed by the Perron-Frobenius Theorem (Saloff-Coste, 1997). A measure Markov chain (MMC) is any tuple $\mathcal{X} = (X,m_{\bullet}^{X},\mu_{X})$ where $X$ is a finite set, $m_{\bullet}^{X}$ is a Markov kernel on $X$ and $\mu_{X}$ is a fully supported stationary distribution w.r.t. $m_{\bullet}^{X}$ . + +Definition 3 (Labeled measure Markov chain). Given any metric space $Z$ , which we refer to as the metric space of labels, a $Z$ -labeled measure Markov chain ((Z-)LMMC for short) is a tuple $(\mathcal{X},\ell_X)$ where $\mathcal{X}$ is a MMC and $\ell_{X}:X\to Z$ is a continuous map. For technical reasons, throughout this paper, we assume that the metric space of labels $Z$ is complete and separable2. We let $\mathcal{M}^L (Z)$ denote the collection of all $Z$ -LMMCs. + +The following definition of isomorphism between LMMCs is similar to that of labeled graph isomorphism. + +Definition 4. Two $Z$ -LMMCs $(\mathcal{X},\ell_X)$ and $(\mathcal{Y},\ell_Y)$ are said to be isomorphic if there exists a bijective map $\psi :X\to Y$ such that $\ell_{X}(x) = \ell_{Y}(\psi (x))$ and $\psi_{\#}m_x^X = m_{\psi (x)}^Y$ for all $x\in X$ and $\psi_{\#}\mu_{X} = \mu_{Y}$ . + +Labeled Graphs as LMMCs. Any labeled graph induces a family of LMMCs which we explain as follows. + +Definition 5 (q-Markov chains on graphs). For any graph $G$ and parameter $q \in [0,1)$ , we define the q-Markov chain $m_{\bullet}^{G,q}$ associated to $G$ as follows: for any $v \in V_G$ , + +$$ +m _ {v} ^ {G, q} := \left\{ \begin{array}{l l} q \delta_ {v} + \frac {1 - q}{\deg_ {G} (v)} \sum_ {v ^ {\prime} \in N _ {G} (v)} \delta_ {v ^ {\prime}}, & N _ {G} (v) \neq \emptyset \\ \delta_ {v}, & N _ {G} (v) = \emptyset \end{array} \right.. +$$ + +We further let $\overline{\deg}_G(v) \coloneqq \deg_G(v)$ if $N_G(v) \neq \emptyset$ and $\overline{\deg}_G(v) \coloneqq 1$ otherwise. Then, it is easy to see that + +$$ +\mu_ {G} := \sum_ {v \in V _ {G}} \frac {\overline {{\operatorname* {d e g}}} _ {G} (v)}{\sum_ {v ^ {\prime} \in V _ {G}} \overline {{\operatorname* {d e g}}} _ {G} (v ^ {\prime})} \delta_ {v} +$$ + +is a stationary distribution for $m_{\bullet}^{G,q}$ for all $q \in [0,1]$ . + +For any $q\in [0,1)$ , we let $\mathcal{X}_q(G)\coloneqq \left(V_G,m_\bullet^{G,q},\mu_G\right)$ and call $(\mathcal{X}_q(G),\ell_G)$ a graph induced LMMC. When $q = 0$ , we + +also let $m_{\bullet}^{G} \coloneqq m_{\bullet}^{G,q}$ and let $\mathcal{X}(G) \coloneqq \mathcal{X}_0(G)$ . One has the following desirable property for graph induced LMMCs. + +Proposition 2.1. For any $q \in [0,1), (G_1, \ell_{G_1})$ is isomorphic to $(G_2, \ell_{G_1})$ as labeled graphs iff $(\mathcal{X}_q(G_1), \ell_{G_1})$ is isomorphic to $(\mathcal{X}_q(G_2), \ell_{G_2})$ as LMMCs. + +# 3. The WL Distance + +A non-empty finite multiset $M$ of elements from a given set $S$ encodes information about the multiplicity of each $s \in S$ in $M$ . This suggests that one might consider the probability measure $\mu_{M}$ on $S$ induced by $M$ : + +$$ +\mu_ {M} (s) := \frac {m (s)}{\sum_ {t \in S} m (t)}, \forall s \in S +$$ + +where $m(s)$ denotes the multiplicity of $s$ in $S$ . This point of view permits reinterpreting the multisets appearing in the WL hierarchy (see Definition 1) through the language of probability measures, which will eventually lead us to a distance between graphs. + +Definition 6 (Weisfeiler-Lehman measure hierarchy). Given any $Z$ -LMMC $(\mathcal{X},\ell_X)$ , we let $\mathfrak{l}_{(\mathcal{X},\ell_X)}^{(0)}\coloneqq \ell_X$ and produce the following label functions whose codomains span a certain hierarchy of probability measures: + +Step 1 For each $x\in X$ , we have $(\mathfrak{l}_{(\mathcal{X},\ell_X)}^{(0)})_{\#}m_x^X\in \mathcal{P}(Z)$ Hence we in fact have the function + +$$ +\mathfrak {l} _ {(\mathcal {X}, \ell_ {X})} ^ {(1)} := \left(\mathfrak {l} _ {(\mathcal {X}, \ell_ {X})} ^ {(0)}\right) _ {\#} m _ {\bullet} ^ {X}: X \to \mathcal {P} (Z). +$$ + +. + +Step $k$ For each integer $k \geq 2$ , we inductively define + +$$ +\mathfrak {l} _ {(\mathcal {X}, \ell_ {X})} ^ {(k)} := \left(\mathfrak {l} _ {(\mathcal {X}, \ell_ {X})} ^ {(k - 1)}\right) _ {\#} m _ {\bullet} ^ {X}: X \to \mathcal {P} ^ {\circ k} (Z). +$$ + +We then induce at each step $k$ a probability measure + +$$ +\mathfrak {L} _ {k} ((\mathcal {X}, \ell_ {X})) := \left( \begin{array}{c} \mathrm {I} _ {(\mathcal {X}, \ell_ {X})} ^ {(k)} \end{array} \right) _ {\#} \mu_ {X} \in \mathcal {P} ^ {\circ (k + 1)} (Z). +$$ + +$\ell_{(\mathcal{X},\ell_X)}^{(k)}$ should be compared to $\ell_{(G,\ell_G)}^{(k)}$ and $\mathfrak{L}_k((\mathcal{X},\ell_X))$ should be compared to $L_{k}((G,\ell_{G}))$ from the WL hierarchy (cf. Definition 1). See Figure 1 for an illustration of the WL measure hierarchy of a graph induced LMMC and its comparison with the corresponding WL hierarchy. We will show later that, up to certain change of labels, the WL measure hierarchy for a graph induced LMMC captures all the information contained in the WL hierarchy of the original graph (see Proposition 3.3). + +We now define the Weisfeiler-Lehman distance based on the WL measure hierarchy. + +Definition 7 (Weisfeiler-Lehman distance). For each integer $k \geq 0$ and any metric space of labels $Z$ we define the Weisfeiler-Lehman (WL) distance of depth $k$ between the $Z$ -LMMCs $(\mathcal{X},\ell_X)$ and $(\mathcal{Y},\ell_Y)$ as + +$$ +d _ {\mathrm {W L}} ^ {(k)} \left(\left(\mathcal {X}, \ell_ {X}\right), \left(\mathcal {Y}, \ell_ {Y}\right)\right) := d _ {\mathrm {W}} \left(\mathfrak {L} _ {k} \left(\left(\mathcal {X}, \ell_ {X}\right)\right), \mathfrak {L} _ {k} \left(\left(\mathcal {Y}, \ell_ {Y}\right)\right)\right) \tag {2} +$$ + +where $d_{\mathrm{W}}$ above takes place in $\mathcal{P}^{\circ k}(Z)$ . We also define the (absolute) Weisfeiler-Lehman distance by + +$$ +d _ {\mathrm {W L}} ((\mathcal {X}, \ell_ {X}), (\mathcal {Y}, \ell_ {Y})) := \sup _ {k \geq 0} d _ {\mathrm {W L}} ^ {(k)} ((\mathcal {X}, \ell_ {X}), (\mathcal {Y}, \ell_ {Y})). +$$ + +Example 1. We write down explicit formulas for $d_{\mathrm{WL}}^{(k)}$ when $k = 0$ and 1. When $k = 0$ , it is easy to see that + +$$ +d _ {\mathrm {W L}} ^ {(0)} ((\mathcal {X}, \ell_ {X}), (\mathcal {Y}, \ell_ {Y})) = d _ {\mathrm {W}} ((\ell_ {X}) _ {\#} \mu_ {X}, (\ell_ {Y}) _ {\#} \mu_ {Y}), +$$ + +which agrees with the Wasserstein distance between the global label distributions $(\ell_X)_{\#}\mu_X$ and $(\ell_Y)_{\#}\mu_Y$ (cf. a similar concept for MMSs (Mémoli, 2011)). + +When $k = 1$ , we have that + +$$ +d _ {\mathrm {W L}} ^ {(1)} \left(\left(\mathcal {X}, \ell_ {X}\right), \left(\mathcal {Y}, \ell_ {Y}\right)\right) = +$$ + +$$ +\inf_{\gamma \in \mathcal{C}(\mu_{X},\mu_{Y})}\int \limits_{X\times Y}d_{\mathrm{W}}\bigl((\ell_{X})_{\#}m_{x}^{X},(\ell_{Y})_{\#}m_{y}^{Y}\bigr)\gamma (dx\times dy), +$$ + +implementing the comparison of local label distributions. + +The following proposition states that the WL distance becomes more discriminating as the depth increases. + +Proposition 3.1. Let $k \geq 0$ be any integer. Given any two $Z$ -LMMCs $(\mathcal{X},\ell_X)$ and $(\mathcal{Y},\ell_Y)$ , we have that $d_{\mathrm{WL}}^{(k)}((\mathcal{X},\ell_X),(\mathcal{Y},\ell_Y)) \leq d_{\mathrm{WL}}^{(k + 1)}((\mathcal{X},\ell_X),(\mathcal{Y},\ell_Y))$ . + +As a first step towards understanding the WL distance, we show that $d_{\mathrm{WL}}$ is a pseudo-distance. We discuss its relationship with the WL test in Proposition 3.3 below. + +Proposition 3.2. $d_{\mathrm{WL}}$ (resp. $d_{\mathrm{WL}}^{(k)}$ for $k \geq 0$ ) defines a pseudo-distance on the collection $\mathcal{M}^L(Z)$ . + +# 3.1. Comparison with the WL Test + +Given the apparent similarity between the WL hierarchy and the WL measure hierarchy, it should not be surprising that (as we will show later in Proposition 3.3), on graphs, $d_{\mathrm{WL}}$ essentially has the same discriminative power as the WL test, i.e., those pairs of graphs which can be distinguished by the WL test are the same as those with $d_{\mathrm{WL}} > 0$ . The WL distance therefore should be interpreted as a quantification of the degree to which the graphs fail to pass the WL test. + +![](images/216c090d43fdb9b53edb4e07976626883fa64b495f8149780495ab2d6e7670ee.jpg) +Figure 1. Illustration of the WL (measure) hierarchy. The graph $G$ shown in the middle of the figure is assigned the degree label $\ell_G$ . We explicitly present two steps of the WL hierarchy of $(G, \ell_G)$ (on the left) and of the WL measure hierarchy of $(\mathcal{X}(G), \ell_G)$ (on the right). Every probability measure is represented as a histogram. For $i = 1, 2, \ell_i$ and $\mathfrak{l}_i$ are abbreviations for $\ell_{(G, \ell_G)}^{(i)}$ and $\mathfrak{l}_{(\mathcal{X}(G), \ell_G)}^{(i)}$ , respectively. Notice how the WL measure hierarchy interprets the multisets from the WL hierarchy as probability measures. + +However, there is an apparent loss of information in the WL measure hierarchy due to the normalization inherent in probability measures. This could result in certain cases when $d_{\mathrm{WL}}((\mathcal{X}_q(G_1), \ell_{G_1}), (\mathcal{X}_q(G_2), \ell_{G_2})) = 0$ but $(G_1, \ell_{G_1})$ and $(G_2, \ell_{G_2})$ are distinguished by the WL test. See the examples in Appendix A.5. However, as we explain next, with appropriate label transformations, the discriminative power of $d_{\mathrm{WL}}$ is the same as that of the WL test. + +For any metric space of labels $Z$ , consider any injective map $g: Z \times \mathbb{N} \times \mathbb{N} \to Z_1$ where $Z_1$ is another metric space of labels. A trivial example of such injective $g$ is given by letting $Z_1 := Z \times \mathbb{N} \times \mathbb{N}$ and letting $g$ be the identity map. + +Now, given any labeled graph $(G,\ell_G:V_G\to Z)$ , we generate a new label function $\ell_G^g \coloneqq g(\ell_G,\deg_G(\bullet),|V_G|): V_G\to Z_1$ . Intuitively, this is understood as relabeling $G$ via the map $g$ . Modulo this change of label function, we establish that $d_{\mathrm{WL}}$ has the same discriminative power as the WL test. + +Proposition 3.3. For any $q \in (\frac{1}{2}, 1)$ , the WL test distinguishes two labeled graphs $(G_1, \ell_{G_1})$ and $(G_2, \ell_{G_2})$ iff $d_{\mathrm{WL}}\left(\left(\mathcal{X}_q(G_1), \ell_{G_1}^g\right), \left(\mathcal{X}_q(G_2), \ell_{G_2}^g\right)\right) > 0$ . + +Although it may seem that we are injecting more information into labels, this extra relabeling, in fact, does not affect the outcome of the WL test: + +Lemma 3.4. The WL test distinguishes $(G_{1},\ell_{G_{1}})$ and $(G_{2},\ell_{G_{2}})$ iff it distinguishes $(G_{1},\ell_{G_{1}}^{\mathcal{g}})$ and $(G_{2},\ell_{G_{2}}^{\mathcal{g}})$ . + +By Proposition 3.3 and a convergence result pertaining to the WL test (Krebs & Verbitsky, 2015), one has the following convergence result for $d_{\mathrm{WL}}^{(k)}$ (which implies that to determine whether two graph induced LMMCs satisfy $d_{\mathrm{WL}} = 0$ one only needs to inspect $d_{\mathrm{WL}}^{(k)}$ for finitely many $k$ .) + +Corollary 3.5. For any $q \in (\frac{1}{2}, 1)$ and any two labeled graphs $(G_1, \ell_{G_1})$ and $(G_2, \ell_{G_2})$ , if + +$d_{\mathrm{WL}}^{(k)}\bigl ((\mathcal{X}_q(G_1),\ell_{G_1}^g\bigr),(\mathcal{X}_q(G_2),\ell_{G_2}^g)\bigr) = 0$ holds for each $k = 0,\dots ,|V_{G_1}| + |V_{G_2}|$ we then have that $d_{\mathrm{WL}}\bigl ((\mathcal{X}_q(G_1),\ell_{G_1}^g\bigr),(\mathcal{X}_q(G_2),\ell_{G_2}^g)\bigr) = 0.$ + +Results from (Babai & Kucera, 1979) imply that the WL test can certify isomorphism of random graphs (with degree labels) with high probability. Then, immediately by Proposition 3.3, we have that with high probability $d_{\mathrm{WL}}$ generates positive distance for non-isomorphic random-graph-induced LMMCs. + +# 3.2. A Lower Bound for $d_{\mathrm{WL}}^{(k)}$ + +The WL measure hierarchy, defined through consecutive steps of pushforward maps, can be related to a certain sequence of Markov kernels which we explain next. Given a MMC $\mathcal{X} = (X,m_{\bullet}^{X},\mu_{X})$ and any $k\in \mathbb{N}$ , the $k$ -step Markov kernel, denoted by $m_{\bullet}^{X,\otimes k}$ , is defined inductively as follows: for any $x\in X$ , when $k = 1$ , $m_x^{X\otimes 1}\coloneqq m_x^X$ and when $k\geq 2$ , for $A\subseteq X$ , + +$$ +m _ {x} ^ {X, \otimes k} (A) := \int_ {X} m _ {x ^ {\prime}} ^ {X, \otimes (k - 1)} (A) m _ {x} ^ {X} (d x ^ {\prime}). +$$ + +If we represent $m_{\bullet}^{X}$ by a transition matrix $M_{\mathcal{X}}$ , then the matrix corresponding to $m_{\bullet}^{X,\otimes k}$ is the $k$ -power of $M_{\mathcal{X}}$ . + +Recall the formula for $d_{\mathrm{WL}}^{(1)}$ from Example 1. We define a certain quantity (for each $k \in \mathbb{N}$ ) which arises by replacing the Markov kernels in that formula with $k$ -step Markov kernels: + +$$ +\begin{array}{l} d _ {\mathrm {W L L B}} ^ {(k)} \left(\left(\mathcal {X}, \ell_ {X}\right), \left(\mathcal {Y}, \ell_ {Y}\right)\right) := \\ \inf_{\substack{\gamma \in \mathcal{C}(\mu_{X},\mu_{Y})\\ X\times Y}}\int_{d_{\mathrm{W}}}\bigl((\ell_{X})_{\#}m^{X,\otimes k}_{x},(\ell_{Y})_{\#}m^{Y,\otimes k}_{y}\bigr)\gamma (dx\times dy). \\ \end{array} +$$ + +Notice that $d_{\mathrm{W}}$ above takes place in $\mathcal{P}(Z)$ whereas $d_{\mathrm{W}}$ in Equation (2) for defining $d_{\mathrm{WL}}^{(k)}$ takes place in $\mathcal{P}^{\circ k}(Z)$ . Of + +course, we have that $d_{\mathrm{WLLB}}^{(1)} = d_{\mathrm{WL}}^{(1)}$ . It turns out that for each $k \geq 1$ , $d_{\mathrm{WLLB}}^{(k)}$ is a lower bound for $d_{\mathrm{WL}}^{(k)}$ . + +Proposition 3.6. For any $(\mathcal{X},\ell_X),(\mathcal{Y},\ell_Y)\in$ $\mathcal{M}^L (Z)$ and any integer $k\geq 1$ we have that $d_{\mathrm{WLLB}}^{(k)}((\mathcal{X},\ell_X),(\mathcal{Y},\ell_Y))\leq d_{\mathrm{WL}}^{(k)}((\mathcal{X},\ell_X),(\mathcal{Y},\ell_Y))$ + +For any fixed $k \in \mathbb{N}$ and any two finite $\mathbb{R}$ -LMMCs, $(\mathcal{X}, \ell_X)$ and $(\mathcal{Y}, \ell_Y)$ , if we let $n \coloneqq \max(|X|, |Y|)$ , then computing $d_{\mathrm{WL}}^{(k)}((\mathcal{X}, \ell_X), (\mathcal{Y}, \ell_Y))$ can be done in $O(n^5 \log(n) k)$ time whereas the total time complexity for computing $d_{\mathrm{WLLB}}^{(k)}((\mathcal{X}, \ell_X), (\mathcal{Y}, \ell_Y))$ is $O(n^3 \log(nk))$ . Hence it is far more efficient to compute $d_{\mathrm{WLLB}}^{(k)}$ than $d_{\mathrm{WL}}^{(k)}$ . Details can be found in Appendix A.7. + +# 4. WL Distance Inspired Neural Networks + +We now focus on the case when the metric space of labels $Z$ is Euclidean, i.e., $Z = \mathbb{R}^d$ and define a family of real functions on $\mathcal{M}^L(\mathbb{R}^d)$ called Markov chain neural networks (MCNNs). We both study the discriminative power and establish a universality result for this family of functions. + +For any function $\varphi : \mathbb{R}^i \to \mathbb{R}^j$ , we define the map $q_{\varphi} : \mathcal{P}(\mathbb{R}^i) \to \mathbb{R}^j$ sending $\alpha \in \mathcal{P}(\mathbb{R}^i)$ to the average $\int_{\mathbb{R}^i} \varphi(x) \alpha(dx)$ . Based on $q_{\varphi}$ , we define two types of maps: + +(1) $F_{\varphi}:\mathcal{M}^{L}(\mathbb{R}^{i})\to \mathcal{M}^{L}(\mathbb{R}^{j})$ sending $(\mathcal{X},\ell_X)$ to $(\mathcal{X},\ell_X^\varphi)$ where $\ell_X^\varphi :X\to \mathbb{R}^j$ is defined by $x\mapsto q_{\varphi}((\ell_X)_{\#}m_x^X)$ +(2) $S_{\varphi}:\mathcal{M}^{L}(\mathbb{R}^{i})\to \mathbb{R}^{j}$ sending $(\mathcal{X},\ell_X)$ to $q_{\varphi}((\ell_X)_{\#}\mu_X)$ + +Below, we only focus on maps $q_{\varphi}$ when $\varphi = \varphi_{\sigma}$ is a multilayer perceptron (MLP) with a single hidden layer, i.e., any map of the form $\varphi_{\sigma}(x) := C\sigma * (Wx + b)$ , where $C, W$ are matrices, $b$ is any vector, and $\sigma$ represents elementwise application of a fixed activation function $\sigma$ . For technical reasons, we also assume that $\sigma$ is Lipschitz4 and non-polynomial. For example, one can choose $\sigma$ to be ReLU or sigmoid. + +Then, for any sequence of MLPs $\varphi_{i}:\mathbb{R}^{d_{i - 1}}\to \mathbb{R}^{d_{i}}$ for $i = 1,\dots ,k + 1$ , and any MLP $\psi :\mathbb{R}^{d_{k + 1}}\to \mathbb{R}$ , we define a map of the following form, which we call a $k$ -layer Markov chain neural network (MCNN $_k$ ): + +$$ +\psi \circ S _ {\varphi_ {k + 1}} \circ F _ {\varphi_ {k}} \circ \dots \circ F _ {\varphi_ {1}}: \mathcal {M} ^ {L} (\mathbb {R} ^ {d}) \rightarrow \mathbb {R}. \tag {3} +$$ + +Note the resemblance between our MCNNs and message passing neural networks (MPNNs) for graphs (Gilmer et al., 2017): Specifically, $(\ell_X)_{\#}m_x^X$ is analogous to the AGGREGATION operation, $q_{\phi}$ is analogous to the UPDATE operation, and $\psi \circ S_{\phi}$ corresponds to the readout function that appears in the context of MPNN. + +Example 2 (Relation with WWL graph kernels). MCNNs recover the framework of Wasserstein Weisfeiler-Lehman + +(WWL) graph kernels w.r.t. continuous attributes (Togninalli et al., 2019): Consider any labeled graph $(G, \ell_G : V_G \to \mathbb{R}^d)$ and any $q \in [0,1)$ . Let $\varphi : \mathbb{R}^d \to \mathbb{R}^d$ be any continuous map. Applying $q_\varphi$ to $(\mathcal{X}_q(G), \ell_G)$ (see Definition 5), then for any $v \in V_G$ such that $N_G(v) \neq \emptyset$ , we have + +$$ +\begin{array}{l} \ell_ {G} ^ {\varphi} (v) = \int_ {\mathbb {R} ^ {d}} \varphi (t) (\ell_ {G}) _ {\#} m _ {v} ^ {G, q} (d t) \\ = q \varphi (\ell_ {G} (v)) + \frac {1 - q}{\deg_ {G} (v)} \sum_ {v ^ {\prime} \in N _ {G} (v)} \varphi (\ell_ {G} (v ^ {\prime})). \\ \end{array} +$$ + +Notice that if we further let $q = \frac{1}{2}$ and $\varphi : \mathbb{R}^d \to \mathbb{R}^d$ be the identity map id (by relaxing the assumption that $\psi$ is a MLP), then we have + +$$ +\ell_ {G} ^ {\mathrm {i d}} (v) = \frac {1}{2} \left(\ell_ {G} (v) + \frac {1}{\deg_ {G} (v)} \sum_ {v ^ {\prime} \in N _ {G} (v)} \ell_ {G} \left(v ^ {\prime}\right)\right). \tag {4} +$$ + +This is exactly how labels are updated in the WWL graph kernel framework. A slight modification of the ground distance computation in the WWL framework generates a lower bound for $d_{\mathrm{WL}}^{(k)}$ , which implies that the WL distance is more capable at discriminating labeled graphs than WWL graph kernels. This is confirmed by the examples in Appendix A.3. + +We let $\mathcal{N}_k(\mathbb{R}^d)$ denote the collection of all $\mathrm{MCNN}_k$ . Below, we show that $\mathcal{N}_k(\mathbb{R}^d)$ has the same discriminative power as the WL distance. + +Proposition 4.1. Given any $(\mathcal{X},\ell_X),(\mathcal{Y},\ell_Y)\in \mathcal{M}^L (\mathbb{R}^d)$ + +1. if $d_{\mathrm{WL}}^{(k)}((\mathcal{X},\ell_X),(\mathcal{Y},\ell_Y)) = 0,$ then for every $h\in \mathcal{NN}_k(\mathbb{R}^d)$ one has that $h((\mathcal{X},\ell_X)) = h((\mathcal{Y},\ell_Y))$ +2. if $d_{\mathrm{WL}}^{(k)}((\mathcal{X},\ell_X),(\mathcal{Y},\ell_Y)) > 0$ then there exists $h \in \mathcal{NN}_k(\mathbb{R}^d)$ such that $h((\mathcal{X},\ell_X)) \neq h((\mathcal{Y},\ell_Y))$ . + +Recall from Corollary 3.5 that given any $q \in (\frac{1}{2}, 1)$ , any injective map $g$ and any labeled graphs $(G_1, \ell_{G_1})$ and $(G_2, \ell_{G_2})$ , we need at most $2n$ steps to determine whether $d_{\mathrm{WL}}((\mathcal{X}_q(G_1), \ell_G^g), (\mathcal{X}_q(G_2), \ell_{G_2}^g)) = 0$ , where $n = \max(|V_{G_1}|, |V_{G_2}|)$ . Consequently, MCNNs have the same discriminative power as the WL test: + +Corollary 4.2. For any $\frac{1}{2} < q < 1$ , the WL test distinguishes the labeled graphs $(G_1, \ell_{G_1})$ and $(G_2, \ell_{G_2})$ iff there exists $h \in \mathcal{NN}_{2n}(\mathbb{R}^d)$ for which $h\bigl((\mathcal{X}_q(G_1), \ell_{G_1}^g)\bigr) \neq h\bigl((\mathcal{X}_q(G_2), \ell_{G_2}^g)\bigr)$ . + +Since MPNNs also have the same discriminative power as the WL test (Xu et al., 2018), we know that our MCNNs can separate all pairs of graphs that MPNNs can separate. + +Next, we establish a universal approximation theorem for MCNNs. We first introduce some notation. In general, a + +pseudometric space canonically induces a metric space by identifying points at 0 distance (see Burago et al. (2001, Proposition 1.1.5)). We let $\mathcal{M}_k^L (\mathbb{R}^d)$ denote the metric space induced by the pseudometric space $(\mathcal{M}^{L}(\mathbb{R}^{d}),d_{\mathrm{WL}}^{(k)})$ As a direct consequence of Proposition 4.1, every $h\in \mathcal{NN}_k(\mathbb{R}^d)$ induces a real function (which we still denote by $h$ ) in $\mathcal{M}_k^L (\mathbb{R}^d)$ . Then, our MCNNs are actually universal w.r.t. continuous functions defined on $\mathcal{M}_k^L (\mathbb{R}^d)$ (see the proof in Appendix B.3.2). + +Theorem 4.3. For any $k \in \mathbb{N}$ , let $\mathcal{K} \subseteq \mathcal{M}_k^L(\mathbb{R}^d)$ be any compact subspace. Then, $\overline{\mathcal{N}\mathcal{N}_k(\mathbb{R}^d)} = C(\mathcal{K},\mathbb{R})$ . + +Our universality result resembles the one established in (Azizian et al., 2020) for message passing neural networks (MPNNs) which proves that MPNNs can universally approximate continuous functions on graphs with bounded size which are less or equally as discriminative as the WL test. Compared with their result, we remark that our universality result applies to the collection of all LMMCs (and hence all graphs) with no restriction on their size. Moreover, although for simplicity LMMCs are restricted to finite spaces throughout the paper, our MCNNs and universality result can potentially be extended to more general LMMCs including continuous objects such as manifolds and graphons. + +# 5. Relationship with the GW Distance + +Given a LMMC $(\mathcal{X},\ell_X)$ , the label $\ell_{X}$ induces the following pseudo-distance on $X$ : $d_{X}(x,x^{\prime})\coloneqq d_{Z}(\ell_{X}(x),\ell_{X}(x^{\prime}))$ for $x,x^{\prime}\in X$ . This suggests structures which are closely related to LMMCs: Markov chain metric spaces (MCMSs for short). A MCMS is any tuple $(\mathcal{X},d_X)$ where $\mathcal{X} = (X,m_{\bullet}^{X},\mu_{X})$ is a finite MMC and $d_{X}$ is a proper distance on $X$ . Obviously, endowing a MCMS $(\mathcal{X},d_X)$ with a label function $\ell_{X}$ and forgetting $d_{X}$ produces a LMMC $(\mathcal{X},\ell_X)$ . We let $\mathcal{M}^{\mathrm{MS}}$ denote the collection of all MCMSs. We now construct a Gromov-Wasserstein type distance between MCMSs and study its relationship with the WL distance. + +# 5.1. The GW Distance between MCMSs + +Recall from Equation (1) the definition of the standard GW distance between MMSs. Intuitively, in order to identify a suitable GW-like distance between MCMSs, we would like to incorporate a comparison between Markov kernels into Equation (1). Towards this goal, for each $k\in \mathbb{N}$ , we consider a special type of maps $\nu_{\bullet ,\bullet}^{(k)}:X\times Y\to \mathcal{P}(X\times Y)$ which are defined similarly to how we define $k$ -step Markov kernels and satisfy that for any $x\in X$ and $y\in Y$ , $\nu_{x,y}^{(k)}$ is a coupling between the $k$ -step Markov kernels $m_x^{X,\otimes k}$ and $m_y^{Y,\otimes k}$ ; see Appendix A.2 for the precise definition. We + +refer to $\nu_{\bullet,\bullet}^{(k)}$ as a “ $k$ -step coupling” between $k$ -step Markov kernels. We let $\mathcal{C}^{(k)}\left(m_{\bullet}^{X}, m_{\bullet}^{Y}\right)$ denote the collection of all such $k$ -step couplings $\nu_{\bullet,\bullet}^{(k)}$ . + +Definition 8. For any $k \geq 1$ and any MCMSs $(\mathcal{X}, d_X)$ and $(\mathcal{Y}, d_Y)$ , we define the $k$ -distortion of any pair $(\gamma, \nu_{\bullet,\bullet}^{(k)})$ where $\gamma \in \mathcal{C}(\mu_X, \mu_Y)$ and $\nu_{\bullet,\bullet}^{(k)} \in \mathcal{C}^{(k)}(m_\bullet^X, m_\bullet^Y)$ as: + +$$ +\begin{array}{l} \operatorname {dis} ^ {(k)} \left(\gamma , \nu_ {\bullet , \bullet} ^ {(k)}\right) := \int_ {X \times Y} \int_ {X \times Y} \int_ {X \times Y} | d _ {X} (x, x ^ {\prime}) - d _ {Y} (y, y ^ {\prime}) | \\ \nu_ {x ^ {\prime \prime}, y ^ {\prime \prime}} ^ {(k)} (d x ^ {\prime} \times d y ^ {\prime}) \gamma (d x ^ {\prime \prime} \times d y ^ {\prime \prime}) \gamma (d x \times d y). \\ \end{array} +$$ + +This notion of distortion implements a multiscale reweighting of the coupling $\gamma$ through the $k$ -step coupling $\nu_{\bullet,\bullet}^{(k)}$ . Then, the $k$ -Gromov-Wasserstein distance between the MCMSs $(\mathcal{X}, d_X)$ and $(\mathcal{Y}, d_Y)$ is defined by + +$$ +\begin{array}{l} d_{\mathrm{GW}}^{(k)}((\mathcal{X},d_{X}),( \mathcal{Y},d_{Y})):= \inf_{\gamma \in \mathcal{C}(\mu_{X},\mu_{Y})}\operatorname{dis}^{(k)}\bigl(\gamma ,\nu_{\bullet ,\bullet}^{(k)}\bigr). \\ \nu_ {\bullet , \bullet} ^ {(k)} \in \mathcal {C} ^ {(k)} \big (m _ {\bullet} ^ {X}, m _ {\bullet} ^ {Y} \big) \\ \end{array} +$$ + +We then define the (absolute) Gromov-Wasserstein distance between MCMSs by + +$$ +d _ {\mathrm {G W}} ^ {\mathrm {M C M S}} ((\mathcal {X}, d _ {X}), (\mathcal {Y}, d _ {Y})) := \sup _ {k} d _ {\mathrm {G W}} ^ {(k)} ((\mathcal {X}, d _ {X}), (\mathcal {Y}, d _ {Y})). +$$ + +Proposition 5.1. $d_{\mathrm{GW}}^{\mathrm{MCMS}}$ defines a proper distance on the collection $\mathcal{M}^{\mathrm{MS}}$ modulo isomorphism of MCMSs. + +Example 3 (MMS induced MCMS). Given a metric measure space $\mathbf{X} = (X, d_X, \mu_X)$ , we produce a MCMS $\mathcal{M}(\mathbf{X}) \coloneqq (\mathcal{X}, d_X)$ where $\mathcal{X} \coloneqq (X, m_{\bullet}^{X}, \mu_{X})$ by letting $m_{\bullet}^{X} \coloneqq \mu_{X}$ be the constant Markov kernel. It is easy to check that $\mu_{X}$ is a stationary distribution w.r.t. $m_{\bullet}^{X}$ . Then, for any two metric measure spaces $\mathbf{X} = (X, d_X, \mu_X)$ , $\mathbf{Y} = (Y, d_Y, \mu_Y)$ , and $k \geq 1$ , we have that + +$$ +d _ {\mathrm {G W}} ^ {(k)} (\mathcal {M} (\mathbf {X}), \mathcal {M} (\mathbf {Y})) = d _ {\mathrm {G W}} ^ {\mathrm {b i}} (\mathbf {X}, \mathbf {Y}) +$$ + +where $d_{\mathrm{GW}}^{\mathrm{bi}}$ denotes a "decoupled" version of the Gromov-Wasserstein distance between metric measure spaces (see Appendix A.4) which is of course independent of $k$ . + +$d_{\mathrm{GW}}^{\mathrm{bi}}$ is in general NP-hard to compute (Scetbon et al., 2021), which (via Example 3) implies that $d_{\mathrm{GW}}^{\mathrm{MCMS}}$ is also NP-hard to compute. See Appendix A.6 for a basic computable lower bound estimate of $d_{\mathrm{GW}}^{\mathrm{MCMS}}$ . In the next section, we establish more sophisticated lower bounds for $d_{\mathrm{GW}}^{\mathrm{MCMS}}$ involving the WL distance. + +Table 1. 1-Nearest Neighbor classification accuracy. + +
METHODMUTAGPROTEINSPTC-FMPTC-MRIMDB-BIMDB-MCOX2
d(k)WL92.1 ± 6.363.0 ± 3.562.2 ± 8.556.2 ± 6.370.0 ± 4.341.3 ± 4.876.1 ± 5.5
d(k)WLLB87.3 ± 1.966.2 ± 2.262.5 ± 8.557.8 ± 6.869.9 ± 2.540.6 ± 3.881.2 ± 5.3
WWL85.1 ± 6.564.7 ± 2.858.2 ± 8.554.3 ± 7.965.0 ± 3.340.0 ± 3.376.1 ± 5.6
+ +Table 2. SVM classification accuracy. + +
METHODMUTAGPROTEINSPTC-FMPTC-MRIMDB-BIMDB-MCOX2
d(kWL)89.9 ± 6.472.6 ± 3.163.6 ± 7.057.9 ± 7.976.2 ± 4.151.6 ± 4.078.1 ± 0.8
d(kWLLB)90.0 ± 5.670.5 ± 1.063.3 ± 5.659.0 ± 8.375.1 ± 2.252.0 ± 1.878.1 ± 0.8
WWL85.3 ± 7.372.9 ± 3.662.2 ± 6.163.0 ± 7.470.8 ± 5.450.0 ± 5.378.2 ± 0.8
WL85.5 ± 1.671.6 ± 0.656.6 ± 2.156.2 ± 2.072.4 ± 0.750.9 ± 0.478.4 ± 1.1
WL-OA86.3 ± 2.172.6 ± 0.758.4 ± 2.054.2 ± 1.673.0 ± 1.150.2 ± 1.178.8 ± 1.3
+ +# 5.2. The WL Distance vs. the GW Distance + +Given a MCMS $(\mathcal{X},d_X)$ , fix any $x\in X$ . Then, one can endow $(\mathcal{X},d_X)$ with the label function $d_{X}(x,\bullet):X\to \mathbb{R}$ . This gives rise to the LMMC $(\mathcal{X},d_X(x,\bullet))$ . Then, we have the following lower bound of $d_{\mathrm{GW}}^{(k)}$ in terms of $d_{\mathrm{WL}}^{(k)}$ : + +Proposition 5.2. For each $k \geq 1$ and for any MCMSs $(\mathcal{X}, d_X)$ and $(\mathcal{Y}, d_Y)$ , one has that + +$$ +\begin{array}{l} d _ {\mathrm {G W}} ^ {(k)} \left(\left(\mathcal {X}, d _ {X}\right), \left(\mathcal {Y}, d _ {Y}\right)\right) \geq \\ \inf_{\gamma \in \mathcal{C}(\mu_{X},\mu_{Y})}\int_{\substack{X\times Y}}d_{\mathrm{WL}}^{(k)}\bigl((\mathcal{X},d_{X}(x,\bullet)),(\mathcal{Y},d_{Y}(y,\bullet))\bigr)\gamma (dx\times dy). \\ \end{array} +$$ + +Remark 5.3. When $(\mathcal{X}, d_X)$ and $(\mathcal{Y}, d_Y)$ are induced from MMSs $\mathbf{X}$ and $\mathbf{Y}$ , as shown in Example 3, the left-hand side of the above inequality coincides with the decoupled GW distance. We point out that the right-hand side is also independent of $k$ and actually coincides with the third lower bound (TLB) for the GW distance as defined in (Mémoli, 2011). See Appendix B.4.4 for more details. Hence, the proposition above can be viewed as a generalization of the TLB to the setting of MCMS. + +In general, a MCMS $(\mathcal{X}, d_X)$ endowed with any label function $\ell_X: X \to Z$ induces a LMMC $(X, m_{\bullet}^X, \mu_X, \ell_X)$ which we denote by $(\mathcal{X}, \ell_X)$ . If we assign label functions to all MCMSs in a suitable coherent way, we obtain that the WL distance between the induced LMMCs is stable w.r.t. the GW distance between corresponding MCMSs. + +Definition 9 (Label invariant of MCMCs). Given any metric space of labels $Z$ , a $Z$ -valued label invariant of MCMSSs is a map $\ell_{\bullet} : \mathcal{M}^{\mathrm{MS}} \to Z^{\bullet}$ which by definition sends each MCMS $(\mathcal{X}, d_X)$ into a label function $\ell_{X} : X \to Z$ . One such label invariant $\ell_{\bullet}$ will be said to be stable if + +for all $(\mathcal{X},d_X),(\mathcal{Y},d_Y)\in \mathcal{M}^{\mathrm{MS}},k\in \mathbb{N},$ and for any $\gamma \in \mathcal{C}(\mu_X,\mu_Y),\nu_{\bullet ,\bullet}^{(k)}\in \mathcal{C}^{(k)}(m_{\bullet}^{X},m_{\bullet}^{Y})$ we have + +$$ +\begin{array}{l} \int_ {X \times Y} \int_ {X \times Y} d _ {Z} \left(\ell_ {X} \left(x ^ {\prime}\right), \ell_ {Y} \left(y ^ {\prime}\right)\right) \nu_ {x, y} ^ {(k)} \left(d x ^ {\prime} \times d y ^ {\prime}\right) \gamma (d x \times d y) \\ \leq \operatorname {d i s} ^ {(k)} \left(\gamma , \nu_ {\bullet , \bullet} ^ {(k)}\right). \\ \end{array} +$$ + +By $\mathcal{L}(Z)$ we will denote the collection of all stable $Z$ -valued label invariants. + +Example 4. One immediate example of the stable label invariant is the eccentricity function $\operatorname{ecc}_{\bullet}$ (see Appendix B.4.5 for a proof): for any MCMS $(\mathcal{X}, d_X)$ , $\operatorname{ecc}_X(x) := \int_X d_X(x, x') \mu_X(dx')$ for $x \in X$ . + +Then, if one assigns stable labels to MCMs, one has that the WL distance between the induced LMMCs is stable w.r.t. the GW distance. + +Proposition 5.4. For every stable label invariant $\ell_{\bullet} \in \mathcal{L}(Z)$ , $k \in \mathbb{N}$ and $(\mathcal{X}, d_X)$ , $(\mathcal{Y}, d_Y) \in \mathcal{M}^{\mathrm{MS}}$ we have that $d_{\mathrm{WL}}^{(k)}((\mathcal{X}, \ell_X), (\mathcal{Y}, \ell_Y)) \leq d_{\mathrm{GW}}^{(k)}((\mathcal{X}, d_X), (\mathcal{Y}, d_Y))$ . + +# 6. Experimental Results + +We provide some results showing the effectiveness of our WL distance in terms of comparing graphs. We conduct both 1-NN and SVM graph classification experiments and evaluate the performance of both our lower bound, $d_{\mathrm{WLLB}}^{(k)}$ , and our WL distance, $d_{\mathrm{WL}}^{(k)}$ , against the WWL kernel/distance (Togninalli et al., 2019), the WL kernel and the WL optimal assignment (WL-OA) (Kriege et al., 2016) kernel. We note that the WWL kernel of (Togninalli et al., 2019) is a state-of-the-art graph kernel. We use the degree label for both $d_{\mathrm{WL}}^{(k)}$ and $d_{\mathrm{WLLB}}^{(k)}$ . More details on the experimental setup and extra experiments can be found in Appendix A.8. + +1-NN Classification. In this case, both $d_{\mathrm{WLLB}}^{(k)}$ and $d_{\mathrm{WL}}^{(k)}$ slightly outperform the WWL distance on all datasets we tested; see Table 1. Overall, the classification accuracies of $d_{\mathrm{WLLB}}^{(k)}$ and $d_{\mathrm{WL}}^{(k)}$ were close to those of the WWL distance. These results illustrate the close relationship between $d_{\mathrm{WL}}^{(k)}$ and the WWL distance that was outlined in Section 4. + +SVM Classification. See Table 2. First, we observe that our lower bound kernel slightly outperforms the WWL kernel for MUTAG, IMDB-B, and IMDB-M. For the other datasets, $d_{\mathrm{WLLB}}^{(k)}$ had comparable classification accuracy with the other methods, coming within one to two percent of WWL and WWL-OA. The $d_{\mathrm{WL}}^{(k)}$ kernel had similar classification accuracy to $d_{\mathrm{WLLB}}^{(k)}$ but only outperformed the $d_{\mathrm{WLLB}}^{(k)}$ kernel on PTC-FM, PROTEINS, and IMDB-B. + +Note that our lower bound distance $d_{\mathrm{WLLB}}$ performs similarly to our WL distance $d_{\mathrm{WL}}$ , but is more efficient to compute. See Appendix A.8.3 for the runtime comparison. + +# 7. Conclusion and Future Directions + +In this paper, we proposed the WL distance – a quantitative extension of the WL test – for measuring the dissimilarity between objects in a fairly general family called LMMCs. The WL distance possesses interesting connections with graph kernels, GNNs and the GW distance. In order to more directly compare the WL test with the WL distance without resorting to relabeling, one future direction is to redefine the WL distance via positive measures and “unbalanced” (Gromov-)Wasserstein distances (Liero et al., 2018; Séjourne et al., 2021; De Ponti & Mondino, 2020). Whereas our paper focuses on the application of our WL distance to the graph setting, LMMCs can be used to model not just graphs but also far more general objects such as Riemannian manifolds (equipped with heat kernels) or graphons. Then, our neural network architecture (MCNN) has the potential to be applied to point sets sampled from manifolds too, as well as serving as the limiting object when studying the convergence of GNNs. It is also interesting to extend our WL distance to a higher order version that is analogous to the high order $k$ -WL test and $k$ -GNNs. We conjecture that a suitable notion of $k$ -WL distance will converge to the Gromov-Wasserstein distance for MCMSs as $k$ tends to infinity. Finally, we point out that our WL distance can actually be regarded as a certain instance of optimal transport with special couplings (see Appendix A.2). It is of interest to explore the relation between our WL distance and some other distances between stochastic processes defined via optimal transport with special couplings (Backhoff et al., 2017; Moulos, 2021; O'Connor et al., 2022). + +# Acknowledgements + +This work is partially supported by NSF-DMS-1723003, NSF-CCF-1740761, NSF-RI-1901360, NSF-CCF-1839356, NSF-IIS-2050360, NSF-CCF-2112665 and BSF-2020124. + +# References + +Azizian, W. et al. Expressive power of invariant and equivariant graph neural networks. In International Conference on Learning Representations, 2020. +Babai, L. and Kucera, L. Canonical labelling of graphs in linear average time. In 20th Annual Symposium on Foundations of Computer Science (sfcs 1979), pp. 39-46. IEEE, 1979. +Babai, L. and Luks, E. M. Canonical labeling of graphs. In Proceedings of the fifteenth annual ACM symposium on Theory of computing, pp. 171-183, 1983. +Backhoff, J., Beiglbock, M., Lin, Y., and Zakashko, A. Causal transport in discrete time and applications. SIAM Journal on Optimization, 27(4):2528-2562, 2017. +Burago, D., Burago, Y., and Ivanov, S. A course in metric geometry, volume 33. American Mathematical Soc., 2001. +Chowdhury, S. and Mémoli, F. The Gromov-Wasserstein distance between networks and stable network invariants. Information and Inference: A Journal of the IMA, 8(4): 757-787, 2019. +De Ponti, N. and Mondino, A. Entropy-transport distances between unbalanced metric measure spaces. arXiv preprint arXiv:2009.10636, 2020. +Gilmer, J., Schoenholz, S. S., Riley, P. F., Vinyals, O., and Dahl, G. E. Neural message passing for quantum chemistry. In International conference on machine learning, pp. 1263-1272. PMLR, 2017. +Krebs, A. and Verbitsky, O. Universal covers, color refinement, and two-variable counting logic: Lower bounds for the depth. In 2015 30th Annual ACM/IEEE Symposium on Logic in Computer Science, pp. 689-700. IEEE, 2015. +Kriege, N. M., Giscard, P.-L., and Wilson, R. On valid optimal assignment kernels and applications to graph classification. Advances in Neural Information Processing Systems, 29:1623-1631, 2016. +Lehman, A. and Weisfeiler, B. A reduction of a graph to a canonical form and an algebra arising during this reduction. *Nauchno-Technicheskaya Informatiya*, 2(9): 12–16, 1968. + +Liero, M., Mielke, A., and Savare, G. Optimal entropy-transport problems and a new Hellinger-Kantorovich distance between positive measures. Inventiones mathematicae, 211(3):969-1117, 2018. +Loosli, G., Canu, S., and Ong, C. S. Learningsvm in krein spaces. IEEE transactions on pattern analysis and machine intelligence, 38(6):1204-1216, 2015. +Luss, R. and d'Aspremont, A. Support vector machine classification with indefinite kernels. Mathematical Programming Computation, 1(2):97-118, 2009. +Mémoli, F. On the use of Gromov-Hausdorff distances for shape comparison. In Botsch, M., Pajarola, R., Chen, B., and Zwicker, M. (eds.), Eurographics Symposium on Point-Based Graphics. The Eurographics Association, 2007. ISBN 978-3-905673-51-7. doi: 10.2312/SPBG/SPBG07/081-090. +Mémoli, F. Gromov-Wasserstein distances and the metric approach to object matching. Foundations of computational mathematics, 11(4):417-487, 2011. +Morris, C., Kriege, N. M., Bause, F., Kersting, K., Mutzel, P., and Neumann, M. Tudataset: A collection of benchmark datasets for learning with graphs. In ICML 2020 Workshop on Graph Representation Learning and Beyond (GRL+ 2020), 2020. URL www.graphlearning.io. +Moulos, V. Bicausal optimal transport for Markov chains via dynamic programming. In 2021 IEEE International Symposium on Information Theory (ISIT), pp. 1688-1693. IEEE, 2021. +Ollivier, Y. Ricci curvature of Markov chains on metric spaces. Journal of Functional Analysis, 256(3):810-864, 2009. +O'Connor, K., McGoff, K., and Nobel, A. B. Optimal transport for stationary Markov chains via policy iteration. Journal of Machine Learning Research, 23(45): 1-52, 2022. +Pele, O. and Werman, M. Fast and robust earth mover's distances. In 2009 IEEE 12th international conference on computer vision, pp. 460-467. IEEE, 2009. +Peyre, G., Cuturi, M., and Solomon, J. Gromov-Wasserstein averaging of kernel and distance matrices. In International Conference on Machine Learning, pp. 2664-2672. PMLR, 2016. +Pinkus, A. Approximation theory of the MLP model in neural networks. Acta numerica, 8:143-195, 1999. + +Saloff-Coste, L. Lectures on finite Markov chains. In Lectures on probability theory and statistics, pp. 301-413. Springer, 1997. +Scetbon, M., Peyre, G., and Cuturi, M. Linear-time Gromov-Wasserstein distances using low rank couplings and costs. arXiv preprint arXiv:2106.01128, 2021. +Schmitzer, B. and Schnörr, C. Modelling convex shape priors and matching based on the Gromov-Wasserstein distance. Journal of mathematical imaging and vision, 46(1):143-159, 2013. +Sejourné, T., Vialard, F.-X., and Peyré, G. The unbalanced Gromov-Wasserstein distance: Conic formulation and relaxation. In 35th Conference on Neural Information Processing Systems, 2021. +Shervashidze, N., Schweitzer, P., Van Leeuwen, E. J., Mehlhorn, K., and Borgwardt, K. M. Weisfeiler-Lehman graph kernels. Journal of Machine Learning Research, 12(9), 2011. +Sturm, K.-T. The space of spaces: curvature bounds and gradient flows on the space of metric measure spaces. arXiv preprint arXiv:1208.0434, 2012. +Titouan, V., Redko, I., Flamary, R., and Courty, N. Co-optimal transport. Advances in Neural Information Processing Systems, 33, 2020. +Togninalli, M., Ghisu, E., Llinares-López, F., Rieck, B., and Borgwardt, K. Wasserstein Weisfeiler-Lehman graph kernels. Advances in Neural Information Processing Systems, 32:6439-6449, 2019. +Vallender, S. Calculation of the Wasserstein distance between probability distributions on the line. Theory of Probability & Its Applications, 18(4):784-786, 1974. +Vayer, T., Chapel, L., Flamary, R., Tavenard, R., and Courty, N. Fused Gromov-Wasserstein distance for structured objects. Algorithms, 13(9):212, 2020. +Villani, C. Topics in optimal transportation, volume 58. American Mathematical Soc., 2003. +Villani, C. Optimal transport: old and new, volume 338. Springer, 2009. +von Renesse, M.-K. and Sturm, K.-T. Transport inequalities, gradient estimates, entropy and Ricci curvature. Communications on pure and applied mathematics, 58(7): 923-940, 2005. +Xu, K., Hu, W., Leskovec, J., and Jegelka, S. How powerful are graph neural networks? In International Conference on Learning Representations, 2018. + +# A. Extra Details + +# A.1. Useful Facts about Couplings + +Here we collect some useful facts about couplings which will be used in subsequent proofs. + +Lemma A.1. Let $X, Y$ be finite metric spaces and let $Z$ be a complete and separable metric space. Let $\varphi_X: X \to Z$ and $\varphi_Y: Y \to Z$ be measurable maps. Consider any $\mu_X \in \mathcal{P}(X)$ and $\mu_Y \in \mathcal{P}(Y)$ . Then, we have that + +$$ +d_{\mathrm{W}}((\varphi_{X})_{\#}\mu_{X},(\varphi_{Y})_{\#}\mu_{Y}) = \inf_{\gamma \in \mathcal{C}(\mu_{X},\mu_{Y})}\int \limits_{X\times Y}d_{Z}(\varphi_{X}(x),\varphi_{Y}(y))\gamma (dx\times dy). +$$ + +Proof. The proof is based on the following result. + +Lemma A.2. Let $X, Y$ be finite metric spaces and let $Z$ be a metric space of labels. Let $\varphi_X: X \to Z$ and $\varphi_Y: Y \to Z$ be measurable maps. Consider any $\mu_X \in \mathcal{P}(X)$ and $\mu_Y \in \mathcal{P}(Y)$ . If we let $\varphi := \varphi_X \times \varphi_Y$ , then we have that + +$$ +\varphi_ {\#} \mathcal {C} (\mu_ {X}, \mu_ {Y}) = \mathcal {C} ((\varphi_ {X}) _ {\#} \mu_ {X}, (\varphi_ {Y}) _ {\#} \mu_ {Y}) +$$ + +Proof of Lemma A.2. Since $X$ and $Y$ are finite, $\varphi_X(X)$ and $\varphi_Y(Y)$ are discrete sets. Then, the lemma follows directly from Proposition 4.5 in (Schmitzer & Schnörr, 2013). + +Hence, + +$$ +\begin{array}{l} d _ {\mathrm {W}} ((\varphi_ {X}) _ {\#} \mu_ {X}, (\varphi_ {Y}) _ {\#} \mu_ {Y}) = \inf _ {\gamma \in \mathcal {C} ((\varphi_ {X}) _ {\#} \mu_ {X}, (\varphi_ {Y}) _ {\#} \mu_ {Y})} \int_ {X \times Y} d _ {Z} (z _ {1}, z _ {2}) \gamma (d z _ {1} \times d z _ {2}) \\ = \inf _ {\gamma \in \mathcal {C} (\mu_ {X}, \mu_ {Y})} \int_ {X \times Y} d _ {Z} (z _ {1}, z _ {2}) \varphi_ {\#} \gamma (d z _ {1} \times d z _ {2}) \\ = \inf _ {\gamma \in \mathcal {C} (\mu_ {X}, \mu_ {Y})} \int_ {X \times Y} d _ {Z} (\varphi_ {X} (x), \varphi_ {Y} (y)) \gamma (d x \times d y). \\ \end{array} +$$ + +The following lemma is a direct consequence of (Villani, 2009, Corollary 5.22) + +Lemma A.3. For any complete and separable metric space $Z$ , there exists a measurable map $\varphi : \mathcal{P}(Z) \times \mathcal{P}(Z) \to \mathcal{P}(Z \times Z)$ so that for every $\alpha, \beta \in \mathcal{P}(Z)$ , $\varphi(\alpha, \beta)$ is an optimal coupling between $\alpha$ and $\beta$ . + +# A.2. A Characterization of the WL Distance + +Recall from Definition 7 that the WL distance of depth $k$ is the Wasserstein distance between the local distributions of labels generated at the $k$ th step of the WL hierarchy. In this section, we prove that in fact $d_{\mathrm{WL}}^{(k)}$ can be characterized through a novel variant of the Wasserstein distance between the distributions of initial labels (i.e., $(\ell_X)_\# \mu_X$ and $(\ell_Y)_\# \mu_Y$ ). + +# A.2.1. $k$ -STEP COUPLINGS + +We introduce a convenient notation which will be used in the sequel. + +Definition 10. Suppose a measurable space $Z$ , a probability measure $\gamma \in \mathcal{P}(Z)$ , and a measurable map $\nu_{\bullet}: Z \longrightarrow \mathcal{P}(Z)$ are given. Then, we define the average of $\nu_{\bullet}$ under $\gamma$ , denoted by $\nu_{\bullet} \odot \gamma$ , which is still a probability measure on $Z$ : + +$$ +F o r \quad a n y \quad m e a s u r a b l e \quad A \subseteq Z, \nu_ {\bullet} \odot \gamma (A) := \int_ {Z} \nu_ {z} (A) \gamma (d z). +$$ + +The operation $\odot$ will be useful for constructing a special type of couplings between Markov kernels. + +Given two MMCs $\mathcal{X}$ and $\mathcal{Y}$ , we introduce the following notion of $k$ -step coupling between Markov kernels $m_{\bullet}^{X}$ and $m_{\bullet}^{Y}$ : + +- $k = 1$ : A 1-step coupling between $m_{\bullet}^{X}$ and $m_{\bullet}^{Y}$ is any measurable map + +$$ +\nu_ {\bullet , \bullet} ^ {(1)}: X \times Y \to \mathcal {P} (X \times Y) +$$ + +such that $\nu_{x,y}^{(1)}\in \mathcal{C}(m_x^X,m_y^Y)$ for any $x\in X$ and $y\in Y$ + +- $k \geq 2$ : We say a map + +$$ +\nu_ {\bullet , \bullet} ^ {(k)}: X \times Y \to \mathcal {P} (X \times Y) +$$ + +is a $k$ -step coupling between the Markov kernels $m_{\bullet}^{X}$ and $m_{\bullet}^{Y}$ if there exist a $(k - 1)$ -step coupling $\nu_{\bullet,\bullet}^{(k-1)}$ and a 1-step coupling $\nu_{\bullet,\bullet}^{(1)}$ such that + +$$ +\nu_ {x, y} ^ {(k)} = \nu_ {\bullet , \bullet} ^ {(k - 1)} \odot \nu_ {x, y} ^ {(1)}, \forall x \in X, y \in Y. +$$ + +Lemma A.4. For any $k$ -step coupling $\nu_{\bullet,\bullet}^{(k)}$ , one has that $\nu_{x,y}^{(k)} \in \mathcal{C}\big(m_x^{X,\otimes k}, m_y^{Y,\otimes k}\big)$ for every $x \in X$ and $y \in Y$ . + +Proof. We prove the statement by induction on $k$ . When $k = 1$ , the statement is trivially true. Assume that the statement is true for some $k \geq 1$ . Then, for any measurable $A \subseteq X$ , we have that + +$$ +\begin{array}{l} \nu_ {x, y} ^ {(k + 1)} (A \times Y) = \int_ {X \times Y} \nu_ {x ^ {\prime}, y ^ {\prime}} ^ {(k)} (A \times Y) \nu_ {x, y} ^ {(1)} (d x ^ {\prime} \times d y ^ {\prime}) \\ = \int_ {X \times Y} m _ {x ^ {\prime}} ^ {X, \otimes k} (A) \nu_ {x, y} ^ {(1)} \left(d x ^ {\prime} \times d y ^ {\prime}\right) \\ = \int_ {X} m _ {x ^ {\prime}} ^ {X, \otimes k} (A) m _ {x} ^ {X} \left(d x ^ {\prime}\right) \\ = m _ {x} ^ {X, \otimes (k + 1)} (A). \\ \end{array} +$$ + +Similarly, for any measurable $B \subseteq Y$ , we have that + +$$ +\nu_ {x, y} ^ {(k + 1)} (X \times B) = m _ {y} ^ {Y, \otimes (k + 1)} (B). +$$ + +Hence $\nu_{x,y}^{(k + 1)}\in \mathcal{C}\left(m_x^{X,\otimes (k + 1)},m_y^{Y,\otimes (k + 1)}\right)$ and thus we conclude the proof. + +Henceforth, we denote by $\mathcal{C}^{(k)}\left(m_{\bullet}^{X},m_{\bullet}^{Y}\right)$ the collection of all $k$ -step couplings between Markov kernels $m_{\bullet}^{X}$ and $m_{\bullet}^{Y}$ + +Definition 11. Given any $k \in \mathbb{N}$ , any coupling $\gamma \in \mathcal{C}(\mu_X, \mu_Y)$ and any $k$ -step coupling $\nu_{\bullet,\bullet}^{(k)} \in \mathcal{C}^{(k)}(m_\bullet^X, m_\bullet^Y)$ , we define a probability measure on $X \times Y$ as follows: + +$$ +\mu^ {(k)} := \nu_ {\bullet , \bullet} ^ {(k)} \odot \gamma . \tag {5} +$$ + +We call $\mu^{(k)}$ defined as above a $k$ -step coupling between $\mu_{X}$ and $\mu_{Y}$ . We let $\mathcal{C}^{(k)}(\mu_X,\mu_Y)$ denote the collection of all $k$ -step couplings between $\mu_{X}$ and $\mu_{Y}$ and we also let $\mathcal{C}^{(0)}(\mu_X,\mu_Y)\coloneqq \mathcal{C}(\mu_X,\mu_Y)$ . + +As defined above, $k$ -step couplings are indeed couplings. + +Lemma A.5. Any $\mu^{(k)}\in \mathcal{C}^{(k)}(\mu_X,\mu_Y)$ is a coupling between $\mu_{X}$ and $\mu_{Y}$ + +Proof. For any measurable $A \subseteq X$ , we have that + +$$ +\begin{array}{l} \mu^ {(k)} (A \times Y) = \int_ {X \times Y} \nu_ {x, y} ^ {(k)} (A \times Y) \gamma (d x \times d y) \\ = \int_ {X \times Y} m _ {x} ^ {X, \otimes k} (A) \gamma (d x \times d y) \\ = \int_ {X} m _ {x} ^ {X, \otimes k} (A) \mu_ {X} (d x) \\ = \mu_ {X} (A). \\ \end{array} +$$ + +Similarly, for any measurable $B \subseteq Y$ , we have that $\mu^{(k)}(X \times B) = \mu_Y(B)$ . Therefore, $\mu^{(k)} \in \mathcal{C}(\mu_X, \mu_Y)$ . + +![](images/c1580fc9aedd62e6bb7cf332d9358364e2643e2be0a0ff457bc9d6a36d27f189.jpg) + +Lemma A.6. We have the following hierarchy of $k$ -step couplings: + +$$ +\mathcal {C} ^ {(0)} \left(\mu_ {X}, \mu_ {Y}\right) \supseteq \mathcal {C} ^ {(1)} \left(\mu_ {X}, \mu_ {Y}\right) \supseteq \mathcal {C} ^ {(2)} \left(\mu_ {X}, \mu_ {Y}\right) \supseteq \dots +$$ + +Proof. We prove the following inclusion by induction on $k = 0,1,\ldots$ : + +$$ +\mathcal {C} ^ {(k)} \left(\mu_ {X}, \mu_ {Y}\right) \supseteq \mathcal {C} ^ {(k + 1)} \left(\mu_ {X}, \mu_ {Y}\right) \tag {6} +$$ + +When $k = 0$ , we only need to check that any $\gamma^{(1)} \in \mathcal{C}^{(1)}(\mu_X, \mu_Y)$ is a coupling between $\mu_X$ and $\mu_Y$ . Assume that + +$$ +\gamma^ {(1)} = \nu_ {\bullet , \bullet} ^ {(1)} \odot \gamma +$$ + +for some $\nu_{\bullet,\bullet}^{(1)} \in \mathcal{C}^{(1)}\left(m_{\bullet}^{X}, m_{\bullet}^{Y}\right)$ and $\gamma \in \mathcal{C}(\mu_X, \mu_Y)$ . For any measurable set $A \subseteq X$ , we have that + +$$ +\begin{array}{l} \gamma^ {(1)} (A \times Y) = \int_ {X \times Y} \nu_ {x, y} ^ {(1)} (A \times Y) \gamma (d x \times d y) \\ = \int_ {X \times Y} m _ {x} ^ {X} (A) \gamma (d x \times d y) \\ = \int_ {X} m _ {x} ^ {X} (A) \mu_ {X} (d x) \\ = \mu_ {X} (A). \\ \end{array} +$$ + +Similarly, for any measurable $B \subseteq Y$ we have that + +$$ +\gamma^ {(1)} (X \times B) = \mu_ {Y} (B). +$$ + +Hence, $\gamma^{(1)}\in \mathcal{C}(\mu_X,\mu_Y)$ + +Now, assume that Equation (6) holds for some $k\geq 0$ . For any $\gamma^{(k + 2)}\in \mathcal{C}^{(k + 2)}(\mu_X,\mu_Y)$ , we assume that + +$$ +\gamma^ {(k + 2)} = \nu_ {\bullet , \bullet} ^ {(k + 2)} \odot \gamma , +$$ + +where $\nu_{\bullet,\bullet}^{(k+2)} \in \mathcal{C}^{(k+2)}\left(m_{\bullet}^{X}, m_{\bullet}^{Y}\right)$ and $\gamma \in \mathcal{C}(\mu_X, \mu_Y)$ . Then, there exist $\nu_{\bullet,\bullet}^{(k+1)} \in \mathcal{C}^{(k+1)}\left(m_{\bullet}^{X}, m_{\bullet}^{Y}\right)$ and $\nu_{\bullet,\bullet}^{(1)} \in \mathcal{C}^{(1)}\left(m_{\bullet}^{X}, m_{\bullet}^{Y}\right)$ such that + +$$ +\nu_ {x, y} ^ {(k + 2)} = \nu_ {\bullet , \bullet} ^ {(k + 1)} \odot \nu_ {x, y} ^ {(1)}, \forall x \in X, y \in Y. +$$ + +Hence, + +$$ +\begin{array}{l} \gamma^ {(k + 2)} = \int_ {X \times Y} \int_ {X \times Y} \nu_ {x ^ {\prime}, y ^ {\prime}} ^ {(k + 1)} \nu_ {x, y} ^ {(1)} (d x ^ {\prime} \times d y ^ {\prime}) \gamma (d x \times d y) \\ = \int_ {X \times Y} \nu_ {x ^ {\prime}, y ^ {\prime}} ^ {(k + 1)} \int_ {X \times Y} \nu_ {x, y} ^ {(1)} (d x ^ {\prime} \times d y ^ {\prime}) \gamma (d x \times d y) \\ = \int_ {X \times Y} \nu_ {x ^ {\prime}, y ^ {\prime}} ^ {(k + 1)} \gamma^ {(1)} (d x ^ {\prime} \times d y ^ {\prime}). \\ \end{array} +$$ + +Here that $\gamma^{(1)}\coloneqq \nu_{\bullet ,\bullet}^{(1)}\odot \gamma$ belongs to $\mathcal{C}(\mu_X,\mu_Y)$ follows from the case $k = 0$ . Hence, by the induction assumption, $\gamma^{(k + 2)}\in \mathcal{C}^{(k + 1)}(\mu_X,\mu_Y)$ which concludes the proof. + +# A.2.2. A CHARACTERIZATION OF $d_{\mathrm{WL}}^{(k)}$ VIA $k$ -STEP COUPLINGS + +Now, we characterize $d_{\mathrm{WL}}^{(k)}$ via $k$ -step couplings defined in the previous section. + +Theorem A.7. Given any integer $k \geq 0$ and any two $Z$ -LMMC $(\mathcal{X},\ell_X)$ and $(\mathcal{Y},\ell_Y)$ , we have that + +$$ +d_{\mathrm{WL}}^{(k)}((\mathcal{X},\ell_{X}),(\mathcal{Y},\ell_{Y})) = \inf_{\gamma^{(k)}\in \mathcal{C}^{(k)}(\mu_{X},\mu_{Y})}\int \limits_{X\times Y}d_{Z}(\ell_{X}(x),\ell_{Y}(y))\gamma^{(k)}(dx\times dy). +$$ + +Proof of Theorem A.7. The case $k = 0$ holds trivially. Now, for any $k \geq 1$ and for any $x \in X$ and $y \in Y$ , by Lemma A.1 we have that + +$$ +d_{\mathrm{W}}\Bigl(\mathfrak{l}^{(k)}_{(\mathcal{X},\ell_{X})}(x),\mathfrak{l}^{(k)}_{(\mathcal{Y},\ell_{Y})}(y)\Bigr) = \inf_{\nu_{x,y}\in \mathcal{C}(m^{X}_{x},m^{Y}_{y})}\int \limits_{X\times Y}d_{\mathrm{W}}\Bigl(\mathfrak{l}^{(k - 1)}_{(\mathcal{X},\ell_{X})}(x^{\prime}),\mathfrak{l}^{(k - 1)}_{(\mathcal{Y},\ell_{Y})}(y^{\prime})\Bigr)\nu_{x,y}(dx^{\prime}\times dy^{\prime}). +$$ + +Since $(x,y)\mapsto (m_x^X,m_y^Y)$ is measurable by definition of Markov kernels, by Lemma A.3 we have that there exists a measurable map $\nu_{\bullet ,\bullet}:X\times Y\to \mathcal{P}(X\times Y)$ such that for every $x\in X$ and $y\in Y$ $\nu_{x,y}$ is optimal, i.e., + +$$ +d _ {\mathrm {W}} \left(\mathfrak {l} _ {(\mathcal {X}, \ell_ {X})} ^ {(k)} (x), \mathfrak {l} _ {(\mathcal {Y}, \ell_ {Y})} ^ {(k)} (y)\right) = \int_ {X \times Y} d _ {\mathrm {W}} \left(\mathfrak {l} _ {(\mathcal {X}, \ell_ {X})} ^ {(k - 1)} \left(x ^ {\prime}\right), \mathfrak {l} _ {(\mathcal {Y}, \ell_ {Y})} ^ {(k - 1)} \left(y ^ {\prime}\right)\right) \nu_ {x, y} \left(d x ^ {\prime} \times d y ^ {\prime}\right). \tag {7} +$$ + +Hence, we have the following formulas. + +$$ +\begin{array}{l} d _ {\mathrm {W L}} ^ {(k)} \left(\left(\mathcal {X}, \ell_ {X}\right), \left(\mathcal {Y}, \ell_ {Y}\right)\right) \\ = d _ {\mathrm {W}} \left(\left(\mathfrak {l} _ {\left(\mathcal {X}, \ell_ {X}\right)} ^ {(k)}\right) _ {\#} \mu_ {X}, \left(\mathfrak {l} _ {\left(\mathcal {Y}, \ell_ {Y}\right)} ^ {(k)}\right) _ {\#} \mu_ {Y}\right) \\ = \int_ {X \times Y} d _ {\mathrm {W}} \left(\mathfrak {l} _ {\left(x, \ell_ {X}\right)} ^ {(k)} (x), \mathfrak {l} _ {\left(y, \ell_ {Y}\right)} ^ {(k)} (y)\right) \gamma (d x \times d y), \quad \text {h e r e} \gamma \in \mathcal {C} \left(\mu_ {X}, \mu_ {Y}\right) \text {i s c h o s e n t o b e o p t i m a l} \\ = \int_ {X \times Y} \int_ {X \times Y} d _ {\mathrm {W}} \left(\mathfrak {l} _ {(\mathcal {X}, \ell_ {X})} ^ {(k - 1)} (x _ {1}), \mathfrak {l} _ {(\mathcal {Y}, \ell_ {Y})} ^ {(k - 1)} (y _ {1})\right) (\nu_ {1}) _ {x, y} (d x _ {1} \times d y _ {1}) \gamma (d x \times d y), \\ = \int_ {X \times Y} \dots \int_ {X \times Y} d _ {\mathrm {W}} \Big (\mathfrak {l} _ {(\mathcal {X}, \ell_ {X})} ^ {(0)} (x _ {k}), \mathfrak {l} _ {(\mathcal {Y}, \ell_ {Y})} ^ {(0)} (y _ {k}) \Big) (\nu_ {k}) _ {x _ {k - 1}, y _ {k - 1}} (d x _ {k} \times d y _ {k}) \dots (\nu_ {1}) _ {x, y} (d x _ {1} \times d y _ {1}) \gamma (d x \times d y). \\ \end{array} +$$ + +Here, each $(\nu_{i})_{\bullet ,\bullet}\in \mathcal{C}^{(1)}(m_{\bullet}^{X},m_{\bullet}^{Y})$ for $i = 1,\ldots ,k$ is optimal in the sense of Equation (7). + +From the above equations, we identify a probability measure on $X \times Y$ for every $x \in X$ and $y \in Y$ as follows + +$$ +\nu_ {x, y} ^ {(k)} := \int_ {X \times Y} \dots \int_ {X \times Y} (\nu_ {k}) _ {x _ {k - 1}, y _ {k - 1}} (\nu_ {k - 1}) _ {x _ {k - 2}, y _ {k - 2}} (d x _ {k - 1} \times d y _ {k - 1}) \dots (\nu_ {1}) _ {x, y} (d x _ {1} \times d y _ {1}). +$$ + +It is obvious that $\nu_{\bullet,\bullet}^{(k)}$ is a $k$ -step coupling and thus + +$$ +\begin{array}{l} d _ {\mathrm {W L}} ^ {(k)} \left(\left(\mathcal {X}, \ell_ {X}\right), \left(\mathcal {Y}, \ell_ {Y}\right)\right) = d _ {\mathrm {W}} \left(\left(\mathrm {I} _ {\left(\mathcal {X}, \ell_ {X}\right)} ^ {(k)}\right) _ {\#} \mu_ {X}, \left(\mathrm {I} _ {\left(\mathcal {Y}, \ell_ {Y}\right)} ^ {(k)}\right) _ {\#} \mu_ {Y}\right) \\ = \int_ {X \times Y} \int_ {X \times Y} d _ {\mathrm {W}} \left(\mathfrak {l} _ {\left(x, \ell_ {X}\right)} ^ {(0)} \left(x ^ {\prime}\right), \mathfrak {l} _ {\left(y, \ell_ {Y}\right)} ^ {(0)} \left(y ^ {\prime}\right)\right) \nu_ {x, y} ^ {(k)} \left(d x ^ {\prime} \times d y ^ {\prime}\right) \gamma (d x \times d y) \\ \geq \inf_{\gamma^{(k)}\in \mathcal{C}^{(k)}(\mu_{X},\mu_{Y})}\int \limits_{X\times Y}d_{\mathrm{W}}(\ell_{X}(x),\ell_{Y}(y)) \gamma^{(k)}(dx\times dy), \\ \end{array} +$$ + +Conversely, we have that given any $\gamma^{(k)}\coloneqq \nu_{\bullet ,\bullet}^{(k)}\odot \gamma \in \mathcal{C}^{(k)}(\mu_X,\mu_Y)$ , where $\gamma \in \mathcal{C}(\mu_X,\mu_Y)$ and $\nu_{\bullet ,\bullet}^{(k)}\in \mathcal{C}^{(k)}\big(m_{\bullet}^{X},m_{\bullet}^{Y}\big)$ can be written for every $x\in X$ and $y\in Y$ as follows + +$$ +\nu_ {x, y} ^ {(k)} := \int_ {X \times Y} \dots \int_ {X \times Y} (\nu_ {k}) _ {x _ {k - 1}, y _ {k - 1}} (\nu_ {k - 1}) _ {x _ {k - 2}, y _ {k - 2}} (d x _ {k - 1} \times d y _ {k - 1}) \dots (\nu_ {1}) _ {x, y} (d x _ {1} \times d y _ {1}), +$$ + +the following inequalities hold: + +$$ +\begin{array}{l} \int_ {X \times Y} d _ {\mathrm {W}} (\ell_ {X} (x), \ell_ {Y} (y)) \gamma^ {(k)} (d x \times d y) \\ = \int_ {X \times Y} \int_ {X \times Y} d _ {\mathrm {W}} \left(\mathfrak {l} _ {\left(x, \ell_ {X}\right)} ^ {(0)} \left(x _ {k}\right), \mathfrak {l} _ {\left(y, \ell_ {Y}\right)} ^ {(0)} \left(y _ {k}\right)\right) \nu_ {x, y} ^ {(k)} \left(d x _ {k} \times d y _ {k}\right) \gamma (d x \times d y) \\ = \int_ {X \times Y} \dots \int_ {X \times Y} d _ {\mathrm {W}} \left(\mathfrak {l} _ {\left(x, \ell_ {X}\right)} ^ {(0)} \left(x _ {k}\right), \mathfrak {l} _ {\left(y, \ell_ {Y}\right)} ^ {(0)} \left(y _ {k}\right)\right) \left(\nu_ {k}\right) _ {x _ {k - 1}, y _ {k - 1}} \left(d x _ {k} \times d y _ {k}\right) \dots \left(\nu_ {1}\right) _ {x, y} \left(d x _ {1} \times d y _ {1}\right) \gamma (d x \times d y) \\ \geq \int_ {X \times Y} \dots \int_ {X \times Y} d _ {\mathrm {W}} \left(\mathfrak {l} _ {(\mathcal {X}, \ell_ {X})} ^ {(1)} (x _ {k - 1}), \mathfrak {l} _ {(\mathcal {Y}, \ell_ {Y})} ^ {(1)} (y _ {k - 1})\right) (\nu_ {k - 1}) _ {x _ {k - 2}, y _ {k - 2}} (d x _ {k - 1} \times d y _ {k - 1}) \dots (\nu_ {1}) _ {x, y} (d x _ {1} \times d y _ {1}) \gamma (d x \times d y) \\ \begin{array}{c c c} \cdot & \cdot & \cdot \\ \hline \end{array} \\ \geq \int_ {X \times Y} \int_ {X \times Y} d _ {\mathrm {W}} \left(\mathfrak {l} _ {(\mathcal {X}, \ell_ {X})} ^ {(k - 1)} (x _ {1}), \mathfrak {l} _ {(\mathcal {Y}, \ell_ {Y})} ^ {(k - 1)} (y _ {1})\right) (\nu_ {1}) _ {x, y} (d x _ {1} \times d y _ {1}) \gamma (d x \times d y) \\ \geq \int_ {X \times Y} d _ {\mathrm {W}} \left(\mathfrak {l} _ {\left(x, \ell_ {X}\right)} ^ {(k)} (x), \mathfrak {l} _ {\left(y, \ell_ {Y}\right)} ^ {(k)} (y)\right) \gamma (d x \times d y) \\ \geq d _ {\mathrm {W}} \left(\left(\mathfrak {l} _ {(\mathcal {X}, \ell_ {X})} ^ {(k)}\right) _ {\#} \mu_ {X}, \left(\mathfrak {l} _ {(\mathcal {Y}, \ell_ {Y})} ^ {(k)}\right) _ {\#} \mu_ {Y}\right). \\ \end{array} +$$ + +Infimizing over all $\gamma$ and $\nu_{\bullet,\bullet}^{(k)}$ , one concludes the proof. + +![](images/ac58b87ee09540755dea2cbb19dd54e163f9b8bb5974a23037af2c73ff589d3f.jpg) + +# A.3. The Wasserstein Weisfeiler-Lehman Graph Kernel and its Relationship with $d_{\mathrm{WL}}$ + +The Wasserstein Weisfeiler-Lehman graph kernel deals with graphs with either categorical or "continuous" (i.e., Euclidean) labels (Togninalli et al., 2019). We only consider WWL graph kernel w.r.t. continuous labels since categorical labels usually don't come equipped with a distance. Even if we artificially defined a distance on a set of categorical labels (e.g. using Euclidean distance via one-hot encoding), we point out that there wouldn't be a clear relation between WWL graph kernel and the WL distance since at each step of WWL graph kernel a hash function is invoked to map into a single label a pair consisting of a label and a multiset of labels. Now, we describe the WWL framework w.r.t. continuous labels as follows. For technical reasons, we assume that all graphs involved in this section are such that all their connected components have cardinality at least 2 (i.e. no graph contains an isolated vertex). + +Given a labeled graph $(G, \ell_G : V_G \to \mathbb{R}^d)$ , the label function is updated for a fixed number $k$ of iterations according to the equation below for $i = 0, \dots, k-1$ , where $\ell_G^0 \coloneqq \ell_G$ . + +$$ +\forall v \in V _ {G}, \ell_ {G} ^ {i + 1} (v) := \frac {1}{2} \left(\ell_ {G} ^ {i} (v) + \frac {1}{\deg_ {G} (v)} \sum_ {v ^ {\prime} \in N _ {G} (v)} \ell_ {G} ^ {i} (v ^ {\prime})\right). +$$ + +Then, for each $i = 0,\dots ,k$ there is a label function $\ell_{(G,\ell_G)}^{(i)}:V_G\to \mathbb{R}^d$ . Define the stacked label function $L_{G}^{k}$ as follows: + +$$ +L _ {G} ^ {k} := \left(\ell_ {G} ^ {0}, \dots , \ell_ {G} ^ {k}\right): V _ {G} \to \mathbb {R} ^ {d \times (k + 1)}. +$$ + +Now, given any two labeled graphs $(G_{1},\ell_{G_{1}})$ and $(G_{2},\ell_{G_{2}})$ , Togninalli et al. (2019) first computed $L_{G_1}^k$ and $L_{G_2}^k$ , then computed the Wasserstein distance between their induced distributions (which we call the WWL distance) and finally, built a kernel upon this Wasserstein distance. If we let $\lambda_{G_i}$ denote the uniform measure on $V_{G_i}$ , then we express their WWL distance via pushforward of uniform measures as follows. + +$$ +D ^ {(k)} \left(\left(G _ {1}, \ell_ {G _ {1}}\right), \left(G _ {2}, \ell_ {G _ {2}}\right)\right) := d _ {\mathrm {W}} \left(\left(L _ {G _ {1}} ^ {k}\right) _ {\#} \lambda_ {G _ {1}}, \left(L _ {G _ {2}} ^ {k}\right) _ {\#} \lambda_ {G _ {2}}\right). \tag {8} +$$ + +Now, if we instead of uniform measures consider the stationary distributions $\mu_{G_1}$ and $\mu_{G_2}$ w.r.t. $m_{\bullet}^{G_1,\frac{1}{2}}$ and $m_{\bullet}^{G_2,\frac{1}{2}}$ , + +![](images/84de47753b1415c353593ca1ca83a817be52be11bf84609997967425913d1af8.jpg) +$G_{1}$ + +![](images/16cc8bf5d3d3ec985cd3f4dc43053dd85dca88f5079aa83847ca23d695a871ec.jpg) +$G_{2}$ +Figure 2. In this figure we show two labeled graphs and each of them has $3n + 2$ vertices. Each of the graphs has $n$ vertices with label 1, $n$ vertices with label $-1$ , and $n + 2$ vertices with label 0. + +respectively, we define the following variant of $D^{(k)}$ : + +$$ +\hat {D} ^ {(k)} \left(\left(G _ {1}, \ell_ {G _ {1}}\right), \left(G _ {2}, \ell_ {G _ {2}}\right)\right) := d _ {\mathrm {W}} \left(\left(L _ {G _ {1}} ^ {k}\right) _ {\#} \mu_ {G _ {1}}, \left(L _ {G _ {2}} ^ {k}\right) _ {\#} \mu_ {G _ {2}}\right), \tag {9} +$$ + +which is the distance which we will relate to our WL distance next. In fact, we then prove that $\hat{D}^{(k)}((G_1,\ell_{G_1}),(G_2,\ell_{G_2}))$ actually provides a lower bound for $d_{\mathrm{WL}}^{(k)}((\mathcal{X}_q(G_1),\ell_{G_1}),(\mathcal{X}_q(G_2),\ell_{G_2}))$ when $q = \frac{1}{2}$ . + +Proposition A.8. For any two labeled graphs $(G_{1},\ell_{G_{1}}:V_{G_{1}}\to \mathbb{R}^{d})$ and $(G_{2},\ell_{G_{2}}:V_{G_{2}}\to \mathbb{R}^{d})$ , one has that for $q = \frac{1}{2}$ and any $k\in \mathbb{N}$ , + +$$ +\hat {D} ^ {(k)} \left(\left(G _ {1}, \ell_ {G _ {1}}\right), \left(G _ {2}, \ell_ {G _ {2}}\right)\right) \leq k \cdot d _ {\mathrm {W L}} ^ {(k)} \left(\left(\mathcal {X} _ {q} \left(G _ {1}\right), \ell_ {G _ {1}}\right), \left(\mathcal {X} _ {q} \left(G _ {2}\right), \ell_ {G _ {2}}\right)\right). +$$ + +The proposition will be proved after we provide some examples and remarks. + +Example 5 ( $d_{\mathrm{WL}}^{(k)}$ is more discriminating than $\hat{D}^{(k)})$ ). In this example, we construct a family of pairs of graphs so that $\hat{D}^{(k)}$ between the pairs is always zero but $d_{\mathrm{WL}}$ between the pairs is positive. For any $n \geq 2$ , consider the two $(3n + 2)$ -point labeled graphs shown in Figure 2. It is easy to see that for each $i = 1, 2$ , and any $v \in V_{G_i}$ + +1. if $\ell_{G_i}(v) = 0$ , then $\ell_{G_i}^k(v) = 0$ for all $k = 0, 1, \ldots$ ; +2. if $\ell_{G_i}(v) = \pm 1$ , then $\ell_{G_i}^k(v) = \pm \frac{1}{2^k}$ for all $k = 0, 1, \ldots$ + +Hence, for any $k = 0, \ldots$ , we have that + +$$ +\left(L _ {G _ {1}} ^ {k}\right) _ {\#} \mu_ {G _ {1}} = \left(L _ {G _ {2}} ^ {k}\right) _ {\#} \mu_ {G _ {2}} = \frac {4 n + 2}{6 n + 2} \delta_ {(0, \dots , 0)} + \frac {n}{6 n + 2} \delta_ {(1, \dots , 2 ^ {- k})} + \frac {n}{6 n + 2} \delta_ {(- 1, \dots , - 2 ^ {- k})}. +$$ + +Therefore, $\hat{D}^{(k)}((G_1,\ell_{G_1}),(G_2,\ell_{G_2})) = 0$ for all $k = 0,\ldots$ + +For proving that $d_{\mathrm{WL}} > 0$ we first analyze $\mathfrak{l}_{(\mathcal{X}(G_1),\varepsilon_{G_1})}^{(1)}(v_1)$ for any $v_{1}\in V_{G_{1}}$ + +1. If $\ell_{G_1}(v_1) = \pm 1$ , then + +$$ +\mathfrak {l} _ {\left(\mathcal {X} \left(G _ {1}\right), \ell_ {G _ {1}}\right)} ^ {(1)} (v _ {1}) = \frac {1}{2} \delta_ {0} + \frac {1}{2} \delta_ {\pm 1}. +$$ + +2. If $\ell_{G_1}(v_1) = 0$ and $v_{1}$ is neither the leftmost nor the rightmost vertex, then + +$$ +\mathfrak {l} _ {(\mathcal {X} (G _ {1}), \ell_ {G _ {1}})} ^ {(1)} (v _ {1}) = \frac {6}{8} \delta_ {0} + \frac {1}{8} \delta_ {1} + \frac {1}{8} \delta_ {- 1}. +$$ + +3. If $v_{1}$ is either the leftmost or the rightmost vertex, then + +$$ +\mathfrak {l} _ {(\mathcal {X} (G _ {1}), \ell_ {G _ {1}})} ^ {(1)} (v _ {1}) = \delta_ {0}. +$$ + +We then analyze $\mathfrak{l}_{(\mathcal{X}(G_2),\ell_{G_2})}^{(1)}(v_2)$ for any $v_{2}\in V_{G_{2}}$ + +1. If $\ell_{G_2}(v_2) = \pm 1$ , then + +$$ +\mathfrak {l} _ {\left(\mathcal {X} \left(G _ {2}\right), \ell_ {G _ {2}}\right)} ^ {(1)} (v _ {2}) = \frac {1}{2} \delta_ {0} + \frac {1}{2} \delta_ {\pm 1}. +$$ + +2. If $v_{2}$ is the center vertex, then + +$$ +\mathfrak {l} _ {(\mathcal {X} (G _ {2}), \ell_ {G _ {2}})} ^ {(1)} (v _ {2}) = \frac {2 n + 1}{3 n + 1} \delta_ {0} + \frac {n}{2 (3 n + 1)} \delta_ {1} + \frac {n}{2 (3 n + 1)} \delta_ {- 1}. +$$ + +3. If $\ell_{G_2}(v_2) = 0$ and $v_{2}$ is not the center vertex, then + +$$ +\mathfrak {l} _ {(\mathcal {X} (G _ {2}), \ell_ {G _ {2}})} ^ {(1)} (v _ {2}) = \delta_ {0}. +$$ + +Hence, it is clear that when $n > 1$ + +$$ +d _ {\mathrm {W L}} ^ {(1)} ((\mathcal {X} _ {q} (G _ {1}), \ell_ {G _ {1}}), (\mathcal {X} _ {q} (G _ {2}), \ell_ {G _ {2}})) = d _ {\mathrm {W}} \left(\left(\mathfrak {l} _ {(\mathcal {X} (G _ {1}), \ell_ {G _ {1}})} ^ {(1)}\right) _ {\#} \mu_ {G _ {1}}, \left(\mathfrak {l} _ {(\mathcal {X} (G _ {2}), \ell_ {G _ {2}})} ^ {(1)}\right) _ {\#} \mu_ {G _ {2}}\right) > 0. +$$ + +Remark A.9. Our WL distance formulation is flexible and we can of course relax it by allowing the comparison of measure Markov chains with general reference probability measures which are not necessarily stationary. In that case, we can directly compare $D^{(k)}$ defined in Equation (8) with $d_{\mathrm{WL}}^{(k)}$ . More precisely, for any graph $G$ , we can replace the stationary distribution inherent to $\mathcal{X}_q(G)$ with the uniform measure and hence obtain a new measure Markov chain $\mathcal{X}_q^{\mathrm{u}}(G)$ . Then, the same proof technique used for proving Proposition A.8 can be used for proving that + +$$ +D ^ {(k)} ((G _ {1}, \ell_ {G _ {1}}), (G _ {2}, \ell_ {G _ {2}})) \leq k \cdot d _ {\mathrm {W L}} ^ {(k)} ((\mathcal {X} _ {q} ^ {\mathrm {u}} (G _ {1}), \ell_ {G _ {1}}), (\mathcal {X} _ {q} ^ {\mathrm {u}} (G _ {2}), \ell_ {G _ {2}})). +$$ + +Moreover, we can show that $d_{\mathrm{WL}}^{(k)}$ is strictly more discriminating than $D^{(k)}$ via the same pairs of graphs as in Example 5. + +The proof of Proposition A.8 is based on the following basic fact about the Wasserstein distance: + +Lemma A.10. Let $Z$ be a complete and separable metric space. Endow $Z \times Z$ with any product metric $d_{Z \times Z}$ such that + +$$ +d _ {Z \times Z} \left(\left(z _ {1}, z _ {2}\right), \left(z _ {3}, z _ {4}\right)\right) \leq d _ {Z} \left(z _ {1}, z _ {3}\right) + d _ {Z} \left(z _ {2}, z _ {4}\right) \forall z _ {1}, z _ {2}, z _ {3}, z _ {4} \in Z. +$$ + +For example, one can let + +$$ +d _ {Z \times Z} ((z _ {1}, z _ {2}), (z _ {3}, z _ {4})) := \sqrt {\left(d _ {Z} (z _ {1} , z _ {3})\right) ^ {2} + \left(d _ {Z} (z _ {2} , z _ {4})\right) ^ {2}}. +$$ + +Given any complete and separable metric space $X$ , for any $i = 1,2$ and any measurable maps $f_{i},g_{i}:X\to Z$ , if we let $h_i\coloneqq (f_i,g_i):X\to Z\times Z$ , then for any $\mu_1,\mu_2\in \mathcal{P}(X)$ + +$$ +d _ {\mathrm {W}} \left(\left(h _ {1}\right) _ {\#} \mu_ {1}, \left(h _ {2}\right) _ {\#} \mu_ {2}\right) \leq d _ {\mathrm {W}} \left(\left(f _ {1}\right) _ {\#} \mu_ {1}, \left(f _ {2}\right) _ {\#} \mu_ {2}\right) + d _ {\mathrm {W}} \left(\left(g _ {1}\right) _ {\#} \mu_ {1}, \left(g _ {2}\right) _ {\#} \mu_ {2}\right). +$$ + +Proof of Lemma A.10. For any $\gamma_f, \gamma_g \in \mathcal{C}(\mu_1, \mu_2)$ , we define a probability measure $\nu \in \mathcal{P}(Z \times Z \times Z \times Z)$ as follows: for any measurable $A, A', B, B' \subseteq Z$ + +$$ +\nu \left(A \times A ^ {\prime} \times B \times B ^ {\prime}\right) := \left(f _ {1} \times f _ {2}\right) _ {\#} \gamma_ {f} (A \times B) \cdot \left(g _ {1} \times g _ {2}\right) _ {\#} \gamma_ {g} \left(A ^ {\prime} \times B ^ {\prime}\right). +$$ + +It is easy to show that $\nu \in \mathcal{C}\left((h_1)_{\#}\mu_1,(h_2)_{\#}\mu_2\right)$ . Then, + +$$ +\begin{array}{l} d_{\mathrm{W}}((h_{1})_{\#}\mu_{1},(h_{2})_{\#}\mu_{2})\leq \int \limits_{Z\times Z}\int \limits_{Z\times Z}d_{Z\times Z}((z_{1},z_{2}),(z_{3},z_{4}))\nu (dz_{1}\times dz_{2}\times dz_{3}\times dz_{4}) \\ \leq \int_ {Z \times Z} \int_ {Z \times Z} \left(d _ {Z} \left(z _ {1}, z _ {3}\right) + d _ {Z} \left(z _ {2}, z _ {4}\right)\right) \nu \left(d z _ {1} \times d z _ {2} \times d z _ {3} \times d z _ {4}\right) \\ \leq \int_ {Z \times Z} d _ {Z} \left(z _ {1}, z _ {3}\right) \left(f _ {1} \times f _ {2}\right) _ {\#} \gamma_ {f} \left(d z _ {1} \times d z _ {3}\right) + \int_ {Z \times Z} d _ {Z} \left(z _ {2}, z _ {4}\right) \left(g _ {1} \times g _ {2}\right) _ {\#} \gamma_ {g} \left(d z _ {2} \times d z _ {4}\right) \\ \end{array} +$$ + +By Lemma A.1, infinizing over all $\gamma_f,\gamma_g\in \mathcal{C}(\mu_1,\mu_2)$ , we obtain the conclusion. + +![](images/bb36a823815a3da6ee6fded99e68a542b874f2a6f3f4df7b3a94d13378370cb6.jpg) + +Proof of Proposition A.8. Since $L_G^k \coloneqq (\ell_G^0, \dots, \ell_G^k)$ , by inductively applying Lemma A.10, we have that + +$$ +\hat {D} ^ {(k)} (G _ {1}, G _ {2}) = d _ {\mathrm {W}} \Big (\left(L _ {G _ {1}} ^ {k}\right) _ {\#} \mu_ {G _ {1}}, \left(L _ {G _ {2}} ^ {k}\right) _ {\#} \mu_ {G _ {2}} \Big) \leq \sum_ {i = 1} ^ {k} d _ {\mathrm {W}} \Big (\left(\ell_ {G _ {1}} ^ {i}\right) _ {\#} \mu_ {G _ {1}}, \left(\ell_ {G _ {2}} ^ {i}\right) _ {\#} \mu_ {G _ {2}} \Big). +$$ + +Choose $\varphi_{j} := \mathrm{id}: \mathbb{R}^{d} \to \mathbb{R}^{d}$ to be the identity map for each $j = 1, \ldots, k$ , then using notation from Appendix B.3.1, we have that + +$$ +\ell_ {G _ {i}} ^ {j} = \ell_ {G _ {i}} ^ {(\varphi , j)}, \forall i = 1, 2 \text {a n d} \forall j = 1, \dots , k. +$$ + +Then, by Equation (19), we conclude that + +$$ +\hat {D} ^ {(k)} (G _ {1}, G _ {2}) \leq \sum_ {i = 1} ^ {k} d _ {\mathrm {W}} \left(\left(\mathfrak {l} _ {(\mathcal {X} _ {q} (G _ {1}), \ell_ {G _ {1}})} ^ {(i)}\right) _ {\#} \mu_ {G _ {1}}, \left(\mathfrak {l} _ {(\mathcal {X} _ {q} (G _ {2}), \ell_ {G _ {2}})} ^ {(i)}\right) _ {\#} \mu_ {G _ {2}}\right) = \sum_ {i = 1} ^ {k} d _ {\mathrm {W L}} ^ {(i)} ((\mathcal {X} _ {q} (G _ {1}), \ell_ {G _ {1}}), (\mathcal {X} _ {q} (G _ {2}), \ell_ {G _ {2}})). +$$ + +By Proposition 3.1, we have that + +$$ +\hat {D} ^ {(k)} (G _ {1}, G _ {2}) \leq k \cdot d _ {\mathrm {W L}} ^ {(k)} ((\mathcal {X} _ {q} (G _ {1}), \ell_ {G _ {1}}), (\mathcal {X} _ {q} (G _ {2}), \ell_ {G _ {2}})). +$$ + +# A.4. A Decoupled Version of the Gromov-Wasserstein Distance + +For simplicity, in this section we will assume that the cardinality of all underlying spaces to always be finite. + +The Gromov-Wasserstein distance $d_{\mathrm{GW}}$ was proposed as a measure of dissimilarity between two metric measure spaces; see Section 2.2 for its definition and also (Mémoli, 2011) for its more general version involving a parameter $p \in [1,\infty]$ . Note that one can define a variant of the standard GW distance by considering two coupling measures $\gamma, \gamma'$ independently, and use $\gamma \otimes \gamma'$ instead of $\gamma \otimes \gamma$ in Equation (1). This version of the GW distance was implicit in the optimization procedure followed in (Mémoli, 2011) and has been explicitly considered in (Séjourné et al., 2021; Titouan et al., 2020), and this is closely connected to our GW distance between MCMSs (see Definition 8) as shown in Example 3. + +Here we give the definition of this "decoupled" variant of the GW distance. + +Definition 12 (Decoupled Gromov-Wasserstein distance). Suppose two metric measure spaces $\mathbf{X} = (X, d_X, \mu_X)$ , $\mathbf{Y} = (Y, d_Y, \mu_Y)$ are given. We define the decoupled Gromov-Wasserstein distance $d_{\mathrm{GW}}^{\mathrm{bi}}(\mathbf{X}, \mathbf{Y})$ in the following way: + +$$ +d_{\mathrm{GW}}^{\mathrm{bi}}(\mathbf{X},\mathbf{Y}):= \inf_{\gamma ,\gamma^{\prime}\in \mathcal{C}(\mu_{X},\mu_{Y})}\int \limits_{X\times Y}\int \limits_{X\times Y}|d_{X}(x,x^{\prime}) - d_{Y}(y,y^{\prime})|\gamma^{\prime}(dx^{\prime}\times dy^{\prime})\gamma (dx\times dy). +$$ + +Obviously, $d_{\mathrm{GW}}^{\mathrm{bi}}(\mathbf{X}, \mathbf{Y}) \leq d_{\mathrm{GW}}(\mathbf{X}, \mathbf{Y})$ in general. Furthermore, this inequality is actually tight as one can see in the following remark. + +Remark A.11. We let $\Gamma_{X,Y}(x,y,x',y') \coloneqq |d_X(x,x') - d_Y(y,y')|$ for any $x, x' \in X$ and $y, y' \in Y$ . If the kernel $\Gamma_{X,Y}: X \times Y \times X \times Y \to \mathbb{R}$ is negative semi-definite, then one can show that $d_{\mathrm{GW}}^{\mathrm{bi}}(\mathbf{X}, \mathbf{Y}) = d_{\mathrm{GW}}(\mathbf{X}, \mathbf{Y})$ by invoking Sèjourné et al. (2021, Theorem 4). More precisely, if $\gamma, \gamma'$ are the optimal coupling measures achieving the infimum in the definition of $d_{\mathrm{GW}}^{\mathrm{bi}}(\mathbf{X}, \mathbf{Y})$ , then both $\gamma$ and $\gamma'$ are optimal for $d_{\mathrm{GW}}$ , i.e., + +$$ +d _ {\mathrm {G W}} ^ {\mathrm {b i}} (\mathbf {X}, \mathbf {Y}) = \| \Gamma_ {X, Y} \| _ {L ^ {1} (\gamma \otimes \gamma^ {\prime})} = \| \Gamma_ {X, Y} \| _ {L ^ {1} (\gamma \otimes \gamma)} = \| \Gamma_ {X, Y} \| _ {L ^ {1} (\gamma^ {\prime} \otimes \gamma^ {\prime})} = d _ {\mathrm {G W}} (\mathbf {X}, \mathbf {Y}). +$$ + +Just like the original version, $d_{\mathrm{GW}}^{\mathrm{bi}}$ also becomes a legitimate metric on the collection of metric measure spaces. This is another contribution of our work. + +Proposition A.12. The decoupled Gromov Wasserstein distance $d_{\mathrm{GW}}^{\mathrm{bi}}$ is a legitimate metric on $\mathcal{M}^{\mathrm{MS}}$ . + +Proof. Symmetry is obvious. We need to prove the triangle inequality plus the fact that $d_{\mathrm{GW}}^{\mathrm{bi}}(\mathbf{X}, \mathbf{Y}) = 0$ happens if and only if $\mathbf{X}$ and $\mathbf{Y}$ are isomorphic. The "if" part is trivial. For the other direction we proceed as follows. Suppose that $d_{\mathrm{GW}}^{\mathrm{bi}}(\mathbf{X}, \mathbf{Y}) = 0$ . By Lemma B.11 and the compactness of $\mathcal{C}(\mu_X, \mu_Y)$ for the weak topology (see Villani (2003, p.49)), there must be optimal couplings $\gamma, \gamma' \in \mathcal{C}(\mu_X, \mu_Y)$ such that + +$$ +\sum_ {(x, y) \in X \times Y} \sum_ {\left(x ^ {\prime}, y ^ {\prime}\right) \in X \times Y} \left| d _ {X} \left(x, x ^ {\prime}\right) - d _ {Y} \left(y, y ^ {\prime}\right) \right| \gamma^ {\prime} \left(x ^ {\prime}, y ^ {\prime}\right) \gamma (x, y) = 0. \tag {10} +$$ + +Claim 1. There exists an isometry $\phi : X \to Y$ such that + +$$ +\{(x, \phi (x)): x \in X \} = \operatorname {s u p p} (\gamma) = \operatorname {s u p p} \left(\gamma^ {\prime}\right). +$$ + +Proof of Claim 1. By Equation (10), we have that + +$$ +d _ {X} \left(x, x ^ {\prime}\right) = d _ {Y} \left(y, y ^ {\prime}\right) \tag {11} +$$ + +for any $(x,y)\in \operatorname {supp}(\gamma)$ and $(x^{\prime},y^{\prime})\in \operatorname {supp}(\gamma^{\prime})$ + +Fix an arbitrary $x \in X$ . Then, since both $\mu_{X}$ and $\mu_{Y}$ are fully supported and $X, Y$ are finite, there must exist $y, y' \in Y$ such that $(x, y) \in \operatorname{supp}(\gamma)$ and $(x, y') \in \operatorname{supp}(\gamma')$ . Then, $y = y'$ by Equation (11). Now, if there exists $y'' \in Y$ such that $(x, y'') \in \operatorname{supp}(\gamma)$ , then similarly, we have that $y'' = y'$ and thus $y'' = y$ . In other words, for each $x \in X$ , there exists a unique $y \in Y$ such that $(x, y) \in \operatorname{supp}(\gamma)$ . Similarly, this same $y \in Y$ is unique such that $(x, y) \in \operatorname{supp}(\gamma')$ . Hence, we define $\phi: X \to Y$ by letting $\phi(x)$ be the unique $y \in Y$ such that $(x, \phi(x)) \in \operatorname{supp}(\gamma)$ . It is obvious that $\phi$ is bijective and satisfies that $\{(x, \phi(x)): x \in X\} = \operatorname{supp}(\gamma) = \operatorname{supp}(\gamma')$ . By Equation (11), we conclude that $\phi$ is an isometry. + +Based on the claim above, consider an arbitrary Borel subset $A \subseteq X$ . Then, + +$$ +\mu_ {X} (A) = \gamma (A \times Y) = \gamma (A \times Y \cap A \times \phi (A)) = \gamma (A \times \phi (A)) = \mu_ {Y} (\phi (A)). +$$ + +Hence, $\phi$ is a isomorphism between $\mathbf{X}$ and $\mathbf{Y}$ . + +Finally, for the triangle inequality, fix finite metric measure space $\mathbf{X},\mathbf{Y}$ , and $\mathbf{Z}$ . Notice first that for all $x,x^{\prime}\in X,y,y^{\prime}\in Y$ and $z,z^{\prime}\in Z$ , + +$$ +\Gamma_ {X, Y} (x, y, x ^ {\prime}, y ^ {\prime}) \leq \Gamma_ {X, Z} (z, x, z ^ {\prime}, x ^ {\prime}) + \Gamma_ {Z, Y} (y, z, y ^ {\prime}, z ^ {\prime}). +$$ + +Next, fix arbitrary coupling measures $\gamma_1,\gamma_1'\in \mathcal{C}(\mu_X,\mu_Z)$ and $\gamma_{2},\gamma_{2}^{\prime}\in \mathcal{C}(\mu_{Z},\mu_{Y})$ . By the Gluing Lemma (see Villani (2003, Lemma 7.6)), there exist probability measures $\pi ,\pi^{\prime}\in \mathcal{P}(X\times Y\times Z)$ with marginals $\gamma_1,\gamma_1'$ on $X\times Z$ and $\gamma_{2},\gamma_{2}^{\prime}$ on $Z\times Y$ . Let $\gamma_{3},\gamma_{3}^{\prime}$ be the marginal of $\pi ,\pi^{\prime}$ on $X\times Y$ . Then, by the triangle inequality of $L^1$ norm, + +$$ +\begin{array}{l} d _ {\mathrm {G W}} ^ {\mathrm {b i}} (\mathbf {X}, \mathbf {Y}) \leq \| \Gamma_ {X, Y} \| _ {L ^ {1} \left(\gamma_ {3} \otimes \gamma_ {3} ^ {\prime}\right)} \\ = \| \Gamma_ {X, Y} \| _ {L ^ {1} \left(\pi \otimes \pi^ {\prime}\right)} \\ \leq \left\| \Gamma_ {X, Z} \right\| _ {L ^ {1} \left(\pi \otimes \pi^ {\prime}\right)} + \left\| \Gamma_ {Z, Y} \right\| _ {L ^ {1} \left(\pi \otimes \pi^ {\prime}\right)} \\ = \| \Gamma_ {X, Z} \| _ {L ^ {1} \left(\gamma_ {1} \otimes \gamma_ {1} ^ {\prime}\right)} + \| \Gamma_ {Z, Y} \| _ {L ^ {1} \left(\gamma_ {2} \otimes \gamma_ {2} ^ {\prime}\right)}. \\ \end{array} +$$ + +Since the choice of $\gamma_1, \gamma_1', \gamma_2, \gamma_2'$ are arbitrary, by taking the infimum one can conclude + +$$ +d _ {\mathrm {G W}} ^ {\mathrm {b i}} (\mathbf {X}, \mathbf {Y}) \leq d _ {\mathrm {G W}} ^ {\mathrm {b i}} (\mathbf {X}, \mathbf {Z}) + d _ {\mathrm {G W}} ^ {\mathrm {b i}} (\mathbf {Z}, \mathbf {Y}). +$$ + +# A.5. Examples When $d_{\mathrm{WL}}$ Fails to Separate Graphs + +Example 6 (Constant labels). Let $G_{1}$ be a claw and $G_{2}$ be a path with four nodes; see Figure 3. Let the label functions $\ell_{G_i}$ for $i = 1, 2$ be constant and equal to 1 for both graphs. + +In the first step of the WL test, we find + +$$ +L _ {1} \left(\left(G _ {1}, \ell_ {G _ {1}}\right)\right) = \{\{(1, \{\{1, 1, 1 \} \}), (1, \{\{1 \} \}), (1, \{\{1 \} \}), (1, \{\{1 \} \}) \} \} +$$ + +and + +$$ +L _ {1} \left(\left(G _ {2}, \ell_ {G _ {2}}\right)\right) = \{\{\left(1, \{\{1 \}\}\right), \left(1, \{\{1 \}\}\right), \left(1, \{\{1, 1 \}\}\right), \left(1, \{\{1, 1 \}\}\right) \} \}. +$$ + +Since $L_{1}((G_{1},\ell_{G_{1}})) \neq L_{1}((G_{2},\ell_{G_{2}}))$ , $(G_{1},\ell_{G_{1}})$ and $(G_{2},\ell_{G_{2}})$ are recognized as non-isomorphic by the WL test. Notice that within the first step, the WL test collects degree information and comparing $L_{1}((G_{1},\ell_{G_{1}}))$ and $L_{1}((G_{2},\ell_{G_{2}}))$ is equivalent to comparing the multiset of degrees w.r.t. $G_{1}$ and $G_{2}$ . However, for $d_{\mathrm{WL}}((\mathcal{X}(G_1),\ell_{G_1}),(\mathcal{X}(G_2),\ell_{G_2}))$ (abbreviated to $d_{\mathrm{WL}}(\mathcal{X}(G_1),\mathcal{X}(G_2))$ in Figure 3), because of the normalization inherent to the Markov chains $m_{\bullet}^{G_1}$ and $m_{\bullet}^{G_2}$ , each step inside the hierarchy pertaining to the WL distance cannot collect degree information when the labels are constant. + +![](images/dc9b98ee4d0722bb3ccfadb5c6e22b649ecbb7c7385399edc4225cf6deabd585.jpg) +Figure 3. Illustration of Example 6. Notice that if we start from constant labels, one step of the WL hierarchy will collect degree information for the vertices. In contrast, because of the normalization of the Markov kernel, a single step of the WL measure hierarchy with constant labels will not be able to accumulate the same information. + +Example 7 (Degree label). Let $G_{1}$ be a two-point graph consisting of a single edge with the vertex set $\{v_{1}, v_{2}\}$ . Let $G_{2}$ be a four-point graph consisting of two disjoint edges denoted by $\{u_{1}, u_{2}\}$ and $\{u_{3}, u_{4}\}$ ; see Figure 4. For each $i = 1, 2$ , let $\ell_{G_{i}}$ be the degree label function for both graphs. + +In the first step of the WL test, + +$$ +L _ {1} \left(\left(G _ {1}, \ell_ {G _ {1}}\right)\right) = \{\{\left(1, \{\{1 \} \}\right), \left(1, \{\{1 \} \}\right) \} \} +$$ + +and + +$$ +L _ {1} \left(\left(G _ {2}, \ell_ {G _ {2}}\right)\right) = \{\{\left(1, \{\{1 \} \}\right), (1, \{\{1 \} \}), (1, \{\{1 \} \}), (1, \{\{1 \} \}) \}. +$$ + +Then in the first step of the WL test, the two labeled graphs are already distinguished as non-isomorphic. + +In the case of $d_{\mathrm{WL}}((\mathcal{X}(G_1),\ell_{G_1}),(\mathcal{X}(G_2),\ell_{G_2}))$ notice that $(\ell_{G_1})_{\#}m_x^{G_1}(z) = 1$ if $z = 1$ and 0 otherwise for both $x = v_{1}$ and $x = v_{2}$ . Hence, $\mathfrak{l}_{(\mathcal{X}(G_1),\ell_{G_1})}^{(1)}(v_1) = \mathfrak{l}_{(\mathcal{X}(G_1),\ell_{G_1})}^{(1)}(v_2)$ . Similarly, for $G_{2}$ + +$$ +\mathfrak {l} _ {(\mathcal {X} (G _ {2}), \ell_ {G _ {2}})} ^ {(1)} \big (u _ {1} \big) = \dots = \mathfrak {l} _ {(\mathcal {X} (G _ {2}), \ell_ {G _ {2}})} ^ {(1)} \big (u _ {4} \big) = \mathfrak {l} _ {(\mathcal {X} (G _ {1}), \ell_ {G _ {1}})} ^ {(1)} \big (v _ {1} \big). +$$ + +It is not hard to show inductively that for each $k\in \mathbb{N}$ + +$$ +\mathfrak {l} _ {(\mathcal {X} (G _ {1}), \ell_ {G _ {1}})} ^ {(k)} (v _ {1}) = \mathfrak {l} _ {(\mathcal {X} (G _ {1}), \ell_ {G _ {1}})} ^ {(k)} (v _ {2}) = \mathfrak {l} _ {(\mathcal {X} (G _ {2}), \ell_ {G _ {2}})} ^ {(k)} (u _ {1}) = \dots = \mathfrak {l} _ {(\mathcal {X} (G _ {2}), \ell_ {G _ {2}})} ^ {(k)} (u _ {4}). +$$ + +Then, for each $k\in \mathbb{N}$ + +$$ +\mathfrak {L} _ {1} ((\mathcal {X} (G _ {1}), \ell_ {G _ {1}})) = \left(\mathfrak {l} _ {(\mathcal {X} (G _ {1}), \ell_ {G _ {1}})} ^ {(k)}\right) _ {\#} \mu_ {G _ {1}} = \left(\mathfrak {l} _ {(\mathcal {X} (G _ {2}), \ell_ {G _ {2}})} ^ {(k)}\right) _ {\#} \mu_ {G _ {2}} = \mathfrak {L} _ {1} ((\mathcal {X} (G _ {2}), \ell_ {G _ {2}})) +$$ + +and thus $d_{\mathrm{WL}}^{(k)}((\mathcal{X}(G_1),\ell_{G_1}),(\mathcal{X}(G_2),\ell_{G_2})) = 0$ which implies that $d_{\mathrm{WL}}((\mathcal{X}(G_1),\ell_{G_1}),(\mathcal{X}(G_2),\ell_{G_2})) = 0.$ + +Notice that the standard WL test with degree labels is able to capture (and therefore compare) information about the number of nodes in the graph. On the other hand, $(\mathcal{X}(G_1),\ell_{G_1})$ and $(\mathcal{X}(G_2),\ell_{G_2})$ cannot be distinguished by the WL distance because of the normalization of the reference measures, $\mu_{G_1}$ and $\mu_{G_2}$ . + +![](images/529b8cd4779b09fdfa6363104f0dc0d08c2e91130367da6fb10bd8dc4e70d546.jpg) +Figure 4. Illustration of Example 7. One step of the WL hierarchy with degree labels can distinguish graphs of different sizes whereas the normalization of $\mu_{G_1}$ and $\mu_{G_2}$ does not allow graph size to be distinguished when the label function is degree. + +# A.6. A Basic Lower Bound for $d_{\mathrm{GW}}^{\mathrm{MCMS}}$ + +One can produce some basic lower bounds for $d_{\mathrm{GW}}^{\mathrm{MCMS}}$ by invoking the notion of diameter for MCMSs which we define below. We first introduce the one point MCMS. + +Example 8. The one point MCMS is the tuple $* := (\{*, (0), \delta_*, \delta_* \})$ . + +Definition 13 (MCMS diameter). For each $k \geq 1$ and a MCMS $(\mathcal{X}, d_X)$ , we define + +$$ +\operatorname {diam} _ {\operatorname {M C M S}} ^ {(k)} ((\mathcal {X}, d _ {X})) := d _ {\operatorname {G W}} ^ {(k)} ((\mathcal {X}, \ell_ {X}), *), +$$ + +and + +$$ +\operatorname {d i a m} _ {\operatorname {M C M S}} ((\mathcal {X}, d _ {X})) := d _ {\operatorname {G W}} ^ {\operatorname {M C M S}} ((\mathcal {X}, d _ {X}), \ast). +$$ + +Notice that $\mathcal{C}(\mu_X, \mu_*) = \{\mu_X \otimes \delta_*\}$ and $\mathcal{C}^{(k)}(m_{\bullet}^X, \delta_*) = \left\{m_{\bullet}^{X, \otimes k} \otimes \delta_*\right\}$ . Then, it turns out that the diameter of $\mathcal{X}$ is independent of $k$ : + +$$ +\begin{array}{l} \mathrm {d i a m} _ {\mathrm {M C M S}} ^ {(k)} ((\mathcal {X}, d _ {X})) = d _ {\mathrm {G W}} ^ {(k)} ((\mathcal {X}, d _ {X}), *) = \int_ {X} \int_ {X} \int_ {X} d _ {X} (x, x ^ {\prime}) m _ {x ^ {\prime \prime}} ^ {X, \otimes k} (d x ^ {\prime}) \mu_ {X} (d x ^ {\prime \prime}) \mu_ {X} (d x) \\ = \int_ {X} \int_ {X} d _ {X} (x, x ^ {\prime}) \mu_ {X} (d x ^ {\prime}) \mu_ {X} (d x) \\ \end{array} +$$ + +By the triangle inequality, one can prove the following result. + +Proposition A.13. For all two MCMSs $(\mathcal{X},d_X),(\mathcal{Y},d_Y)$ and $k\geq 1$ , we have + +$$ +\left| \int_ {X} \int_ {X} d _ {X} (x, x ^ {\prime}) \mu_ {X} (d x ^ {\prime}) \mu_ {X} (d x) - \int_ {Y} \int_ {Y} d _ {Y} (y, y ^ {\prime}) \mu_ {Y} (d y ^ {\prime}) \mu_ {Y} (d y) \right| \leq d _ {\mathrm {G W}} ^ {(k)} ((\mathcal {X}, d _ {X}), (\mathcal {Y}, d _ {Y})), +$$ + +and + +$$ +\left| \int_ {X} \int_ {X} d _ {X} (x, x ^ {\prime}) \mu_ {X} (d x ^ {\prime}) \mu_ {X} (d x) - \int_ {Y} \int_ {Y} d _ {Y} (y, y ^ {\prime}) \mu_ {Y} (d y ^ {\prime}) \mu_ {Y} (d y) \right| \leq d _ {\mathrm {G W}} ^ {\mathrm {M C M S}} ((\mathcal {X}, d _ {X}), (\mathcal {Y}, d _ {Y})). +$$ + +# A.7. More Details on the Complexity of Computing the WL Distance + +In the following subsections, we provide an algorithm for computing the WL distance and complexity analysis for both computing the WL distance and its lower bound defined in Section 3.2. + +# A.7.1. COMPUTATION OF THE WL DISTANCE + +In this section, we devise an algorithm (with pseudocode in Algorithm 1) for computing $d_{\mathrm{WL}}^{(k)}$ and establish the following complexity analysis. + +Proposition A.14. For any fixed $k \in \mathbb{N}$ , computing $d_{\mathrm{WL}}^{(k)}$ between any LMMCs $(\mathcal{X}, \ell_X)$ and $(\mathcal{Y}, \ell_Y)$ can be achieved in time at most $O(k n^5 \log(n))$ where $n = \max(|X|, |Y|)$ . + +Recall from Equation (2) that the WL distance of depth $k$ is defined as + +$$ +d_{\mathrm{WL}}^{(k)}((\mathcal{X},\ell_{X}),( \mathcal{Y},\ell_{Y})):= d_{\mathrm{W}}\Bigg(\left(\mathfrak{l}_{(\mathcal{X},\ell_{X})}^{(k)}\right)_{\#}\mu_{X},\left(\mathfrak{l}_{(\mathcal{Y},\ell_{Y})}^{(k)}\right)_{\#}\mu_{Y}\Bigg) = \inf_{\gamma \in \mathcal{C}(\mu_{X},\mu_{Y})}\int \limits_{X\times Y}d_{\mathrm{W}}\Big(\mathfrak{l}_{(\mathcal{X},\ell_{X})}^{(k)}(x),\mathfrak{l}_{(\mathcal{Y},\ell_{Y})}^{(k)}(y)\Big)\gamma (dx\times dy). +$$ + +In order to compute $d_{\mathrm{WL}}^{(k)}((\mathcal{X},\ell_X),(\mathcal{Y},\ell_Y))$ , we must first compute $d_{\mathrm{W}}(\mathfrak{l}_{(\mathcal{X},\ell_X)}^{(k)}(x),\mathfrak{l}_{(\mathcal{Y},\ell_Y)}^{(k)}(y))$ for each $x\in X$ and $y\in Y$ To do this, we introduce some notation. For each $i = 1,\ldots ,k$ , we let $C_i$ denote the $|X|\times |Y|$ matrix such that for each $x\in X$ and $y\in Y$ + +$$ +C _ {i} (x, y) := d _ {\mathrm {W}} \Big (\mathfrak {l} _ {(\mathcal {X}, \ell_ {X})} ^ {(i)} (x), \mathfrak {l} _ {(\mathcal {Y}, \ell_ {Y})} ^ {(i)} (y) \Big). +$$ + +We also let $C_0$ denote the matrix such that $C_0(x,y) \coloneqq \|\ell_X(x) - \ell_Y(y)\|$ for each $x \in X$ and $y \in Y$ . Then, our task is to compute the matrix $C_k$ . For this purpose, we consecutively compute the matrix $C_i$ for $i = 1, \ldots, k$ : Given matrix $C_{i-1}$ , since $\mathfrak{l}_{(\mathcal{X},\ell_X)}^{(i)}(x) = \left(\mathfrak{l}_{(\mathcal{X},\ell_X)}^{(i-1)}\right)_\# m_x^X$ and $\mathfrak{l}_{(\mathcal{Y},\ell_Y)}^{(i)}(y) = \left(\mathfrak{l}_{(\mathcal{Y},\ell_Y)}^{(i-1)}\right)_\#$ $m_y^Y$ , computing + +$$ +d_{\mathrm{W}}\Bigl(\mathfrak{l}^{(i)}_{(\mathcal{X},\ell_{X})}(x),\mathfrak{l}^{(i)}_{(\mathcal{Y},\ell_{Y})}(y)\Bigr) = \inf_{\gamma \in \mathcal{C}(m^{X}_{x},m^{Y}_{y})}\int \limits_{X\times Y}d_{\mathrm{W}}\Bigl(\mathfrak{l}^{(i - 1)}_{(\mathcal{X},\ell_{X})}(x),\mathfrak{l}^{(i - 1)}_{(\mathcal{Y},\ell_{Y})}(y)\Bigr)\gamma (dx\times dy). +$$ + +is reduced to solving the optimal transport problem with $C_{i-1}$ as the cost matrix and $m_x^X$ and $m_y^Y$ as the source and target distributions, which can be done in $O(n^3 \log(n))$ time (Pele & Werman, 2009). Thus, for each $i$ , computing $C_i$ given that we know $C_{i-1}$ , requires $O(n^2 \cdot n^3 \log(n))$ . Finally, we need $O(n^3 \log(n))$ time to compute $d_{\mathrm{WL}}^{(k)}((\mathcal{X}, \ell_X), (\mathcal{Y}, \ell_Y))$ based on solving an optimal transport problem with cost matrix $C_k$ and with $\mu_X$ and $\mu_Y$ being the source and target distributions, respectively. + +Therefore, the total time needed to compute $d_{\mathrm{WL}}^{(k)}((\mathcal{X},\ell_X),(\mathcal{Y},\ell_Y))$ is + +$$ +k \cdot O \left(n ^ {5} \log (n)\right) + O \left(n ^ {3} \log (n)\right) = O \left(k n ^ {5} \log (n)\right). +$$ + +For any $n \in \mathbb{N}$ , $d_{\mathrm{WL}}^{(2n)}$ generates a distance between graph induced LMMCs with size bounded by $n$ . By Corollary 3.5, $d_{\mathrm{WL}}^{(2n)}$ has the same discriminating power as the WL test in separating graphs with size bounded by $n$ . Now, given labeled graphs $(G_1, \ell_{G_1})$ and $(G_2, \ell_{G_2})$ so that $\max(|V_{G_1}|, |V_{G_2}|) \leq n$ , computing $d_{\mathrm{WL}}^{(2n)}((\mathcal{X}_q(G_1), \ell_{G_1}), (\mathcal{X}_q(G_2), \ell_{G_2}))$ takes time at most $O(n^6 \log(n))$ . + +# A.7.2. COMPUTATION OF THE LOWER BOUND DISTANCE + +Recall from Section 3.2 that the WL lower bound distance was defined as + +$$ +d_{\mathrm{WLLB}}^{(k)}((\mathcal{X},\ell_{X}),(\mathcal{Y},\ell_{Y})):= \inf_{\substack{\gamma \in \mathcal{C}(\mu_{X},\mu_{Y})\\ X\times Y}}\int d_{\mathrm{W}}\bigl((\ell_{X})_{\#}m_{x}^{X,\otimes k},(\ell_{Y})_{\#}m_{y}^{Y,\otimes k}\bigr)\gamma (dx\times dy). +$$ + +Given two finite LMMCs, + +$$ +\left(\mathcal {X}, \ell_ {X}: X \rightarrow \mathbb {R}\right) \text {w h e r e} \mathcal {X} = \left(X = \left\{x _ {1}, x _ {2}, \dots , x _ {n} \right\}, m _ {\bullet} ^ {X}, \mu_ {X}\right) +$$ + +and + +$$ +\left(\mathcal {Y}, \ell_ {Y}: Y \rightarrow \mathbb {R}\right) \text {w h e r e} \mathcal {Y} = \left(Y = \left\{y _ {1}, y _ {2}, \dots , y _ {m} \right\}, m _ {\bullet} ^ {Y}, \mu_ {Y}\right) +$$ + +we represent their Markov kernels as two transition matrices, $M_{\mathcal{X}}$ and $M_{\mathcal{Y}}$ , respectively. Then, $k$ -Markov kernels $m_{\bullet}^{X,\otimes k}$ and $m_{\bullet}^{Y,\otimes k}$ are expressed as matrices $M_{\mathcal{X}}^k$ and $M_{\mathcal{Y}}^k$ , respectively. Assume that $n \geq m$ . Then computing the $k$ -Markov + +Algorithm 1 $d_{\mathrm{WL}}^{(k)}$ computation +1: Input: The depth $k\in \mathbb{N}$ , and two finite LMMCs $(X = \{x_{1},x_{2},\dots,x_{n}\} ,m_{\bullet}^{X},\mu_{X},\ell_{X}:X\to \mathbb{R})$ and $(Y = \{y_{1},\ldots ,y_{m}\} ,m_{\bullet}^{Y},\mu_{Y},\ell_{Y}:Y\to \mathbb{R})$ +2: Initialization: $P = C =$ zeros(n,m) +3: for $i\in [n],j\in [m]$ do +4: $P(i,j) = |\ell_X(x_i) - \ell_Y(y_j)|$ +5: end for +6: for $l\in [k]$ do +7: for $i\in [n],j\in [m]$ do +8: $C(i,j) = \inf_{\gamma \in \mathcal{C}(m_{x_i}^X,m_{y_j}^Y)}\sum_{a\in [n],b\in [m]}P(a,b)\gamma (a,b)$ +9: end for +10: $P = C$ +11: end for + $D = \inf_{\gamma \in \mathcal{C}(\mu_X,\mu_Y)}\sum_{i\in [n],j\in [m]}C(i,j)\gamma (i,j)$ +12: Output: $D$ + +kernels of $\mathcal{X}$ and $\mathcal{Y}$ will require $O(n^{3}\log (k))$ time where $O(n^{3})$ is time needed for matrix multiplication. Then since $(\ell_X)_{\#}m_x^{X,\otimes k}$ and $(\ell_Y)_{\#}m_y^{Y,\otimes k}$ are both distributions in $\mathbb{R}$ , by (Vallender, 1974), $d_{\mathrm{W}}\big((\ell_X)_{\#}m_x^{X,\otimes k},(\ell_Y)_{\#}m_y^{Y,\otimes k}\big)$ can be computed in $O(n)$ time for each $x\in X$ and $y\in Y$ . Finally, computing $d_{\mathrm{WLLB}}^{(k)}$ can be formulated as finding the optimal transport cost where each entry of the cost matrix is defined as $d_{\mathrm{W}}\big((\ell_X)_{\#}m_x^{X,\otimes k},(\ell_Y)_{\#}m_y^{Y,\otimes k}\big)$ and the source and target distributions are $\mu_X,\mu_Y$ respectively. Recall from the previous section that $\mu_X$ and $\mu_Y$ are normalized degree distributions for $\mathcal{X}$ and $\mathcal{Y}$ . Therefore, the overall time complexity is + +$$ +O (n ^ {3} \log (k)) + O (n ^ {3} \log (n)) = O (n ^ {3} \log (k n)). +$$ + +# A.8. Experiments + +# A.8.1. EXPERIMENTAL SETUP + +We use several publicly available graph benchmark datasets from TUDatasets (Morris et al., 2020) and evaluate the performance of our WL distance $d_{\mathrm{WL}}^{(k)}$ distance as well as $d_{\mathrm{WLLB}}^{(k)}$ (lower bound of our $d_{\mathrm{WL}}$ which is more efficient to compute) through two types of graph classification experiments compared with several representative methods. Note that for all of our experiments, we use $q = 0.6$ to transform every graph $G$ into the Markov chain $\mathcal{X}_q(G)$ . + +We use 1-Nearest Neighbors classifier in the first graph classification experiment and for the second experiment, we use support vector machines (SVM). For the first experiment, we compare classification accuracies with the WWL distance (Togninalli et al., 2019) (see Equation (8)). For the second graph classification task, we run an SVM using the indefinite kernel matrices $\exp\left(-\gamma d_{\mathrm{WLLB}}^{(k)}\right)$ and $\exp\left(-\gamma d_{\mathrm{WL}}^{(k)}\right)$ , which are seen as noisy observations of the true positive semi-definite kernels (Luss & d'Aspremont, 2009). We also evaluate the classification accuracies of $d_{\mathrm{WLLB}}$ and $d_{\mathrm{WL}}^{(k)}$ using KSVM (Loosli et al., 2015) for their indefinite kernel matrices. Additionally, for the SVM method, we cross validate the parameter $C \in \{10^{-3}, \dots, 10^{3}\}$ and the parameter $\gamma \in \{10^{-3}, \dots, 10^{3}\}$ . We compare classification accuracies with the WWL kernel (Togninalli et al., 2019), the WL kernel (Shervashidze et al., 2011), and the Weisfeiler-Lehman optimal assignment kernel (WL-OA) (Kriege et al., 2016). Note that we only use WWL distance in the 1-NN graph classification experiment since the WL-OA and WL kernels are not defined in terms of a distance unlike the WWL kernel. + +In addition to the full accuracies for $k \in \{1,2,3,4\}$ for $d_{\mathrm{WL}}^{(k)}$ and $d_{\mathrm{WLLB}}^{(k)}$ with the degree label, call this $f_1$ , we also evaluate $d_{\mathrm{WL}}^{(k)}$ and $d_{\mathrm{WLLB}}^{(k)}$ with the label function $f_2(G,v) = \frac{1}{|V_G|} + \deg_G(v)$ for any graph $G$ and vertex $v \in V_G$ . Note that $f_2$ is a relabeling of any constant label function, which assigns a constant $c$ to each vertex, via the injective map $g: \{c\} \times \mathbb{N} \times \mathbb{N} \to \mathbb{R}$ sending $(c,n_1,n_2)$ to $n_1 + \frac{1}{n_2}$ as described in Section 3.1. So under $f_2$ , $d_{\mathrm{WL}}^{(k)}$ is as discriminative as the $k$ -step WL test. Thus, we also evaluate the performance of the WWL distance/kernel, WL, and WL-OA kernels using only degree label. Additionally, we report the best accuracies for WWL, WL, and WL-OA for iterations 1, ..., 4. + +Table 3. 1-Nearest Neighbor classification accuracy. Let $f_{1}(G,v) = \deg_{G}(v)$ , $f_{2}(G,v) = \frac{1}{|V_{G}|} + \deg_{G}(v)$ + +
METHODMUTAGPROTEINSPTC-FMPTC-MRIMDB-BIMDB-MCOX2
d(1)WL, f190.5 ± 6.561.8 ± 4.360.0 ± 8.553.9 ± 7.170.1 ± 4.741.1 ± 3.973.8 ± 3.6
d(2)WL, f192.1 ± 6.360.8 ± 4.462.2 ± 7.456.2 ± 6.369.9 ± 4.241.1 ± 4.774.2 ± 4.5
d(3)WL, f191.1 ± 4.360.8 ± 3.559.4 ± 8.254.0 ± 7.769.4 ± 3.941.0 ± 4.874.2 ± 3.9
d(4)WL, f190.1 ± 4.863.0 ± 3.859.1 ± 8.354.2 ± 6.870.2 ± 4.341.3 ± 4.876.1 ± 5.5
d(1)WL, f291.6 ± 7.163.3 ± 4.457.5 ± 6.051.9 ± 9.371.4 ± 4.540.6 ± 5.372.5 ± 4.5
d(2)WL, f291.1 ± 5.862.4 ± 3.458.2 ± 8.256.2 ± 7.670.4 ± 4.541.6 ± 4.374.0 ± 4.7
d(3)WL, f291.5 ± 5.863.4 ± 3.958.5 ± 7.953.4 ± 8.471.4 ± 5.940.6 ± 4.374.6 ± 4.4
d(4)WL, f292.6 ± 4.863.3 ± 4.958.5 ± 8.054.8 ± 7.971.2 ± 5.140.7 ± 4.875.9 ± 4.9
d(1)WLLB, f187.3 ± 1.964.0 ± 2.362.5 ± 8.557.4 ± 6.869.0 ± 3.940.6 ± 3.875.1 ± 3.8
d(2)WLLB, f186.8 ± 3.766.2 ± 2.260.0 ± 8.153.4 ± 6.469.4 ± 3.240.1 ± 3.675.1 ± 3.8
d(3)WLLB, f185.2 ± 3.564.6 ± 2.258.0 ± 1.154.5 ± 9.169.8 ± 3.340.1 ± 3.981.2 ± 5.3
d(4)WLLB, f184.7 ± 3.165.4 ± 2.358.0 ± 1.152.0 ± 9.169.9 ± 2.540.1 ± 3.680.4 ± 2.3
d(1)WLLB, f287.3 ± 2.564.7 ± 1.462.5 ± 7.457.8 ± 6.869.0 ± 3.940.4 ± 3.675.5 ± 3.7
d(2)WLLB, f286.3 ± 3.665.6 ± 2.260.0 ± 8.153.4 ± 6.469.2 ± 3.240.2 ± 3.677.0 ± 4.9
d(3)WLLB, f285.3 ± 3.664.3 ± 1.158.0 ± 10.854.7 ± 9.169.7 ± 3.140.1 ± 3.980.4 ± 4.4
d(4)WLLB, f284.7 ± 3.064.8 ± 1.858.0 ± 10.952.0 ± 9.269.4 ± 2.540.2 ± 3.880.4 ± 4.4
WWL85.1 ± 6.564.7 ± 2.858.2 ± 8.554.3 ± 7.965.0 ± 3.340.0 ± 3.376.1 ± 5.6
+ +# A.8.2. EXTRA EXPERIMENTAL RESULTS + +In Table 3 and Table 4, we have included the 1-NN and SVM classification accuracies for $k \in \{1,2,3,4\}$ , respectively. In general, using a KSVM with kernels $\exp \left(-\gamma d_{\mathrm{WLLB}}^{(k)}\right)$ and $\exp \left(-\gamma d_{\mathrm{WL}}^{(k)}\right)$ yields classification accuracies which are similar to the classification accuracy of a standard SVM with the indefinite kernels. However, note that for the kernel $\exp \left(-\gamma d_{\mathrm{WL}}^{(k)}\right)$ , KSVM has a slightly higher classification accuracy on both PTC-FM and IMDB-B than standard SVM. For the kernel $\exp \left(-\gamma d_{\mathrm{WLLB}}^{(k)}\right)$ with the labels generated by $f_2$ , KSVM has a much lower classification accuracy on both PROTEINS and IMDB-B than standard SVM. + +# A.8.3. TIME COMPARISON + +We compare the runtimes of $d_{\mathrm{WL}}^{(k)}$ and $d_{\mathrm{WLLB}}^{(k)}$ for $k = 1,2$ . For our runtime comparisons, we use LMMCs induced by Erdős-Renyi graphs of sizes varying from 5 nodes to 100 nodes (with the degree label function and $q = 0.6$ ). Note that while the runtime for $d_{\mathrm{WLLB}}^{(k)}$ does not change much between $k = 1$ and $k = 2$ , the $d_{\mathrm{WL}}^{(k)}$ distance shows a significant increase in the time needed to compute distance between two graphs from $k = 1$ to $k = 2$ . + +# B. Proofs + +# B.1. Proofs from Section 2 + +# B.1.1. PROOF OF PROPOSITION 2.1 + +The "only if" part is obvious. To prove the "if" part, we assume $(\mathcal{X}_q(G_1),\ell_{G_1})$ is isomorphic to $(\mathcal{X}_q(G_2),\ell_{G_2})$ . Then, there exists a bijective map $\psi :V_{G_1}\to V_{G_2}$ such that $\psi_{\#}m_v^{G_1,q} = m_{\psi (v)}^{G_2,q}$ , $\psi_{\#}\mu_{G_1} = \mu_{G_2}$ and $\ell_{G_1}(v) = \ell_{G_2}(\psi (v))$ for all $v\in V_{G_1}$ . Now, by the definition of $m_{\bullet}^{G_1,q}$ and $m_{\bullet}^{G_2,q}$ (see Definition 5), one can easily check that + +$$ +\deg_ {G _ {1}} (v) = 0 \Leftrightarrow m _ {v} ^ {G _ {1}, q} (v) = m _ {\psi (v)} ^ {G _ {2}, q} (\psi (v)) = 1 \Leftrightarrow \deg_ {G _ {2}} (\psi (v)) = 0. +$$ + +So, consider the case when $m_v^{G_1,q}(v) < 1$ . This implies $\deg_{G_1}(v) > 0$ and $\deg_{G_2}(\psi(v)) > 0$ . In this case, again by the definition of $m_\bullet^{G_1,q}$ and $m_\bullet^{G_2,q}$ , one can show that + +$v,v^{\prime}\in V_{G_1}$ are adjacent $\Leftrightarrow m_v^{G_1,q}(v') = m_{\psi (v)}^{G_2,q}(\psi (v')) > 0\Leftrightarrow \psi (v),\psi (v')\in V_{G_2}$ are adjacent. + +![](images/4bc2bdcc78d9d00a8f85d858eb5e9cee7cd120ce42042b474609cb2d138e4b84.jpg) +Figure 5. Comparison of runtime of WWL distance against $d_{\mathrm{WL}}^{(k)}$ and its lower bound $d_{\mathrm{WLLB}}^{(k)}$ . + +Hence, $G_{1}$ and $G_{2}$ are isomorphic as we required. + +# B.2. Proofs from Section 3 + +# B.2.1. PROOF OF THE CLAIM IN EXAMPLE 1 + +By Lemma A.1 we have that + +$$ +\begin{array}{l} d _ {\mathrm {W L}} ^ {(1)} ((\mathcal {X}, \ell_ {X}), (\mathcal {Y}, \ell_ {Y})) = d _ {\mathrm {W}} (\mathfrak {L} _ {1} ((\mathcal {X}, \ell_ {X})), \mathfrak {L} _ {1} ((\mathcal {Y}, \ell_ {Y}))) \\ = d _ {\mathrm {W}} \left(\left(\mathfrak {l} _ {(\mathcal {X}, \ell_ {X})} ^ {(1)}\right) _ {\#} \mu_ {X}, \left(\mathfrak {l} _ {(\mathcal {Y}, \ell_ {Y})} ^ {(1)}\right) _ {\#} \mu_ {Y}\right) \\ = \inf _ {\gamma \in \mathcal {C} (\mu_ {X}, \mu_ {Y})} \int_ {X \times Y} d _ {\mathrm {W}} \left(\mathrm {l} _ {(\mathcal {X}, \ell_ {X})} ^ {(1)} (x), \mathrm {l} _ {(\mathcal {Y}, \ell_ {Y})} ^ {(1)} (y)\right) \gamma (d x \times d y) \\ = \inf _ {\gamma \in \mathcal {C} (\mu_ {X}, \mu_ {Y})} \int_ {X \times Y} d _ {\mathrm {W}} \big ((\ell_ {X}) _ {\#} m _ {x} ^ {X}, (\ell_ {Y}) _ {\#} m _ {y} ^ {Y} \big) \gamma (d x \times d y). \\ \end{array} +$$ + +# B.2.2. PROOF OF PROPOSITION 3.1 + +This proposition follows directly from Lemma A.6 and Theorem A.7. + +# B.2.3. PROOF OF PROPOSITION 3.2 + +It is obvious that when $(\mathcal{X},\ell_X)$ is isomorphic to $(\mathcal{Y},\ell_Y)$ , $d_{\mathrm{WL}}^{(k)}((\mathcal{X},\ell_X),(\mathcal{Y},\ell_Y)) = 0$ for all $k\in \mathbb{N}$ and thus $d_{\mathrm{WL}}((\mathcal{X},\ell_X),(\mathcal{Y},\ell_Y)) = 0$ . It follows directly from Equation (2) that $d_{\mathrm{WL}}^{(k)}$ satisfies the triangle inequality. Hence, $d_{\mathrm{WL}}\coloneqq \sup_{k\geq 1}d_{\mathrm{WL}}^{(k)}$ also satisfies the triangle inequality. + +# B.2.4. PROOF OF LEMMA 3.4 + +We first assume that the WL test cannot distinguish $(G_{1},\ell_{G_{1}})$ and $(G_{2},\ell_{G_{2}})$ , i.e., $L_{k}((G_{1},\ell_{G_{1}})) = L_{k}((G_{2},\ell_{G_{2}}))$ for all $k = 0,1,\ldots$ . We then prove that $L_{k}((G_{1},\ell_{G_{1}}^{g})) = L_{k}((G_{2},\ell_{G_{2}}^{g}))$ for all $k = 0,1,\ldots$ . The assumption $L_{k}((G_{1},\ell_{G_{1}})) = L_{k}((G_{2},\ell_{G_{2}}))$ for all $k = 0,1,\ldots$ immediately implies that $|V_{G_1}| = |V_{G_2}|$ . Then, it suffices to show that for any $v_{1}\in V_{G_{1}}$ and $v_{2}\in V_{G_{2}}$ + +$$ +\ell_ {\left(G _ {1}, \ell_ {G _ {1}}\right)} ^ {(k + 1)} \left(v _ {1}\right) = \ell_ {\left(G _ {2}, \ell_ {G _ {2}}\right)} ^ {(k + 1)} \left(v _ {2}\right) \Longrightarrow \ell_ {\left(G _ {1}, \ell_ {G _ {1}} ^ {g}\right)} ^ {(k)} \left(v _ {1}\right) = \ell_ {\left(G _ {2}, \ell_ {G _ {2}} ^ {g}\right)} ^ {(k)} \left(v _ {2}\right), \forall k = 0, 1, \dots . \tag {12} +$$ + +We prove Equation (12) by induction on $k$ . When $k = 0$ , for any $v_{1} \in V_{G_{1}}$ and $v_{2} \in V_{G_{2}}$ , if $\ell_{(G_1,\ell_{G_1})}^1 (v_1) = \ell_{(G_2,\ell_{G_2})}^1 (v_2)$ , + +then + +$$ +\left(\ell_ {G _ {1}} \left(v _ {1}\right), \{\{\ell_ {G _ {1}} (v), v \in N _ {G _ {1}} \left(v _ {1}\right) \} \}\right) = \left(\ell_ {G _ {2}} \left(v _ {2}\right), \{\{\ell_ {G _ {2}} (v), v \in N _ {G _ {2}} \left(v _ {2}\right) \} \}\right). +$$ + +It follows that $\ell_{G_1}(v_1) = \ell_{G_2}(v_2)$ and $\deg_{G_1}(v_1) = \deg_{G_2}(v_2)$ . Then, by injectivity of $g$ , one has that $\ell_{G_1}^g (v_1) = \ell_{G_2}^g (v_2)$ . + +Now, we assume that Equation (12) holds for some $k \geq 0$ . For the case of $k + 1$ , note that $\ell_{(G_1,\ell_{G_1})}^{(k + 2)}(v_1) = \ell_{(G_2,\ell_{G_2})}^{(k + 2)}(v_2)$ implies that + +$$ +\left(\ell_ {(G _ {1}, \ell_ {G _ {1}})} ^ {(k + 1)} (v _ {1}), \left\{\left\{\ell_ {(G _ {1}, \ell_ {G _ {1}})} ^ {(k + 1)} (v), v \in N _ {G _ {1}} (v _ {1}) \right\} \right\}\right) = \left(\ell_ {(G _ {2}, \ell_ {G _ {2}})} ^ {(k + 1)} (v _ {2}), \left\{\left\{\ell_ {(G _ {2}, \ell_ {G _ {2}})} ^ {(k + 1)} (v), v \in N _ {G _ {2}} (v _ {2}) \right\} \right\}\right). +$$ + +Hence, $\ell_{(G_1,\ell_{G_1})}^{(k + 1)}(v_1) = \ell_{(G_2,\ell_{G_2})}^{(k + 1)}(v_2)$ and there exists a bijection $\psi :N_{G_1}(v_1)\to N_{G_2}(v_2)$ such that $\ell_{(G_1,\ell_{G_1})}^{(k + 1)}(v) =$ $\ell_{(G_2,\ell_{G_2})}^{(k + 1)}(\psi (v))$ for any $v\in N_{G_1}(v_1)$ . By the induction assumption, we then have that $\ell_{(G_1,\ell_{G_1}^g)}^{(k)}(v_1) = \ell_{(G_2,\ell_{G_2}^g)}^{(k)}(v_2)$ and $\ell_{(G_1,\ell_{G_1}^g)}^{(k)}(v) = \ell_{(G_2,\ell_{G_2}^g)}^{(k)}(\psi (v))$ for any $v\in N_{G_1}(v_1)$ . This implies that + +$$ +\left( \right.\ell_ {(G _ {1}, \ell_ {G _ {1}} ^ {g})} ^ {(k)} (v _ {1}), \left\{\left\{\ell_ {(G _ {1}, \ell_ {G _ {1}} ^ {g})} ^ {(k)} (v), v \in N _ {G _ {1}} (v _ {1}) \right\}\right\}\left. \right\}\left. \right) = \left(\ell_ {(G _ {2}, \ell_ {G _ {2}} ^ {g})} ^ {(k)} (v _ {2}), \left\{\left\{\ell_ {(G _ {2}, \ell_ {G _ {2}} ^ {g})} ^ {(k)} (v), v \in N _ {G _ {2}} (v _ {2}) \right\}\right\}\right) +$$ + +and thus $\ell_{(G_1,\ell_{G_1}^g)}^{(k + 1)}(v_1) = \ell_{(G_2,\ell_{G_2}^g)}^{(k + 1)}(v_2)$ . Therefore, $L_{k}\big((G_{1},\ell_{G_{1}}^{g})\big) = L_{k}\big((G_{2},\ell_{G_{2}}^{g})\big)$ for all $k = 0,1,\ldots$ and thus the WL test cannot distinguish $(G_{1},\ell_{G_{1}}^{g})$ and $(G_{2},\ell_{G_{2}}^{g})$ . + +Conversely, we assume that the WL test cannot distinguish $(G_{1},\ell_{G_{1}}^{g})$ and $(G_{2},\ell_{G_{2}}^{g})$ , i.e., $L_{k}\bigl ((G_{1},\ell_{G_{1}}^{g})\bigr) = L_{k}\bigl ((G_{2},\ell_{G_{2}}^{g})\bigr)$ for all $k = 0,1,\ldots$ . We then prove that $L_{k}((G_{1},\ell_{G_{1}})) = L_{k}((G_{2},\ell_{G_{2}}))$ for all $k = 0,1,\ldots$ . The proof is similar to the one for the other direction. First, the assumption $L_{k}\bigl ((G_{1},\ell_{G_{1}}^{g})\bigr) = L_{k}\bigl ((G_{2},\ell_{G_{2}}^{g})\bigr)$ for all $k = 0,1,\ldots$ implies that $|V_{G_1}| = |V_{G_2}|$ . Then, it suffices to show that for any $v_{1}\in V_{G_{1}}$ and $v_{2}\in V_{G_{2}}$ + +$$ +\ell_ {\left(G _ {1}, \ell_ {G _ {1}} ^ {g}\right)} ^ {(k)} (v _ {1}) = \ell_ {\left(G _ {2}, \ell_ {G _ {2}} ^ {g}\right)} ^ {(k)} (v _ {2}) \Longrightarrow \ell_ {\left(G _ {1}, \ell_ {G _ {1}}\right)} ^ {(k)} (v _ {1}) = \ell_ {\left(G _ {2}, \ell_ {G _ {2}}\right)} ^ {(k)} (v _ {2}), \forall k = 0, 1, \dots . \tag {13} +$$ + +We prove Equation (13) by induction on $k$ . When $k = 0$ , for any $v_{1} \in V_{G_{1}}$ and $v_{2} \in V_{G_{2}}$ , if $\ell_{G_1}^g (v_1) = \ell_{G_2}^g (v_2)$ , then by injectivity of $g$ , we have that $\ell_{G_1}(v_1) = \ell_{G_2}(v_2)$ . + +Now, we assume that Equation (13) holds for some $k \geq 0$ . For the case of $k + 1$ , note that $\ell_{(G_1,\ell_{G_1}^g)}^{(k + 1)}(v_1) = \ell_{(G_2,\ell_{G_2}^g)}^{(k + 1)}(v_2)$ implies that + +$$ +\left(\ell_{(G_{1},\ell_{G_{1}}^{g})}^{(k)}(v_{1}),\left\{\left\{\ell_{(G_{1},\ell_{G_{1}}^{g})}^{(k)}(v), v\in N_{G_{1}}(v_{1})\right\} \right\}\right) = \left(\ell_{(G_{2},\ell_{G_{2}}^{g})}^{(k)}(v_{2}),\left\{\left\{\ell_{(G_{2},\ell_{G_{2}}^{g})}^{(k)}(v), v\in N_{G_{2}}(v_{2})\right\} \right\}\right). +$$ + +By the induction assumption, it is easy to see that + +$$ +\left( \right.\ell_ {(G _ {1}, \ell_ {G _ {1}})} ^ {(k)} (v _ {1}), \left\{\left\{\ell_ {(G _ {1}, \ell_ {G _ {1}})} ^ {(k)} (v), v \in N _ {G _ {1}} (v _ {1}) \right\}\right\}\left. \right\}\left. \right) = \left(\ell_ {(G _ {2}, \ell_ {G _ {2}})} ^ {(k)} (v _ {2}), \left\{\left\{\ell_ {(G _ {2}, \ell_ {G _ {2}})} ^ {(k)} (v), v \in N _ {G _ {2}} (v _ {2}) \right\}\right\}\right) +$$ + +and thus $\ell_{(G_1,\ell_{G_1})}^{(k + 1)}(v_1) = \ell_{(G_2,\ell_{G_2})}^{(k + 1)}(v_2)$ . Therefore, $L_{k}((G_{1},\ell_{G_{1}})) = L_{k}((G_{2},\ell_{G_{2}}))$ for all $k = 0,1,\ldots$ and thus the WL test cannot distinguish $(G_{1},\ell_{G_{1}})$ and $(G_{2},\ell_{G_{2}})$ . + +# B.2.5. PROOF OF PROPOSITION 3.3 + +By Lemma 3.4, we only need to prove that the WL test cannot distinguish $(G_1,\ell_{G_1}^g)$ and $(G_{2},\ell_{G_{2}}^{g})$ iff $d_{\mathrm{WL}}\bigl ((\mathcal{X}_q(G_1),\ell_G^g),(\mathcal{X}_q(G_2),\ell_{G_2}^g)\bigr) = 0.$ For this purpose, we need to introduce some new notions. + +For any metric space $Z$ , we let $\mathrm{MultPow}(Z)$ denote the collection of all finite multisets of $Z$ (including the empty set). We inductively define a family of sets $Z^k$ as follows: + +1. $Z^1 \coloneqq Z \times \operatorname{MultPow}(Z)$ ; +2. for $k \geq 1$ , $Z^{k+1} := Z^k \times \mathrm{MultPow}(Z^k)$ . + +Then, we inductively define a family of maps $\varphi_q^k: Z^k \to \mathcal{P}^{\circ k}(Z)$ as follows: + +1. define $\varphi_q^1: Z^1 \to \mathcal{P}(Z)$ by + +$$ +(z, A) \in Z \times \operatorname {M u l t P o w} (Z) \mapsto \left\{ \begin{array}{l l} q \delta_ {z} + \frac {1 - q}{| A |} \sum_ {z ^ {\prime} \in A} \delta_ {z ^ {\prime}}, & A \neq \emptyset \\ \delta_ {z}, & A = \emptyset \end{array} ; \right. +$$ + +2. for $k \geq 1$ , define $\varphi_q^{k+1}: Z^{k+1} \to \mathcal{P}^{\circ(k+1)}(Z)$ by + +$$ +(z, A) \in Z ^ {k} \times \mathrm {M u l t P o w} (Z ^ {k}) \mapsto \left\{ \begin{array}{l l} q \delta_ {\varphi_ {q} ^ {k} (z)} + \frac {1 - q}{| A |} \sum_ {z ^ {\prime} \in A} \delta_ {\varphi_ {q} ^ {k} (z ^ {\prime})}, & A \neq \emptyset \\ \delta_ {\varphi_ {q} ^ {k} (z)}, & A = \emptyset \end{array} \right.. +$$ + +Lemma B.1. For any labeled graph $(G,\ell_{G}:V_{G}\to Z)$ and any $q\in [0,1]$ , one has that for any $k\in \mathbb{N}$ + +$$ +\mathfrak {l} _ {\left(\mathcal {X} _ {q} (G), \ell_ {G}\right)} ^ {(k)} = \varphi_ {q} ^ {k} \circ \ell_ {\left(G, \ell_ {G}\right)} ^ {(k)}: V _ {G} \rightarrow \mathcal {P} ^ {\circ k} (Z). \tag {14} +$$ + +Proof of Lemma B.1. We prove by induction on $k$ . + +When $k = 1$ , for any $v \in V$ , if $N_G(v) \neq \emptyset$ we have that + +$$ +\begin{array}{l} \mathrm {I} _ {\left(\mathcal {X} _ {q} (G), \ell_ {G}\right)} ^ {(1)} (v) = \left(\ell_ {G}\right) _ {\#} m _ {v} ^ {G, q} = q \delta_ {\ell_ {G} (v)} + \frac {1 - q}{\deg (v)} \sum_ {v ^ {\prime} \in N _ {G} (v)} \delta_ {\ell_ {G} \left(v ^ {\prime}\right)} \\ = \varphi_ {q} ^ {1} \left(\left(\ell_ {G} (v), \left\{\left\{\ell_ {G} \left(v ^ {\prime}\right): v ^ {\prime} \in N _ {G} (v) \right\} \right\}\right)\right) \\ = \varphi_ {q} ^ {1} (\ell_ {(G, \ell_ {G})} ^ {(1)} (v)). \\ \end{array} +$$ + +If $N_G(v) = \emptyset$ then we have that + +$$ +\mathfrak {l} _ {(\mathcal {X} _ {q} (G), \ell_ {G})} ^ {(1)} (v) = (\ell_ {G}) _ {\#} m _ {v} ^ {G, q} = \delta_ {\ell_ {G} (v)} = \varphi_ {q} ^ {1} ((\ell_ {G} (v), \emptyset)) = \varphi_ {q} ^ {1} (\ell_ {(G, \ell_ {G})} ^ {(1)} (v)). +$$ + +Now, we assume that Equation (14) holds for some $k \geq 1$ . Then, for $k + 1$ and for any $v \in V$ , if $N_G(v) \neq \emptyset$ , we have that + +$$ +\begin{array}{l} \mathfrak {l} _ {(\mathcal {X} _ {q} (G), \ell_ {G})} ^ {(k + 1)} (v) = \left(\mathfrak {l} _ {(\mathcal {X} _ {q} (G), \ell_ {G})} ^ {(k)}\right) _ {\#} m _ {v} ^ {G, q} = q \delta_ {\mathfrak {l} _ {(\mathcal {X} _ {q} (G), \ell_ {G})} ^ {(k)} (v)} + \frac {1 - q}{\deg (v)} \sum_ {v ^ {\prime} \in N _ {G} (v)} \delta_ {\mathfrak {l} _ {(\mathcal {X} _ {q} (G), \ell_ {G})} ^ {(k)} (v ^ {\prime})} \\ = q \delta_ {\varphi_ {q} ^ {k} \left(\ell_ {(G, \ell_ {G})} ^ {(k)} (v)\right)} + \frac {1 - q}{\deg (v)} \sum_ {v ^ {\prime} \in N _ {G} (v)} \delta_ {\varphi_ {q} ^ {k} \left(\ell_ {(G, \ell_ {G})} ^ {(k)} (v ^ {\prime})\right)} \\ = \varphi_ {q} ^ {k + 1} \left(\left(\ell_ {(G, \ell_ {G})} ^ {(k)} (v), \left\{\left\{\ell_ {(G, \ell_ {G})} ^ {(k)} \left(v ^ {\prime}\right): v ^ {\prime} \in N _ {G} (v) \right\} \right\}\right)\right) \\ = \varphi_ {q} ^ {k + 1} \left(\ell_ {(G, \ell_ {G})} ^ {(k + 1)} (v)\right). \\ \end{array} +$$ + +If $N_G(v) = \emptyset$ then we have that + +$$ +\mathfrak {l} _ {(\mathcal {X} _ {q} (G), \ell_ {G})} ^ {(k + 1)} (v) = \left(\mathfrak {l} _ {(\mathcal {X} _ {q} (G), \ell_ {G})} ^ {(k)}\right) _ {\#} m _ {v} ^ {G, q} = \delta_ {\mathfrak {l} _ {(\mathcal {X} _ {q} (G), \ell_ {G})} ^ {(k)} (v)} = \delta_ {\varphi_ {q} ^ {k} \Big (\ell_ {(G, \ell_ {G})} ^ {(k)} (v) \Big)} = \varphi_ {q} ^ {k + 1} \Big (\Big (\ell_ {(G, \ell_ {G})} ^ {(k)} (v), \emptyset \Big) \Big) = \varphi_ {q} ^ {k + 1} \Big (\ell_ {(G, \ell_ {G})} ^ {(k + 1)} (v) \Big). +$$ + +This concludes the proof. + +Lemma B.2. Fix any $\frac{1}{2} < q < 1$ and any labeled graphs $(G_1, \ell_{G_1})$ and $(G_2, \ell_{G_2})$ . Assume that the labels satisfy that for any $v_1 \in V_{G_1}$ and $v_2 \in V_{G_2}$ , we have that $\ell_{G_1}(v_1) = \ell_{G_2}(v_2)$ implies $\deg(v_1) = \deg(v_2)$ . Then, one has that for any $v_1 \in V_{G_1}, v_2 \in V_{G_2}$ , + +$$ +\ell_ {\left(G _ {1}, \ell_ {G _ {1}}\right)} ^ {(k)} (v _ {1}) = \ell_ {\left(G _ {2}, \ell_ {G _ {2}}\right)} ^ {(k)} (v _ {2}) i f f \mathfrak {l} _ {\left(\mathcal {X} _ {q} \left(G _ {1}\right), \ell_ {G _ {1}}\right)} ^ {(k)} (v _ {1}) = \mathfrak {l} _ {\left(\mathcal {X} _ {q} \left(G _ {2}\right), \ell_ {G _ {2}}\right)} ^ {(k)} (v _ {2}). \tag {15} +$$ + +Proof of Lemma B.2. By Lemma B.1, we have that $\ell_{(G_1,\ell_{G_1})}^{(k)}(v_1) = \ell_{(G_2,\ell_{G_2})}^{(k)}(v_2)$ implies that $\mathfrak{l}_{(\mathcal{X}_q(G_1),\ell_{G_1})}^{(k)}(v_1) = \mathfrak{l}_{(\mathcal{X}_q(G_2),\ell_{G_2})}^{(k)}(v_2)$ . For the other direction, we prove by induction on $k$ . + +When $k = 1$ , we first note that $\mathfrak{l}_{(\mathcal{X}_q(G_1),\ell_{G_1})}^{(1)}(v_1) = q\delta_{\ell_{G_1}(v_1)} + \frac{1 - q}{\deg(v_1)}\sum_{v\in N_{G_1}(v_1)}\delta_{\ell_{G_1}(v)}$ if $N_{G_1}(v_1)\neq \emptyset$ and $\mathfrak{l}_{(\mathcal{X}_q(G_1),\ell_{G_1})}^{(1)}(v_1) = \delta_{\ell_{G_1}(v_1)}$ otherwise. Since $\frac{1}{2} < q < 1$ , $\mathfrak{l}_{(\mathcal{X}_q(G_1),\ell_{G_1})}^{(1)}(v_1) = \mathfrak{l}_{(\mathcal{X}_q(G_2),\ell_{G_2})}^{(1)}(v_2)$ implies that $\delta_{\ell_{G_1}(v_1)} = \delta_{\ell_{G_2}(v_2)}$ . Hence $\ell_{G_1}(v_1) = \ell_{G_2}(v_2)$ and thus $\deg_{G_1}(v_1) = \deg_{G_2}(v_2)$ . This implies that $N_{G_1}(v_1) = \emptyset$ iff $N_{G_2}(v_2) = \emptyset$ . If $N_{G_1}(v_1) = \emptyset$ , then obviously, we have that + +$$ +\ell_ {(G _ {1}, \ell_ {G _ {1}})} ^ {(1)} (v _ {1}) = (\ell_ {G _ {1}} (v _ {1}), \emptyset) = (\ell_ {G _ {2}} (v _ {2}), \emptyset) = \ell_ {(G _ {2}, \ell_ {G _ {2}})} ^ {(1)} (v _ {2}). +$$ + +If otherwise $N_{G_1}(v_1)\neq \emptyset$ , then $\mathfrak{l}_{(\mathcal{X}_q(G_1),\ell_{G_1})}^{(1)}(v_1) = \mathfrak{l}_{(\mathcal{X}_q(G_2),\ell_{G_2})}^{(1)}(v_2)$ again implies that $\frac{1 - q}{\deg(v_1)}\sum v\in N_{G_1}(v_1)\delta_{\ell_{G_1}}(v) = \frac{1 - q}{\deg(v_2)}\sum v\in N_{G_2}(v_2)\delta_{\ell_{G_2}}(v)$ . Hence, $\sum v\in N_{G_1}(v_1)\delta_{\ell_{G_1}}(v) = \sum v\in N_{G_2}(v_2)\delta_{\ell_{G_2}}(v)$ and thus $\{\{\ell_{G_1}(v):v\in N_G(v)\}\} = \{\{\ell_{G_2}(v):v\in N_G(v)\}\}$ . Therefore, $\ell_{(G_1,\ell_{G_1})}^{(1)}(v_1) = \ell_{(G_2,\ell_{G_2})}^{(1)}(v_2)$ . + +Now, we assume that Equation (15) holds for some $k \geq 1$ . Note that + +$$ +\mathfrak {l} _ {(\mathcal {X} _ {q} (G _ {1}), \ell_ {G _ {1}})} ^ {(k + 1)} (v _ {1}) = \left\{ \begin{array}{l l} q \delta_ {\mathfrak {l} _ {(\mathcal {X} _ {q} (G _ {1}), \ell_ {G _ {1}})} ^ {(k)} (v _ {1})} + \frac {1 - q}{\deg (v _ {1})} \sum_ {v \in N _ {G _ {1}} (v _ {1})} \delta_ {\mathfrak {l} _ {(\mathcal {X} _ {q} (G _ {1}), \ell_ {G _ {1}})} ^ {(k)} (v)}, & N _ {G _ {1}} (v _ {1}) \neq \emptyset \\ \delta_ {\mathfrak {l} _ {(\mathcal {X} _ {q} (G _ {1}), \ell_ {G _ {1}})} ^ {(k)} (v _ {1})}, & N _ {G _ {1}} (v _ {1}) = \emptyset \end{array} \right. +$$ + +Then, for $k + 1$ , the assumptions $\frac{1}{2} < q < 1$ and $\mathfrak{l}_{(\mathcal{X}_q(G_1),\ell_{G_1})}^{(k + 1)}(v_1) = \mathfrak{l}_{(\mathcal{X}_q(G_2),\ell_{G_2})}^{(k + 1)}(v_2)$ imply that $\delta_{\mathfrak{l}_{(\mathcal{X}_q(G_1),\ell_{G_1})}^{(k)}(v_1)} = \delta_{\mathfrak{l}_{(\mathcal{X}_q(G_2),\ell_{G_2})}^{(k)}(v_2)}$ . Hence $\mathfrak{l}_{(\mathcal{X}_q(G_1),\ell_{G_1})}^{(k)}(v_1) = \mathfrak{l}_{(\mathcal{X}_q(G_2),\ell_{G_2})}^{(k)}(v_2)$ . By the induction assumption we have that $\ell_{(G_1,\ell_{G_1})}^{(k)}(v_1) = \ell_{(G_2,\ell_{G_2})}^{(k)}(v_2)$ . It is not hard to see that then $\ell_{(G_1,\ell_{G_1})}^{(1)}(v_1) = \ell_{(G_2,\ell_{G_2})}^{(1)}(v_2)$ and thus $\deg_{G_1}(v_1) = \deg_{G_2}(v_2)$ . Then, similarly as in the case $k = 1$ , we have two situations. If $N_{G_1}(v_1) = \emptyset$ , then we have that + +$$ +\ell_ {(G _ {1}, \ell_ {G _ {1}})} ^ {(k + 1)} (v _ {1}) = \Big (\ell_ {(G _ {1}, \ell_ {G _ {1}})} ^ {(k)} (v _ {1}), \emptyset \Big) = \Big (\ell_ {(G _ {2}, \ell_ {G _ {2}})} ^ {(k)} (v _ {2}), \emptyset \Big) = \ell_ {(G _ {2}, \ell_ {G _ {2}})} ^ {(k + 1)} (v _ {2}). +$$ + +If otherwise $N_{G_1}(v_1)\neq \emptyset$ , then $\mathfrak{l}_{(\mathcal{X}_q(G_1),\ell_{G_1})}^{(k + 1)}(v_1) = \mathfrak{l}_{(\mathcal{X}_q(G_2),\ell_{G_2})}^{(k + 1)}(v_2)$ again implies that $\frac{1 - q}{\deg(v_1)}\sum_{v\in N_{G_1}(v_1)}\delta_{\mathfrak{l}_{(\mathcal{X}_q(G_1),\ell_{G_1})}(v)} = \frac{1 - q}{\deg(v_2)}\sum_{v\in N_{G_2}(v_2)}\delta_{\mathfrak{l}_{(\mathcal{X}_q(G_2),\ell_{G_2})}(v)}.$ Hence, $\sum_{v\in N_{G_1}(v_1)}\delta_{\mathfrak{l}_{(\mathcal{X}_q(G_1),\ell_{G_1})}(v)}^{(k)} = \sum_{v\in N_{G_2}(v_2)}\delta_{\mathfrak{l}_{(\mathcal{X}_q(G_2),\ell_{G_2})}(v)}^{(k)}$ and thus + +$$ +\left\{\left\{\mathfrak {l} _ {(\mathcal {X} _ {q} (G _ {1}), \ell_ {G _ {1}})} ^ {(k)} (v): v \in N _ {G _ {1}} (v _ {1}) \right\} \right\} = \left\{\left\{\mathfrak {l} _ {(\mathcal {X} _ {q} (G _ {2}), \ell_ {G _ {2}})} ^ {(k)} (v): v \in N _ {G _ {2}} (v _ {2}) \right\} \right\}. +$$ + +Then, by the induction assumption again, we have that + +$$ +\left\{\left\{\ell_ {(G _ {1}, \ell_ {G _ {1}})} ^ {(k)} (v): v \in N _ {G _ {1}} (v _ {1}) \right\} \right\} = \left\{\left\{\ell_ {(G _ {2}, \ell_ {G _ {2}})} ^ {(k)} (v): v \in N _ {G _ {2}} (v _ {2}) \right\} \right\}. +$$ + +Therefore, $\ell_{(G_1,\ell_{G_1})}^{(k + 1)}(v_1) = \ell_{(G_2,\ell_{G_2})}^{(k + 1)}(v_2)$ . This concludes the proof. + +Now, we are ready to prove that + +the WL test cannot distinguish $(G_{1},\ell_{G_{1}}^{g})$ and $(G_{2},\ell_{G_{2}}^{g})$ iff $d_{\mathrm{WL}}\bigl ((\mathcal{X}_q(G_1),\ell_G^g)$ $\left(\mathcal{X}_q(G_2),\ell_{G_2}^g\right)\bigr) = 0.$ + +It suffices to show that for any $k = 0,1,\ldots$ + +$$ +L _ {k} \left(\left(G _ {1}, \ell_ {1} ^ {g}\right)\right) = L _ {k} \left(\left(G _ {2}, \ell_ {2} ^ {g}\right)\right) \text {i f f} \left(\mathfrak {l} _ {\left(\chi_ {q} \left(G _ {1}\right), \ell_ {G _ {1}} ^ {g}\right)} ^ {(k)}\right) _ {\#} \mu_ {G _ {1}} = \left(\mathfrak {l} _ {\left(\chi_ {q} \left(G _ {2}\right), \ell_ {G _ {2}} ^ {g}\right)} ^ {(k)}\right) _ {\#} \mu_ {G _ {2}} \tag {16} +$$ + +Fix any $k = 0,\ldots$ We first assume that $L_{k}((G_{1},\ell_{1}^{g})) = L_{k}((G_{2},\ell_{2}^{g}))$ . Then, it is obvious that $|V_{G_1}| = |V_{G_2}|$ and moreover, there exists a bijection $\psi :V_{G_1}\to V_{G_2}$ such that $\ell_{(G_1,\ell_{G_1}^g)}^{(k)}(v) = \ell_{(G_2,\ell_{G_2}^g)}^{(k)}(\psi (v))$ for any $v\in V_{G_1}$ . This implies the following facts: + +1. By injectivity of $g$ , $\deg_{G_1}(v) = \deg_{G_2}(\psi(v))$ for any $v \in V_{G_1}$ . Hence, $\overline{\deg}_{G_1}(v) = \overline{\deg}_{G_2}(\psi(v))$ for any $v \in V_{G_1}$ . + +2. By Lemma B.1, for any $v \in V_{G_1}$ we have that + +$$ +\mathfrak {l} _ {(\mathcal {X} _ {q} (G _ {1}), \ell_ {G _ {1}} ^ {g})} ^ {(k)} (v) = \varphi_ {q} ^ {k} \circ \ell_ {(G _ {1}, \ell_ {G _ {1}} ^ {g})} ^ {(k)} (v) = \varphi_ {q} ^ {k} \circ \ell_ {(G _ {2}, \ell_ {G _ {2}} ^ {g})} ^ {(k)} (\psi (v)) = \mathfrak {l} _ {(\mathcal {X} _ {q} (G _ {2}), \ell_ {G _ {2}} ^ {g})} ^ {(k)} (\psi (v)). +$$ + +Then, + +$$ +\begin{array}{l} \left(\mathfrak {l} _ {(\mathcal {X} _ {q} (G _ {1}), \ell_ {G _ {1}} ^ {g})} ^ {(k)}\right) _ {\#} \mu_ {G _ {1}} = \sum_ {v \in V _ {G _ {1}}} \frac {\overline {{\deg}} _ {G _ {1}} (v)}{\sum_ {v ^ {\prime} \in V _ {G _ {1}}} \overline {{\deg}} _ {G _ {1}} (v ^ {\prime})} \delta_ {\mathfrak {l} _ {(\mathcal {X} _ {q} (G _ {1}), \ell_ {G _ {1}} ^ {g})} ^ {(k)}} (v) \\ = \sum_ {v \in V _ {G _ {1}}} \frac {\overline {{\operatorname* {d e g}}} _ {G _ {2}} (\psi (v))}{\sum_ {v ^ {\prime} \in V _ {G _ {1}}} \overline {{\operatorname* {d e g}}} _ {G _ {2}} (\psi (v ^ {\prime}))} \delta_ {\mathfrak {l} _ {(\mathcal {X} _ {q} (G _ {2}), \ell_ {G _ {2}} ^ {g})} ^ {(k)}} ^ {(k)} (\psi (v)) \\ = \sum_ {v \in V _ {G _ {2}}} \frac {\overline {{\operatorname* {d e g}}} _ {G _ {2}} (v)}{\sum_ {v ^ {\prime} \in V _ {G _ {2}}} \overline {{\operatorname* {d e g}}} _ {G _ {2}} (v ^ {\prime})} \delta_ {\mathrm {f} _ {(x _ {q} (G _ {2}), \ell_ {G _ {2}} ^ {g})} ^ {(k)}} (v) \\ = \left(\mathfrak {l} _ {\left(\mathcal {X} _ {q} \left(G _ {2}\right), \ell_ {G _ {2}} ^ {q}\right)} ^ {(k)}\right) _ {\#} \mu_ {G _ {2}}. \\ \end{array} +$$ + +Conversely, we assume that $\left(\mathrm{I}_{(\mathcal{X}_q(G_1),\ell_{G_1}^g)}^{(k)}\right)_{\#}\mu_{G_1} = \left(\mathrm{I}_{(\mathcal{X}_q(G_2),\ell_{G_2}^g)}^{(k)}\right)_{\#}\mu_{G_2}$ . Then, + +$$ +\sum_ {v \in V _ {G _ {1}}} \frac {\overline {{\operatorname {d e g}}} _ {G _ {1}} (v)}{\sum_ {v ^ {\prime} \in V _ {G _ {1}}} \overline {{\operatorname {d e g}}} _ {G _ {1}} (v ^ {\prime})} \delta_ {\mathrm {I} _ {\left(\mathcal {X} _ {q} \left(G _ {1}\right), \ell_ {G _ {1}} ^ {g}\right)} ^ {(k)}} ^ {(k)} (v) = \sum_ {v \in V _ {G _ {2}}} \frac {\overline {{\operatorname {d e g}}} _ {G _ {2}} (v)}{\sum_ {v ^ {\prime} \in V _ {G _ {2}}} \overline {{\operatorname {d e g}}} _ {G _ {2}} (v ^ {\prime})} \delta_ {\mathrm {I} _ {\left(\mathcal {X} _ {q} \left(G _ {2}\right), \ell_ {G _ {2}} ^ {g}\right)} ^ {(k)}} ^ {(k)}. \tag {17} +$$ + +Then, for any $v_{1} \in V_{G_{1}}$ , there exists $v_{2} \in V_{G_{2}}$ such that $\mathfrak{l}_{(\mathcal{X}_q(G_1),\ell_{G_1}^g)}^{(k)}(v_1) = \mathfrak{l}_{(\mathcal{X}_q(G_2),\ell_{G_2}^g)}^{(k)}(v_2)$ . If $k = 0$ , then + +$$ +\ell_ {G _ {1}} ^ {g} (v _ {1}) = \mathfrak {l} _ {(\mathcal {X} _ {q} (G _ {1}), \ell_ {G _ {1}} ^ {g})} ^ {(0)} (v _ {1}) = \mathfrak {l} _ {(\mathcal {X} _ {q} (G _ {2}), \ell_ {G _ {2}} ^ {g})} ^ {(0)} (v _ {2}) = \ell_ {G _ {2}} ^ {g} (v _ {2}). +$$ + +Otherwise, we assume that $k > 0$ . Since $\frac{1}{2} < q < 1$ , we have that $\mathfrak{l}_{(\mathcal{X}_q(G_1),\ell_{G_1}^g)}^{(k - 1)}(v_1) = \mathfrak{l}_{(\mathcal{X}_q(G_2),\ell_{G_2}^g)}^{(k - 1)}(v_2)$ . Inductively, we still obtain that + +$$ +\ell_ {G _ {1}} ^ {g} (v _ {1}) = \mathfrak {l} _ {(\mathcal {X} _ {q} (G _ {1}), \ell_ {G _ {1}} ^ {g})} ^ {(0)} (v _ {1}) = \mathfrak {l} _ {(\mathcal {X} _ {q} (G _ {2}), \ell_ {G _ {2}} ^ {g})} ^ {(0)} (v _ {2}) = \ell_ {G _ {2}} ^ {g} (v _ {2}). +$$ + +Hence, by injectivity of $g$ , we have that $|V_{G_1}| = |V_{G_2}|$ , $\deg_{G_1}(v_1) = \deg_{G_2}(v_2)$ and $\overline{\deg}_{G_1}(v_1) = \overline{\deg}_{G_2}(v_2)$ . Then, it is easy to see from Equation (17) that + +$$ +\left| \left\{v \in V _ {G _ {1}}: \mathfrak {l} _ {(\mathcal {X} _ {q} (G _ {1}), \ell_ {G _ {1}} ^ {g})} ^ {(k)} (v) = \mathfrak {l} _ {(\mathcal {X} _ {q} (G _ {1}), \ell_ {G _ {1}} ^ {g})} ^ {(k)} (v _ {1}) \right\} \right| = \left| \left\{v \in V _ {G _ {2}}: \mathfrak {l} _ {(\mathcal {X} _ {q} (G _ {2}), \ell_ {G _ {2}} ^ {g})} ^ {(k)} (v) = \mathfrak {l} _ {(\mathcal {X} _ {q} (G _ {2}), \ell_ {G _ {2}} ^ {g})} ^ {(k)} (v _ {2}) \right\} \right|. +$$ + +It is obvious that $\ell_{G_i}^g$ for $i = 1,2$ satisfy the condition in Lemma B.2. Then, by Lemma B.2, we have that $\ell_{(G_1,\ell_{G_1})}^{(k)}(v_1) = \ell_{(G_2,\ell_{G_2})}^{(k)}(v_2)$ and that + +$$ +\left| \left\{v \in V _ {G _ {1}}: \ell_ {(G _ {1}, \ell_ {G _ {1}})} ^ {(k)} (v) = \ell_ {(G _ {1}, \ell_ {G _ {1}})} ^ {(k)} (v _ {1}) \right\} \right| = \left| \left\{v \in V _ {G _ {2}}: \ell_ {(G _ {2}, \ell_ {G _ {2}})} ^ {(k)} (v) = \ell_ {(G _ {2}, \ell_ {G _ {2}})} ^ {(k)} (v _ {2}) \right\} \right|. +$$ + +Therefore, $L_{k}\bigl ((G_{1},\ell_{G_{1}}^{g})\bigr) = L_{k}\bigl ((G_{2},\ell_{G_{2}}^{g})\bigr)$ + +# B.2.6. PROOF OF COROLLARY 3.5 + +It turns out that one only needs finite steps to determine whether the WL test can distinguish two labeled graphs (Krebs & Verbitsky, 2015). More precisely: + +Proposition B.3. For any labeled graphs $(G_{1},\ell_{G_{1}})$ and $(G_{2},\ell_{G_{2}})$ , $L_{k}((G_{1},\ell_{G_{1}})) = L_{k}((G_{2},\ell_{G_{2}}))$ holds for all $k = 0,\ldots ,|V_{G_1}| + |V_{G_2}|$ if and only if $L_{k}((G_{1},\ell_{G_{1}})) = L_{k}((G_{2},\ell_{G_{2}}))$ holds for all $k\geq 0$ . + +Hence, this corollary is a direct consequence of Proposition 3.3 and Proposition B.3. + +# B.3. Proofs from Section 4 + +# B.3.1. PROOF OF PROPOSITION 4.1 + +We need the following lemma: + +Lemma B.4. For any $C$ -Lipschitz function $\varphi : \mathbb{R}^i \to \mathbb{R}^j$ , we have that the map $q_{\varphi} : \mathcal{P}(\mathbb{R}^i) \to \mathbb{R}^j$ is $C$ -Lipschitz. + +Proof of Lemma B.4. For any $\alpha, \beta \in \mathcal{P}(\mathbb{R}^i)$ , pick any $\gamma \in \mathcal{C}(\alpha, \beta)$ . Then, we have that + +$$ +\begin{array}{l} \left| q _ {\varphi} (\alpha) - q _ {\varphi} (\beta) \right| = \left| \int_ {\mathbb {R} ^ {i}} \varphi (x) \alpha (d x) - \int_ {\mathbb {R} ^ {i}} \varphi (x) \beta (d x) \right| \\ = \left| \int_ {\mathbb {R} ^ {i} \times \mathbb {R} ^ {i}} (\varphi (x) - \varphi (y)) \gamma (d x \times d y) \right| \\ \leq \int_ {\mathbb {R} ^ {i} \times \mathbb {R} ^ {i}} | \varphi (x) - \varphi (y) | \gamma (d x \times d y) \\ \leq C \cdot \int_ {\mathbb {R} ^ {i} \times \mathbb {R} ^ {i}} | x - y | \gamma (d x \times d y). \\ \end{array} +$$ + +Since $\gamma \in \mathcal{C}(\alpha, \beta)$ is arbitrary, we have that + +$$ +| q _ {\varphi} (\alpha) - q _ {\varphi} (\beta) | \leq C \cdot d _ {\mathrm {W}} (\alpha , \beta). +$$ + +Hence $q_{\varphi}$ is $C$ -Lipschitz. + +Now, we start to prove item 1. We introduce some notation. Given a $\mathrm{MCNN}_k$ $h\coloneqq \psi \circ S_{\varphi_{k + 1}}\circ F_{\varphi_k}\circ \dots \circ F_{\varphi_1}$ and any $(\mathcal{X},\ell_X)\in \mathcal{M}^L (Z)$ , we let + +$$ +\left(\mathcal {X}, \ell_ {X} ^ {(\varphi , i)}\right) := F _ {\varphi_ {i}} \circ \dots \circ F _ {\varphi_ {1}} \left(\left(\mathcal {X}, \ell_ {X}\right)\right) \tag {18} +$$ + +Now, we assume that for $i = 1,\dots ,k$ , the MLP $\varphi_{i}$ is $C_i$ -Lipschitz for some $C_i > 0$ (note that MLPs with the Lipschitz activation function $\sigma$ specified in Section 4 are Lipschitz). Then, by Lemma B.4, we have that $q_{\varphi_i}$ is a $C_i$ -Lipschitz map for $i = 1,\ldots ,k$ . + +Then, we prove that + +$$ +d _ {\mathrm {W}} \left(\left(\ell_ {X} ^ {(\varphi , k)}\right) _ {\#} \mu_ {X}, \left(\ell_ {Y} ^ {(\varphi , k)}\right) _ {\#} \mu_ {Y}\right) \leq \left(\Pi_ {i = 1} ^ {k} C _ {i}\right) \cdot d _ {\mathrm {W L}} ^ {(k)} \left(\left(\mathcal {X}, \ell_ {X}\right), \left(\mathcal {Y}, \ell_ {Y}\right)\right). \tag {19} +$$ + +Given Equation (19), if $d_{\mathrm{WL}}^{(k)}((\mathcal{X},\ell_X),(\mathcal{Y},\ell_Y)) = 0$ then $d_{\mathrm{W}}\Big(\big(\ell_X^{(\varphi ,k)}\big)_{\#}\mu_X,\big(\ell_Y^{(\varphi ,k)}\big)_{\#}\mu_Y\Big) = 0$ and thus $\left(\ell_X^{(\varphi ,k)}\right)_{\#}\mu_{X} = \left(\ell_{Y}^{(\varphi ,k)}\right)_{\#}\mu_{Y}$ . Hence, the MCNN $h = \psi \circ S_{\varphi_{k + 1}}\circ F_{\varphi_k}\circ \dots \circ F_{\varphi_1}$ satisfies that + +$$ +h \left(\left(\mathcal {X}, \ell_ {X}\right)\right) = \psi \left(q _ {\varphi_ {k + 1}} \left(\left(\ell_ {X} ^ {\left(\varphi , k\right)}\right) _ {\#} \mu_ {X}\right)\right) = \psi \left(q _ {\varphi_ {k + 1}} \left(\left(\ell_ {Y} ^ {\left(\varphi , k\right)}\right) _ {\#} \mu_ {Y}\right)\right) = h \left(\left(\mathcal {Y}, \ell_ {Y}\right)\right). +$$ + +To prove Equation (19), it suffices to prove that for any $x \in X$ and $y \in Y$ (see Lemma A.1), + +$$ +\left\| \ell_ {X} ^ {(\varphi , k)} (x) - \ell_ {Y} ^ {(\varphi , k)} (y) \right\| \leq \Pi_ {i = 1} ^ {k} C _ {i} \cdot d _ {\mathrm {W}} \Big (\mathfrak {l} _ {(\mathcal {X}, \ell_ {X})} ^ {(k)} (x), \mathfrak {l} _ {(\mathcal {Y}, \ell_ {Y})} ^ {(k)} (y) \Big). +$$ + +We prove the above inequality by proving the following inequality inductively on $j = 1, \ldots, k$ : + +$$ +\left\| \ell_ {X} ^ {(\varphi , j)} (x) - \ell_ {Y} ^ {(\varphi , j)} (y) \right\| \leq \Pi_ {i = 1} ^ {j} C _ {i} \cdot d _ {\mathrm {W}} \left(\mathfrak {l} _ {(\mathcal {X}, \ell_ {X})} ^ {(j)} (x), \mathfrak {l} _ {(\mathcal {Y}, \ell_ {Y})} ^ {(j)} (y)\right). \tag {20} +$$ + +When $j = 0$ , we have that $\ell_X^{(\varphi, 0)} = \ell_X = \mathfrak{l}_{(\mathcal{X}, \ell_X)}^{(0)}$ and $\ell_Y^{(\varphi, 0)} = \ell_Y = \mathfrak{l}_{(\mathcal{Y}, \ell_Y)}^{(0)}$ . Therefore, Equation (20) obviously holds (we let $\Pi_{i=1}^0 C_i := 1$ ). We now assume that Equation (20) holds for some $j \geq 0$ . For $j + 1$ , we have that + +$$ +\begin{array}{l} \Pi_ {i = 1} ^ {j + 1} C _ {i} \cdot d _ {\mathrm {W}} \left(\mathrm {l} _ {(\mathcal {X}, \ell_ {X})} ^ {(j + 1)} (x), \mathrm {l} _ {(\mathcal {Y}, \ell_ {Y})} ^ {(j + 1)} (y)\right) \\ = \Pi_ {i = 1} ^ {j + 1} C _ {i} \cdot d _ {\mathrm {W}} \left(\left(\mathfrak {l} _ {(\mathcal {X}, \ell_ {X})} ^ {(j)}\right) _ {\#} m _ {x} ^ {X}, \left(\mathfrak {l} _ {(\mathcal {Y}, \ell_ {Y})} ^ {(j)}\right) _ {\#} m _ {y} ^ {Y}\right) \\ = C _ {j + 1} \cdot \inf _ {\gamma \in \mathcal {C} (m _ {x} ^ {X}, m _ {y} ^ {Y})} \int_ {X \times Y} \Pi_ {i = 1} ^ {j} C _ {i} \cdot d _ {\mathrm {W}} \left(\mathfrak {l} _ {(\mathcal {X}, \ell_ {X})} ^ {(j)} (x ^ {\prime}), \mathfrak {l} _ {(\mathcal {Y}, \ell_ {Y})} ^ {(j)} (y ^ {\prime})\right) \gamma (d x ^ {\prime} \times d y ^ {\prime}) \\ \geq C_{j + 1}\inf_{\gamma \in \mathcal{C}(m^{X}_{x},m^{Y}_{y})}\int \limits_{X\times Y}\left\| \ell^{(\varphi ,j)}_{X}(x^{\prime}) - \ell^{(\varphi ,j)}_{Y}(y^{\prime})\right\| \gamma (dx^{\prime}\times dy^{\prime}) \\ = C _ {j + 1} \cdot d _ {\mathrm {W}} \left(\left(\ell_ {X} ^ {(\varphi , j)}\right) _ {\#} m _ {x} ^ {X}, \left(\ell_ {Y} ^ {(\varphi , j)}\right) _ {\#} m _ {y} ^ {Y}\right) \\ \geq \left\| q _ {\varphi_ {j + 1}} \left(\left(\ell_ {X} ^ {(\varphi , j)}\right) _ {\#} m _ {x} ^ {X}\right) - q _ {\varphi_ {j + 1}} \left(\left(\ell_ {Y} ^ {(\varphi , j)}\right) _ {\#} m _ {y} ^ {Y}\right) \right\| \\ = \left\| \ell_ {X} ^ {(\varphi , j + 1)} (x) - \ell_ {Y} ^ {(\varphi , j + 1)} (y) \right\|. \\ \end{array} +$$ + +This concludes the induction step and thus the proof of item 1. + +Next, we prove item 2. The proof is based on the following two basic results: + +Lemma B.5. For any $d\in \mathbb{N}$ and any $\alpha ,\beta \in \mathcal{P}(\mathbb{R}^d)$ , if $\alpha \neq \beta$ , then there exists a Lipschitz function $\varphi :\mathbb{R}^d\to \mathbb{R}$ such that + +$$ +\int_ {\mathbb {R} ^ {d}} \varphi (x) \alpha (d x) \neq \int_ {\mathbb {R} ^ {d}} \varphi (x) \beta (d x). +$$ + +Proof of Lemma B.5. By Kantorovich duality (see for example Remark 6.5 in (Villani, 2009)), + +$$ +d _ {\mathrm {W}} (\alpha , \beta) = \sup \left\{\left| \int_ {\mathbb {R} ^ {d}} \varphi (x) \alpha (d x) - \int_ {\mathbb {R} ^ {d}} \varphi (x) \beta (d x) \right|: \varphi : \mathbb {R} ^ {d} \rightarrow \mathbb {R} \text {i s 1 - L i p s c h i t z .} \right\} +$$ + +Since $\alpha \neq \beta$ , we have that $d_{\mathrm{W}}(\alpha, \beta) > 0$ , and thus there exists a 1-Lipschitz $\varphi: \mathbb{R}^d \to \mathbb{R}$ such that $\int_{\mathbb{R}^d} \varphi(x) \alpha(dx) \neq \int_{\mathbb{R}^d} \varphi(x) \beta(dx)$ . + +Lemma B.6. For any $d \in \mathbb{N}$ and any $\alpha, \beta \in \mathcal{P}(\mathbb{R}^d)$ , if $\alpha \neq \beta$ and they are both compactly supported, then there exists a single-hidden-layer MLP $\varphi: \mathbb{R}^d \to \mathbb{R}$ (with the activation function $\sigma$ specified in Section 4) such that + +$$ +\int_ {\mathbb {R} ^ {d}} \varphi (x) \alpha (d x) \neq \int_ {\mathbb {R} ^ {d}} \varphi (x) \beta (d x). +$$ + +Proof of Lemma B.6. By Lemma B.5, there exists a Lipschitz $\psi : \mathbb{R}^d \to \mathbb{R}$ such that $\int_{\mathbb{R}^d} \psi(x)\alpha(dx) \neq \int_{\mathbb{R}^d} \psi(x)\beta(dx)$ . Let $\varepsilon \coloneqq \left|\int_{\mathbb{R}^d}\psi(x)\alpha(dx) - \int_{\mathbb{R}^d}\psi(x)\beta(dx)\right| > 0$ . Let $K \coloneqq \operatorname{supp}(\alpha) \cup \operatorname{supp}(\beta)$ . Since both probability measures are compactly supported, we have that $K$ is compact. Then, by the classic universal approximation theorem (Pinkus, 1999, Theorem 3.1) and by the assumption that $\sigma$ is Lipschitz and non-polynomial, there exists a single-hidden-layer MLP $\varphi : \mathbb{R}^d \to \mathbb{R}$ such that $\sup_{x \in K}|\varphi(x) - \psi(x)| < \frac{\varepsilon}{4}$ . Therefore, + +$$ +\left| \int_ {\mathbb {R} ^ {d}} \varphi (x) \alpha (d x) - \int_ {\mathbb {R} ^ {d}} \psi (x) \alpha (d x) \right| \leq \int_ {\mathbb {R} ^ {d}} | \varphi (x) - \psi (x) | \alpha (d x) = \int_ {K} | \varphi (x) - \psi (x) | \alpha (d x) \leq \frac {\varepsilon}{4} +$$ + +and similarly, + +$$ +\left| \int_ {\mathbb {R} ^ {d}} \varphi (x) \beta (d x) - \int_ {\mathbb {R} ^ {d}} \psi (x) \beta (d x) \right| \leq \frac {\varepsilon}{4}. +$$ + +Hence, $\int_{\mathbb{R}^d}\varphi (x)\alpha (dx)\neq \int_{\mathbb{R}^d}\varphi (x)\beta (dx).$ + +![](images/9d0fa8843a7f05d0b4a701b5de97ecb9a34aac8b1b78cb1b03c136fab3283ef2.jpg) + +Now, given any $(\mathcal{X},\ell_X)$ and $(\mathcal{Y},\ell_Y)$ such that $d_{\mathrm{WL}}^{(k)}((\mathcal{X},\ell_X),(\mathcal{Y},\ell_Y)) > 0$ we have that + +$$ +d _ {\mathrm {W}} \left(\left(\mathfrak {l} _ {(\mathcal {X}, \ell_ {X})} ^ {(k)}\right) _ {\#} \mu_ {X}, \left(\mathfrak {l} _ {(\mathcal {Y}, \ell_ {Y})} ^ {(k)}\right) _ {\#} \mu_ {Y}\right) = d _ {\mathrm {W L}} ^ {(k)} \left((\mathcal {X}, \ell_ {X}), (\mathcal {Y}, \ell_ {Y})\right) > 0. +$$ + +Then, we prove that for each $i = 1,\dots ,k$ , there exists a MLP $\varphi_{i}:\mathbb{R}^{d_{i - 1}}\to \mathbb{R}^{d_{i}}$ for suitable dimensions $d_{i - 1}$ and $d_{i}$ such that + +$$ +\forall x \in X, y \in Y, \ell_ {X} ^ {(\varphi , i)} (x) = \ell_ {Y} ^ {(\varphi , i)} (y) \text {i f f} \mathfrak {l} _ {\left(x, \ell_ {X}\right)} ^ {(i)} (x) = \mathfrak {l} _ {\left(y, \ell_ {Y}\right)} ^ {(i)} (y). \tag {21} +$$ + +Given Equation (21), it is obvious that $\left(\mathfrak{l}_{(\mathcal{X},\ell_X)}^{(k)}\right)_\# \mu_X \neq \left(\mathfrak{l}_{(\mathcal{Y},\ell_Y)}^{(k)}\right)_\#\mu_Y$ implies that $\left(\ell_X^{(\varphi ,k)}\right)_\# \mu_X \neq \left(\ell_Y^{(\varphi ,k)}\right)_\#\mu_Y$ . Then, by Lemma B.6 and by the fact that $X$ and $Y$ are finite, there exists a MLP $\varphi_{k + 1}:\mathbb{R}^{d_k}\to \mathbb{R}$ such that + +$$ +\int_ {\mathbb {R} ^ {d}} \varphi_ {k + 1} (t) \left(\ell_ {X} ^ {(\varphi , k)}\right) _ {\#} \mu_ {X} (d t) \neq \int_ {\mathbb {R} ^ {d}} \varphi_ {k + 1} (t) \left(\ell_ {Y} ^ {(\varphi , k)}\right) _ {\#} \mu_ {Y} (d t). +$$ + +Then, by the classic universal approximation theorem (Pinkus, 1999, Theorem 3.1) again, there exists a MLP $\psi : \mathbb{R} \to \mathbb{R}$ which distinguishes the two numbers above. Hence, we have that + +$$ +\begin{array}{l} \psi \circ S _ {\varphi_ {k + 1}} \circ F _ {\varphi_ {k}} \circ \dots \circ F _ {\varphi_ {1}} (\mathcal {X}) = \psi \left(\int_ {\mathbb {R} ^ {d}} \varphi_ {k + 1} (t) \left(\ell_ {X} ^ {(\varphi , k)}\right) _ {\#} \mu_ {X} (d t)\right) \\ \neq \psi \left(\int_ {\mathbb {R} ^ {d}} \varphi_ {k + 1} (t) \left(\ell_ {Y} ^ {(\varphi , k)}\right) _ {\#} \mu_ {Y} (d t)\right) \\ = \psi \circ S _ {\varphi_ {k + 1}} \circ F _ {\varphi_ {k}} \circ \dots \circ F _ {\varphi_ {1}} (\mathcal {Y}). \\ \end{array} +$$ + +To conclude the proof, we prove Equation (21) by induction on $i = 1,\dots ,k$ . When $i = 1$ , let + +$$ +A _ {1} := \left\{(x, y) \in X \times Y: (\ell_ {X}) _ {\#} m _ {x} ^ {X} \neq (\ell_ {Y}) _ {\#} m _ {y} ^ {Y} \right\}. +$$ + +Since $X$ and $Y$ are finite, $A_{1}$ is a finite set. We enumerate elements in $A_{1}$ and write $A_{1} = \{(x_{1},y_{1}),\ldots ,(x_{d_{1}},y_{d_{1}})\}$ . By Lemma B.6, for each $j = 1,\dots ,d_1$ , there exists a $\mathbf{MLP}\varphi_1^j:\mathbb{R}^d\to \mathbb{R}$ such that + +$$ +\int_ {\mathbb {R} ^ {d}} \varphi_ {1} ^ {j} (t) (\ell_ {X}) _ {\#} m _ {x _ {j}} ^ {X} (d t) \neq \int_ {\mathbb {R} ^ {d}} \varphi_ {1} ^ {j} (t) (\ell_ {Y}) _ {\#} m _ {y _ {j}} ^ {Y} (d t). +$$ + +We then let $\varphi_{1} := \left(\varphi_{1}^{1}, \varphi_{1}^{2}, \ldots, \varphi_{1}^{d_{1}}\right): \mathbb{R}^{d} \to \mathbb{R}^{d_{1}}$ . It is not hard to see that $\varphi_{1}$ is still a MLP with a single hidden layer and it satisfies that + +$$ +\forall x \in X, y \in Y, (\ell_ {X}) _ {\#} m _ {x} ^ {X} = (\ell_ {Y}) _ {\#} m _ {y} ^ {Y} \mathrm {i f f} \int_ {\mathbb {R} ^ {d}} \varphi_ {1} (t) (\ell_ {X}) _ {\#} m _ {x} ^ {X} (d t) = \int_ {\mathbb {R} ^ {d}} \varphi_ {1} (t) (\ell_ {Y}) _ {\#} m _ {y} ^ {Y} (d t). +$$ + +Equivalent speaking, + +$$ +\forall x \in X, y \in Y, \mathfrak {l} _ {\left(x, \ell_ {X}\right)} ^ {(1)} (x) = \mathfrak {l} _ {\left(y, \ell_ {Y}\right)} ^ {(1)} (y) \text {i f f} \ell_ {X} ^ {(\varphi , 1)} (x) = \ell_ {Y} ^ {(\varphi , 1)} (y). +$$ + +Now, we assume that Equation (21) holds for some $i \geq 1$ . For $i + 1$ , we let + +$$ +A _ {i + 1} := \left\{(x, y) \in X \times Y: \left(\ell_ {X} ^ {(\varphi , i)}\right) _ {\#} m _ {x} ^ {X} \neq \left(\ell_ {Y} ^ {(\varphi , i)}\right) _ {\#} m _ {y} ^ {Y} \right\}. +$$ + +Since $X$ and $Y$ are finite, $A_{i+1}$ is a finite set. We enumerate elements in $A_{i+1}$ and write $A_{i+1} = \{(x_1, y_1), \ldots, (x_{d_{i+1}}, y_{d_{i+1}})\}$ . By Lemma B.6, for each $j = 1, \ldots, d_{i+1}$ , there exists a MLP $\varphi_{i+1}^j : \mathbb{R}^{d_i} \to \mathbb{R}$ such that + +$$ +\int_ {\mathbb {R} ^ {d _ {i}}} \varphi_ {i + 1} ^ {j} (t) \left(\ell_ {X} ^ {(\varphi , i)}\right) _ {\#} m _ {x _ {j}} ^ {X} (d t) \neq \int_ {\mathbb {R} ^ {d _ {i}}} \varphi_ {i + 1} ^ {j} (t) \left(\ell_ {Y} ^ {(\varphi , i)}\right) _ {\#} m _ {y _ {j}} ^ {Y} (d t). +$$ + +We then let $\varphi_{i + 1} \coloneqq \left(\varphi_{i + 1}^{1},\varphi_{i + 1}^{2},\dots ,\varphi_{i + 1}^{d_{i + 1}}\right):\mathbb{R}^{d_i}\to \mathbb{R}^{d_{i + 1}}$ . Again $\varphi_{i + 1}$ is a MLP with a single hidden layer and it satisfies that $\forall x\in X$ and $y\in Y$ , + +$$ +\left(\ell_ {X} ^ {(\varphi , i)}\right) _ {\#} m _ {x} ^ {X} = \left(\ell_ {Y} ^ {(\varphi , i)}\right) _ {\#} m _ {y} ^ {Y} \mathrm {i f f} \int_ {\mathbb {R} ^ {d _ {i}}} \varphi_ {i + 1} (t) \left(\ell_ {X} ^ {(\varphi , i)}\right) _ {\#} m _ {x} ^ {X} (d t) = \int_ {\mathbb {R} ^ {d _ {i}}} \varphi_ {i + 1} (t) \left(\ell_ {Y} ^ {(\varphi , i)}\right) _ {\#} m _ {y} ^ {Y} (d t). +$$ + +Equivalent speaking, + +$$ +\forall x \in X, y \in Y, \left(\ell_ {X} ^ {(\varphi , i)}\right) _ {\#} m _ {x} ^ {X} = \left(\ell_ {Y} ^ {(\varphi , i)}\right) _ {\#} m _ {y} ^ {Y} \text {i f f} \ell_ {X} ^ {(\varphi , i + 1)} (x) = \ell_ {Y} ^ {(\varphi , i + 1)} (y). +$$ + +By the induction assumption, $\forall x\in X$ $y\in Y$ we have that + +$$ +\ell_ {X} ^ {(\varphi , i)} (x) = \ell_ {Y} ^ {(\varphi , i)} (y) \mathrm {i f f} \mathfrak {l} _ {(\mathcal {X}, \ell_ {X})} ^ {(i)} (x) = \mathfrak {l} _ {(\mathcal {Y}, \ell_ {Y})} ^ {(i)} (y). +$$ + +This implies that + +$$ +\left(\ell_ {X} ^ {(\varphi , i)}\right) _ {\#} m _ {x} ^ {X} = \left(\ell_ {Y} ^ {(\varphi , i)}\right) _ {\#} m _ {y} ^ {Y} \mathrm {i f f} \left(\mathfrak {l} _ {(\mathcal {X}, \ell_ {X})} ^ {(i)}\right) _ {\#} m _ {x} ^ {X} = \left(\mathfrak {l} _ {(\mathcal {Y}, \ell_ {Y})} ^ {(i)}\right) _ {\#} m _ {y} ^ {Y} \mathrm {i f f} \mathfrak {l} _ {(\mathcal {X}, \ell_ {X})} ^ {(i + 1)} (x) = \mathfrak {l} _ {(\mathcal {Y}, \ell_ {Y})} ^ {(i + 1)} (y). +$$ + +Therefore, + +$$ +\ell_ {X} ^ {(\varphi , i + 1)} (x) = \ell_ {Y} ^ {(\varphi , i + 1)} (y) \text {i f f} \mathfrak {l} _ {(\mathcal {X}, \ell_ {X})} ^ {(i + 1)} (x) = \mathfrak {l} _ {(\mathcal {Y}, \ell_ {Y})} ^ {(i + 1)} (y) +$$ + +and we thus conclude the proof. + +# B.3.2. PROOF OF THEOREM 4.3 + +We first prove a relaxation of Theorem 4.3. Let + +$$ +\mathcal {N N} _ {k} ^ {c} (\mathbb {R} ^ {d}) := \{\psi \circ S _ {\varphi_ {k + 1}} \circ F _ {\varphi_ {k}} \circ \dots \circ F _ {\varphi_ {1}}: \forall \text {M L P s} \varphi_ {i}, i = 1, \dots , k + 1 \text {a n d c o n t i n u o u s} \psi . \}. +$$ + +Note that $\mathcal{NN}_k(\mathbb{R}^d) \subseteq \mathcal{NN}_k^c(\mathbb{R}^d)$ since the latter relaxes the assumption in $\mathcal{NN}_k(\mathbb{R}^d)$ that $\psi$ is a MLP. Then, we prove the following lemma: + +Lemma B.7. For any $k \in \mathbb{N}$ , let $\mathcal{K} \subseteq \mathcal{M}_k^L(\mathbb{R}^d)$ be any compact subspace. Then, $\overline{\mathcal{N}\mathcal{N}_k^c(\mathbb{R}^d)} = C(\mathcal{K},\mathbb{R})$ . + +The proof of the lemma is based on the following Stone-Weierstrass theorem. + +Lemma B.8 (Stone-Weierstrass). Let $X$ be a compact space. Let $\mathcal{F} \subseteq C(X, \mathbb{R})$ be a subalgebra containing the constant function 1. If moreover $\mathcal{F}$ separates points, then $\mathcal{F}$ is dense in $C(X, \mathbb{R})$ . + +$\mathcal{N}\mathcal{N}_k^c (\mathbb{R}^d)$ Contains 1. Given any choice of $\varphi_{i}\mathrm{s}$ , we let $\psi :\mathbb{R}^{d_{k + 1}}\to \mathbb{R}$ be the constant map 1. Then, the corresponding function $h\coloneqq \psi \circ S_{\varphi_{k + 1}}\circ F_{\varphi_k}\circ \dots F_{\varphi_1}\equiv 1\in \mathcal{N}\mathcal{N}_k(\mathbb{R}^d)$ . + +$\mathcal{N}\mathcal{N}_k^c (\mathbb{R}^d)$ Separates Points. This follows from item 2 in Proposition 4.1. + +$\mathcal{N}\mathcal{N}_k^c (\mathbb{R}^d)$ Is a Subalgebra. By Equation (19), Lemma B.4 and the continuity of $\psi$ , we have that $\mathcal{N}\mathcal{N}_k^c (\mathbb{R}^d)\subseteq C(\mathcal{K},\mathbb{R})$ . Next, we show that $\mathcal{N}\mathcal{N}_k^c (\mathbb{R}^d)$ is, in fact, a subalgebra of $C(\mathcal{K},\mathbb{R})$ . Given any constant $C$ and function $h = \psi \circ S_{\varphi_{k + 1}}\circ F_{\varphi_k}\circ \dots \circ F_{\varphi_1}\in \mathcal{N}\mathcal{N}_k^c (\mathbb{R}^d)$ , we have that + +$$ +C \cdot h = C \cdot \psi \circ S _ {\varphi_ {k + 1}} \circ F _ {\varphi_ {k}} \circ \dots F _ {\varphi_ {1}} = (C \cdot \psi) \circ S _ {\varphi_ {k + 1}} \circ F _ {\varphi_ {k}} \circ \dots F _ {\varphi_ {1}} \in \mathcal {N N} _ {k} ^ {c} (\mathbb {R} ^ {d}). +$$ + +Then, we show that the sum and the product of any $h_1 = \psi \circ S_{\varphi_{k+1}} \circ F_{\varphi_k} \circ \dots \circ F_{\varphi_1}$ and $h_2 = \tilde{\psi} \circ S_{\tilde{\varphi}_{k+1}} \circ F_{\tilde{\varphi}_k} \circ \dots \circ F_{\tilde{\varphi}_1}$ belong to $\mathcal{N}\mathcal{N}_k^c(\mathbb{R}^d)$ . We define + +$$ +\Phi_ {1} := \left(\varphi_ {1}, \tilde {\varphi} _ {1}\right): \mathbb {R} ^ {d} \to \mathbb {R} ^ {d _ {1}} \times \mathbb {R} ^ {\tilde {d} _ {1}}, +$$ + +and for each $2 \leq i \leq k + 1$ , we define + +$$ +\Phi_ {i} = \varphi_ {i} \times \tilde {\varphi} _ {i}: \mathbb {R} ^ {d _ {i - 1}} \times \mathbb {R} ^ {\tilde {d} _ {i - 1}} \to \mathbb {R} ^ {d _ {i}} \times \mathbb {R} ^ {\tilde {d} _ {i}}. +$$ + +It is not hard to see that for each $i = 1,\ldots ,k + 1$ , $\Phi_{i}$ is also a single-hidden-layer MLP with the activation function $\sigma$ . Indeed, if we write $\varphi_{i}(x) = C_{i}\sigma *(W_{i}x + b_{i})$ for any $x\in \mathbb{R}^{d_i}$ , and $\varphi_{i}(\tilde{x}) = \tilde{C}_{i}\sigma *(W_{i}\tilde{x} +\tilde{b}_{i})$ for any $\tilde{x}\in \mathbb{R}^{\tilde{d}_i}$ , then for any $\left( \begin{array}{c}x\\ \tilde{x} \end{array} \right)\in \mathbb{R}^{d_i}\times \mathbb{R}^{\tilde{d}_i}$ , we have that + +$$ +\Phi_ {1} (x) = \left( \begin{array}{c} C _ {1} \\ \tilde {C} _ {1} \end{array} \right) \sigma * \left(\left( \begin{array}{c} W _ {1} \\ \tilde {W} _ {1} \end{array} \right) x + \left( \begin{array}{c} b _ {1} \\ \tilde {b} _ {1} \end{array} \right)\right) +$$ + +and + +$$ +\Phi_ {i} \left(\left( \begin{array}{c} x \\ \tilde {x} \end{array} \right)\right) = \left( \begin{array}{c c} C _ {i} & 0 \\ 0 & \tilde {C} _ {i} \end{array} \right) \sigma * \left(\left( \begin{array}{c c} W _ {i} & 0 \\ 0 & \tilde {W} _ {i} \end{array} \right) \left( \begin{array}{c} x \\ \tilde {x} \end{array} \right) + \left( \begin{array}{c} b _ {i} \\ \tilde {b} _ {i} \end{array} \right)\right), \quad \forall i > 1. +$$ + +We let $P: \mathbb{R}^{d_{k+1}} \times \mathbb{R}^{\tilde{d}_{k+1}} \to \mathbb{R}^{d_{k+1}}$ and $\tilde{P}: \mathbb{R}^{d_{k+1}} \times \mathbb{R}^{\tilde{d}_{k+1}} \to \mathbb{R}^{\tilde{d}_{k+1}}$ denote projection maps. Then, we can rewrite $h_1$ and $h_2$ as follows. + +Claim 2. $h_1 = \psi \circ S_{\varphi_{k+1}} \circ F_{\varphi_k} \circ \dots \circ F_{\varphi_1} = \psi \circ P \circ S_{\Phi_{k+1}} \circ F_{\Phi_k} \circ \dots \circ F_{\Phi_1}$ and $h_2 = \tilde{\psi} \circ S_{\tilde{\varphi}_{k+1}} \circ F_{\tilde{\varphi}_k} \circ \dots \circ F_{\tilde{\varphi}_1} = \tilde{\psi} \circ \tilde{P} \circ S_{\Phi_{k+1}} \circ F_{\Phi_k} \circ \dots \circ F_{\Phi_1}$ . + +Proof of Claim 2. Recall notation from Equation (18). Then, we first prove inductively on $i = 1,\ldots ,k$ that for any $\mathcal{X}\in \mathcal{K}$ + +$$ +\ell_ {X} ^ {(\Phi , i)} (x) = \left(\ell_ {X} ^ {(\varphi , i)} (x), \ell_ {X} ^ {(\tilde {\varphi}, i)} (x)\right), \quad \forall x \in X. \tag {22} +$$ + +When $i = 1$ + +$$ +\ell_ {X} ^ {(\Phi , 1)} (x) = q _ {\Phi_ {1}} ((\ell_ {X}) _ {\#} m _ {x} ^ {X})) = (q _ {\varphi_ {1}} ((\ell_ {X}) _ {\#} m _ {x} ^ {X}), q _ {\tilde {\varphi} _ {1}} ((\ell_ {X}) _ {\#} m _ {x} ^ {X})) = (\ell_ {X} ^ {(\varphi , 1)} (x), \ell_ {X} ^ {(\tilde {\varphi}, 1)} (x)). +$$ + +Now, we assume that Equation (22) holds for some $i \geq 1$ . Then, for $i + 1$ , we have that + +$$ +\begin{array}{l} \ell_ {X} ^ {(\Phi , i + 1)} (x) = q _ {\Phi_ {i + 1}} \left(\left(\ell_ {X} ^ {(\Phi , i)}\right) _ {\#} m _ {x} ^ {X}\right) = q _ {\Phi_ {i + 1}} \left(\left(\left(\ell_ {X} ^ {(\varphi , i)}, \ell_ {X} ^ {(\tilde {\varphi}, i)}\right)\right) _ {\#} m _ {x} ^ {X}\right) \\ = q _ {\Phi_ {i + 1}} \left(\left(\ell_ {X} ^ {(\varphi , i)}\right) _ {\#} m _ {x} ^ {X} \otimes \left(\ell_ {X} ^ {(\tilde {\varphi}, i)}\right) _ {\#} m _ {x} ^ {X}\right) \\ = \left(q _ {\varphi_ {i + 1}} \left(\left(\ell_ {X} ^ {(\varphi , i)}\right) _ {\#} m _ {x} ^ {X}\right), q _ {\tilde {\varphi} _ {i + 1}} \left(\left(\ell_ {X} ^ {(\tilde {\varphi}, i)}\right) _ {\#} m _ {x} ^ {X}\right)\right) \\ = \left(\ell_ {X} ^ {(\varphi , i + 1)} (x), \ell_ {X} ^ {(\bar {\varphi}, i + 1)} (x)\right), \\ \end{array} +$$ + +which concludes the proof of Equation (22). + +Similarly, + +$$ +\begin{array}{l} S _ {\Phi_ {k + 1}} \circ F _ {\Phi_ {k}} \circ \dots F _ {\Phi_ {1}} ((\mathcal {X}, \ell_ {X})) = q _ {\Phi_ {k + 1}} \left(\left(\ell_ {X} ^ {(\Phi , k)}\right) _ {\#} \mu_ {X}\right) = q _ {\Phi_ {k + 1}} \left(\left(\left(\ell_ {X} ^ {(\varphi , k)}, \ell_ {X} ^ {(\tilde {\varphi}, k)}\right)\right) _ {\#} \mu_ {X}\right) \\ = q _ {\Phi_ {k + 1}} \left(\left(\ell_ {X} ^ {(\varphi , k)}\right) _ {\#} \mu_ {X} \otimes \left(\ell_ {X} ^ {(\varphi , k)}\right) _ {\#} \mu_ {X}\right) \\ = \left(q _ {\varphi_ {k + 1}} \left(\left(\ell_ {X} ^ {(\varphi , k)}\right) _ {\#} \mu_ {X}\right), q _ {\tilde {\varphi} _ {k + 1}} \left(\left(\ell_ {X} ^ {(\tilde {\varphi}, k)}\right) _ {\#} \mu_ {X}\right)\right) \\ = \left(S _ {\varphi_ {k + 1}} \circ F _ {\varphi_ {k}} \circ \dots F _ {\varphi_ {1}} ((\mathcal {X}, \ell_ {X})), S _ {\tilde {\varphi} _ {k + 1}} \circ F _ {\tilde {\varphi} _ {k}} \circ \dots F _ {\tilde {\varphi} _ {1}} ((\mathcal {X}, \ell_ {X}))\right). \\ \end{array} +$$ + +Therefore, $\psi \circ S_{\varphi_{k + 1}}\circ F_{\varphi_k}\circ \dots F_{\varphi_1} = \psi \circ P\circ S_{\Phi_{k + 1}}\circ F_{\Phi_k}\circ \dots F_{\Phi_1}$ and similarly, $\tilde{\psi}\circ S_{\tilde{\varphi}_{k + 1}}\circ F_{\tilde{\varphi}_k}\circ \dots F_{\tilde{\varphi}_1} =$ $\tilde{\psi}\circ \tilde{P}\circ S_{\Phi_{k + 1}}\circ F_{\Phi_k}\circ \dots F_{\Phi_1}$ + +Given these claims, we then have that + +$$ +\psi \circ S _ {\varphi_ {k + 1}} \circ F _ {\varphi_ {k}} \circ \dots F _ {\varphi_ {1}} + \tilde {\psi} \circ S _ {\tilde {\varphi} _ {k + 1}} \circ F _ {\tilde {\varphi} _ {k}} \circ \dots F _ {\tilde {\varphi} _ {1}} = (\psi \circ P + \tilde {\psi} \circ \tilde {P}) \circ S _ {\Phi_ {k + 1}} \circ F _ {\Phi_ {k}} \circ \dots F _ {\Phi_ {1}} \in \mathcal {N N} _ {k} ^ {c} (\mathbb {R} ^ {d}) +$$ + +and + +$$ +\psi \circ S _ {\varphi_ {k + 1}} \circ F _ {\varphi_ {k}} \circ \dots F _ {\varphi_ {1}} \times \tilde {\psi} \circ S _ {\tilde {\varphi} _ {k + 1}} \circ F _ {\tilde {\varphi} _ {k}} \circ \dots F _ {\tilde {\varphi} _ {1}} = (\psi \circ P \times \tilde {\psi} \circ \tilde {P}) \circ S _ {\Phi_ {k + 1}} \circ F _ {\Phi_ {k}} \circ \dots F _ {\Phi_ {1}} \in \mathcal {N N} _ {k} ^ {c} (\mathbb {R} ^ {d}). +$$ + +This concludes the proof of Lemma B.7. Now we finish proving Theorem 4.3 by showing that $\mathcal{N}_k(\mathbb{R}^d)$ is dense in $\mathcal{N}_k^c (\mathbb{R}^d)$ when restricted to the compact set $\mathcal{K}$ . Choose any $h = \psi \circ S_{\varphi_{k + 1}}\circ F_{\varphi_k}\circ \dots F_{\varphi_1}\in \mathcal{N}_k^c (\mathbb{R}^d)$ . By Equation (19) and Lemma B.4 again, we have that the map $S_{\varphi_{k + 1}}\circ F_{\varphi_k}\circ \dots F_{\varphi_1}:\mathcal{M}_k^L (\mathbb{R}^d)\to \mathbb{R}^{d_{k + 1}}$ is continuous. Hence, $\Re := S_{\varphi_{k + 1}}\circ F_{\varphi_k}\circ \dots F_{\varphi_1}(\mathcal{K})$ is a compact subspace of $\mathbb{R}^{d_{k + 1}}$ . Now, for any $\varepsilon >0$ , by the universal approximation theorem for MLP (Pinkus, 1999, Theorem 3.1), there exists a single-hidden-layer MLP $\tilde{\psi}:\mathbb{R}^{d_{k + 1}}\to \mathbb{R}$ such that $\sup_{x\in \Re}\left\| \tilde{\psi} (x) - \psi (x)\right\| < \varepsilon$ . If we let $\tilde{h} := \tilde{\psi}\circ S_{\varphi_{k + 1}}\circ F_{\varphi_k}\circ \dots F_{\varphi_1}$ , then $\tilde{h}\in \mathcal{N}_k(\mathbb{R}^d)$ and moreover, + +$$ +\sup _ {(\mathcal {X}, \ell_ {X}) \in \mathcal {K}} \left| \tilde {h} ((\mathcal {X}, \ell_ {X})) - h ((\mathcal {X}, \ell_ {X})) \right| < \varepsilon . +$$ + +This implies that $\mathcal{NN}_k(\mathbb{R}^d)$ is dense in $\mathcal{NN}_k^c (\mathbb{R}^d)$ when restricted to the compact set $\mathcal{K}$ . This concludes the proof. + +# B.4. Proofs from Section 5 + +# B.4.1. PROOF OF PROPOSITION 5.1 + +The proof is rather lengthy, and we start with some preliminary definitions and lemmas. + +Definition 14. Suppose two finite metric spaces $X$ and $Y$ are given. We say a sequence of measurable maps $\{(\nu_n)_{\bullet,\bullet} : X \times Y \to \mathcal{P}(X \times Y)\}_{n \in \mathbb{N}}$ weakly converges to $\nu_{\bullet,\bullet} : X \times Y \to \mathcal{P}(X \times Y)$ if $\{(\nu_n)_{x,y}\}_{n \in \mathbb{N}} \subseteq \mathcal{P}(X \times Y)$ weakly converges to $\nu_{x,y} \in \mathcal{P}(X \times Y)$ for all $(x,y) \in X \times Y$ . + +Lemma B.9. Suppose two finite metric spaces $X$ and $Y$ are given. If a sequence of probability measures $\{\gamma_n\}_{n\in \mathbb{N}}\subseteq \mathcal{P}(X\times Y)$ weakly converges to $\gamma \in \mathcal{P}(X\times Y)$ and a sequence of measurable maps $\{(\nu_{n})_{\bullet ,\bullet}:X\times Y\to \mathcal{P}(X\times Y)\}_{n\in \mathbb{N}}$ weakly converges to $\nu_{\bullet ,\bullet}:X\times Y\to \mathcal{P}(X\times Y)$ , then the sequence $\{(\nu_n)_{\bullet ,\bullet}\odot \gamma_n\}_{n\in \mathbb{N}}$ also weakly converges to $\nu_{\bullet ,\bullet}\odot \gamma$ + +Proof. Fix an arbitrary continuous bounded map $\phi : X \times Y \longrightarrow \mathbb{R}$ . Then, + +$$ +\begin{array}{l} \left| \int_ {X \times Y} \phi (x, y) (\nu_ {n}) _ {\bullet , \bullet} \odot \gamma_ {n} (d x \times d y) - \int_ {X \times Y} \phi (x, y) \nu_ {\bullet , \bullet} \odot \gamma (d x \times d y) \right| \\ \leq \left| \int_ {X \times Y} \phi (x, y) (\nu_ {n}) _ {\bullet , \bullet} \odot \gamma_ {n} (d x \times d y) - \int_ {X \times Y} \phi (x, y) \nu_ {\bullet , \bullet} \odot \gamma_ {n} (d x \times d y) \right| \\ + \left| \int_ {X \times Y} \phi (x, y) \nu_ {\bullet , \bullet} \odot \gamma_ {n} (d x \times d y) - \int_ {X \times Y} \phi (x, y) \nu_ {\bullet , \bullet} \odot \gamma (d x \times d y) \right|. \\ \end{array} +$$ + +By the weak convergence of $\{(\nu_n)_{\bullet ,\bullet}\}_{n\in \mathbb{N}}$ and by applying the bounded convergence theorem, we have that + +$$ +\int_ {X \times Y} \phi (x, y) (\nu_ {n}) _ {\bullet , \bullet} \odot \gamma_ {n} (d x \times d y) = \int_ {X \times Y} \int_ {X \times Y} \phi (x, y) (\nu_ {n}) _ {x ^ {\prime}, y ^ {\prime}} (d x \times d y) \gamma_ {n} (d x ^ {\prime} \times d y ^ {\prime}) +$$ + +converges to + +$$ +\int_ {X \times Y} \phi (x, y) \nu_ {\bullet , \bullet} \odot \gamma_ {n} (d x \times d y) = \int_ {X \times Y} \int_ {X \times Y} \phi (x, y) \nu_ {x ^ {\prime}, y ^ {\prime}} (d x \times d y) \gamma_ {n} (d x ^ {\prime} \times d y ^ {\prime}). +$$ + +Also, since $\{\gamma_n\}_{n\in \mathbb{N}}$ weakly converges to $\gamma$ , by finiteness of $X$ and $Y$ we have that + +$$ +\int_ {X \times Y} \phi (x, y) \nu_ {\bullet , \bullet} \odot \gamma_ {n} (d x \times d y) = \int_ {X \times Y} \int_ {X \times Y} \phi (x, y) \nu_ {x ^ {\prime}, y ^ {\prime}} (d x \times d y) \gamma_ {n} (d x ^ {\prime} \times d y ^ {\prime}) +$$ + +converges to + +$$ +\int_ {X \times Y} \phi (x, y) \nu_ {\bullet , \bullet} \odot \gamma (d x \times d y) = \int_ {X \times Y} \int_ {X \times Y} \phi (x, y) \nu_ {x ^ {\prime}, y ^ {\prime}} (d x \times d y) \gamma (d x ^ {\prime} \times d y ^ {\prime}). +$$ + +Hence, $\left|\int_{X\times Y}\phi (x,y)(\nu_n)_{\bullet ,\bullet}\odot \gamma_n(dx\times dy) - \int_{X\times Y}\phi (x,y)\nu_{\bullet ,\bullet}\odot \gamma (dx\times dy)\right|$ converges to zero as we required. This completes the proof. + +Lemma B.10. Suppose two MCMSs $(\mathcal{X},d_X)$ , $(\mathcal{Y},d_Y)$ , $k\geq 1$ , and a sequence of $k$ -step couplings $\{(\nu_n^{(k)})_{\bullet ,\bullet}\}_{n\in \mathbb{N}}\subseteq$ $\mathcal{C}^{(k)}(m_{\bullet}^{X},m_{\bullet}^{Y})$ are given. Then, there is a $k$ -step coupling $\nu_{\bullet ,\bullet}^{(k)}\in \mathcal{C}^{(k)}(m_{\bullet}^{X},m_{\bullet}^{Y})$ to which the sequence $\{(\nu_n^{(k)})_{\bullet ,\bullet}\}_{n\in \mathbb{N}}$ converges. + +Proof. The proof is by induction. $k = 1$ case is obvious since $\mathcal{C}(m_x^X, m_y^Y)$ is compact w.r.t. the weak topology (see Villani (2003, p.49)) for all $(x, y) \in X \times Y$ . + +Now, suppose the claim holds up to some $k \geq 1$ . Consider $k + 1$ case. By the definition, each $(k + 1)$ -step coupling $(\nu_{n}^{(k + 1)})_{\bullet ,\bullet} \in \mathcal{C}^{(k + 1)}\left(m_{\bullet}^{X},m_{\bullet}^{Y}\right)$ can be expressed in the following way: + +$$ +\left(\nu_ {n} ^ {(k + 1)}\right) _ {x, y} = \int_ {X \times Y} \left(\nu_ {n} ^ {(k)}\right) _ {x ^ {\prime}, y ^ {\prime}} \left(\mu_ {n} ^ {(1)}\right) _ {x, y} \left(d x ^ {\prime} \times d y ^ {\prime}\right) +$$ + +for all $(x,y)\in X\times Y$ for some $(\nu_{n}^{(k)})_{\bullet ,\bullet}\in \mathcal{C}^{(k)}(m_{\bullet}^{X},m_{\bullet}^{Y})$ and $(\mu_n^{(1)})_{\bullet ,\bullet}\in \mathcal{C}^{(1)}(m_{\bullet}^{X},m_{\bullet}^{Y})$ . Then, by the inductive assumption, there are $\nu_{\bullet ,\bullet}^{(k)}\in \mathcal{C}^{(k)}(m_{\bullet}^{X},m_{\bullet}^{Y})$ and $\mu_{\bullet ,\bullet}^{(1)}\in \mathcal{C}^{(1)}(m_{\bullet}^{X},m_{\bullet}^{Y})$ such that the sequence $\{(\nu_n^{(k)})_{\bullet ,\bullet}\}_{n\in \mathbb{N}}$ weakly converges to $\nu_{\bullet ,\bullet}^{(k)}$ , and the sequence $\{(\mu_n^{(1)})_{\bullet ,\bullet}\}_{n\in \mathbb{N}}$ weakly converges to $\mu_{\bullet ,\bullet}^{(1)}$ . Then, for each $(x,y)\in X\times Y$ + +$$ +\left(\nu_ {n} ^ {(k + 1)}\right) _ {x, y} = \int_ {X \times Y} \left(\nu_ {n} ^ {(k)}\right) _ {x ^ {\prime}, y ^ {\prime}} \left(\mu_ {n} ^ {(1)}\right) _ {x, y} \left(d x ^ {\prime} \times d y ^ {\prime}\right) = \left(\nu_ {n} ^ {(k)}\right) _ {\bullet , \bullet} \odot \left(\mu_ {n} ^ {(1)}\right) _ {x, y} +$$ + +weakly converges to + +$$ +\nu_ {x, y} ^ {(k + 1)} = \int_ {X \times Y} \nu_ {x ^ {\prime}, y ^ {\prime}} ^ {(k)} \mu_ {x, y} ^ {(1)} \left(d x ^ {\prime} \times d y ^ {\prime}\right) = \nu_ {\bullet , \bullet} ^ {(k)} \odot \mu_ {x, y} ^ {(1)} +$$ + +by Lemma B.9. This completes the proof. + +![](images/84776f4dd699abaecd8d56c05aee402dd4fdf26595285482cc17539d7337c40c.jpg) + +Lemma B.11 (Mémoli (2011, Lemma 10.3)). Let $(Z,d_Z)$ be a compact metric space and $\phi :Z\times Z\to \mathbb{R}$ be a Lipschitz map w.r.t. the $L^1$ metric on $Z\times Z$ : + +$$ +\hat {d} _ {Z \times Z} ((z _ {1}, z _ {2}), (z _ {1} ^ {\prime}, z _ {2} ^ {\prime})) := d _ {Z} (z _ {1}, z _ {1} ^ {\prime}) + d _ {Z} (z _ {2}, z _ {2} ^ {\prime}) f o r a l l (z _ {1}, z _ {2}), (z _ {1} ^ {\prime}, z _ {2} ^ {\prime}) \in Z \times Z. +$$ + +Also, for each $\gamma \in \mathcal{P}(Z)$ , we define a map $p_{\phi,\gamma}$ in the following way: + +$$ +\begin{array}{l} p _ {\phi , \gamma}: Z \longrightarrow \mathbb {R} \\ z \longmapsto \int_ {Z} \phi (z, z ^ {\prime}) \gamma (d z ^ {\prime}). \\ \end{array} +$$ + +If a sequence $\{\mu_n\}_{n\in \mathbb{N}}\subseteq \mathcal{P}(Z)$ weakly converges to $\mu$ , then $p_{\phi ,\mu_n}$ uniformly converges to $p_{\phi ,\mu}$ + +Corollary B.12. For any two MCMSSs $(\mathcal{X},d_X)$ $(\mathcal{Y},d_Y)$ , and $k\geq 1$ , there exist a coupling measure $\gamma \in \mathcal{C}(\mu_X,\mu_Y)$ and a $k$ -step coupling $\nu_{\bullet ,\bullet}^{(k)}\in \mathcal{C}^{(k)}(m_{\bullet}^{X},m_{\bullet}^{Y})$ such that + +$$ +d _ {\mathrm {G W}} ^ {(k)} \left(\left(\mathcal {X}, d _ {X}\right), \left(\mathcal {Y}, d _ {Y}\right)\right) = \operatorname {d i s} ^ {(k)} \left(\gamma , \nu_ {\bullet , \bullet} ^ {(k)}\right). +$$ + +Proof. First of all, we define $\phi : (X \times Y) \times (X \times Y) \to \mathbb{R}$ by sending any $((x, y), (x', y')) \in (X \times Y) \times (X \times Y)$ to $|d_X(x, x') - d_Y(y, y')|$ . + +By Definition 8, there are a sequence of coupling measures $\{\gamma_n\}_{n\in \mathbb{N}}\subseteq \mathcal{C}(\mu_X,\mu_Y)$ and a sequence of $k$ step couplings $\{(\nu_{n}^{(k)})_{\bullet ,\bullet}\}_{n\in \mathbb{N}}\subseteq \mathcal{C}^{(k)}(m_{\bullet}^{X},m_{\bullet}^{Y})$ such that + +$$ +\begin{array}{l} \operatorname {d i s} ^ {(k)} \left(\gamma , \left(\nu_ {n} ^ {(k)}\right) _ {\bullet , \bullet}\right) = \int_ {X \times Y} \int_ {X \times Y} \int_ {X \times Y} \left| d _ {X} \left(x, x ^ {\prime}\right) - d _ {Y} \left(y, y ^ {\prime}\right) \right| \left(\nu_ {n} ^ {(k)}\right) _ {x ^ {\prime \prime}, y ^ {\prime \prime}} \left(d x ^ {\prime} \times d y ^ {\prime}\right) \gamma_ {n} \left(d x ^ {\prime \prime} \times d y ^ {\prime \prime}\right) \gamma_ {n} (d x \times d y) \\ = \int_ {X \times Y} p _ {\phi , (\nu_ {n} ^ {(k)}) _ {\bullet , \bullet} \odot \gamma_ {n}} (x, y) \gamma_ {n} (d x \times d y) \\ \leq d _ {\mathrm {G W}} ^ {(k)} ((\mathcal {X}, d _ {X}), (\mathcal {Y}, d _ {Y})) + \frac {1}{n} \\ \end{array} +$$ + +for each $n\geq 1$ + +Now, since $\mathcal{C}(\mu_X,\mu_Y)$ is compact w.r.t. the weak topology (see p.49 of (Villani, 2003)), there is a coupling measure $\gamma \in \mathcal{C}(\mu_X,\mu_Y)$ such that $\gamma_{n}\to \gamma$ weakly. Also, by Lemma B.10, there is a $k$ -step coupling $\nu_{\bullet ,\bullet}^{(k)}\in \mathcal{C}^{(k)}\big(m_{\bullet}^{X},m_{\bullet}^{Y}\big)$ such that $(\nu_n^{(k)})_{\bullet ,\bullet}\rightarrow \nu_{\bullet ,\bullet}^{(k)}$ weakly. + +Now, let + +$$ +A _ {n} := \int_ {X \times Y} p _ {\phi , \nu_ {\bullet , \bullet} ^ {(k)} \odot \gamma} (x, y) \gamma_ {n} (d x \times d y) - \int_ {X \times Y} p _ {\phi , (\nu_ {n} ^ {(k)}) _ {\bullet , \bullet} \odot \gamma_ {n}} (x, y) \gamma_ {n} (d x \times d y), +$$ + +$$ +B _ {n} := \int_ {X \times Y} p _ {\phi , \nu_ {\bullet , \bullet} ^ {(k)} \odot \gamma} (x, y) \gamma (d x \times d y) - \int_ {X \times Y} p _ {\phi , \nu_ {\bullet , \bullet} ^ {(k)} \odot \gamma} (x, y) \gamma_ {n} (d x \times d y), +$$ + +$$ +C _ {n} := \int_ {X \times Y} p _ {\phi , \nu_ {\bullet , \bullet} ^ {(k)} \odot \gamma} (x, y) \gamma (d x \times d y) - \int_ {X \times Y} p _ {\phi , (\nu_ {n} ^ {(k)}) _ {\bullet , \bullet} \odot \gamma_ {n}} (x, y) \gamma_ {n} (d x \times d y). +$$ + +It is easy to see that $C_n = A_n + B_n$ and thus $|C_n| \leq |A_n| + |B_n|$ . By Lemma B.9 and Lemma B.11, $A_n$ converges to zero. Also, $B_n$ converges to zero by the assumption that $X, Y$ are finite and that $\gamma_n$ weakly converges to $\gamma$ . Hence, $C_n$ converges to zero. Therefore, + +$$ +\begin{array}{l} \operatorname {dis} ^ {(k)} \left(\gamma , \nu_ {\bullet , \bullet} ^ {(k)}\right) = \int_ {X \times Y} p _ {\phi , \nu_ {\bullet , \bullet} ^ {(k)} \odot \gamma} \gamma (d x \times d y) \\ = \lim _ {n \rightarrow \infty} \int_ {X \times Y} p _ {\phi , (\nu_ {n} ^ {(k)}) _ {\bullet , \bullet} \odot \gamma_ {n}} \gamma_ {n} (d x \times d y) \\ \leq d _ {\mathrm {G W}} ^ {(k)} \left(\left(\mathcal {X}, d _ {X}\right), \left(\mathcal {Y}, d _ {Y}\right)\right) \\ \end{array} +$$ + +Since we always have that $\mathrm{dis}^{(k)}\big(\gamma ,\nu_{\bullet ,\bullet}^{(k)}\big)\geq d_{\mathrm{GW}}^{(k)}((\mathcal{X},d_X),(\mathcal{Y},d_Y))$ , we conclude that + +$$ +\operatorname {d i s} ^ {(k)} \left(\gamma , \nu_ {\bullet , \bullet} ^ {(k)}\right) = d _ {\mathrm {G W}} ^ {(k)} \left(\left(\mathscr {X}, d _ {X}\right), \left(\mathscr {Y}, d _ {Y}\right)\right). +$$ + +Lemma B.13 (Gluing of $k$ -step couplings). Suppose three MCMSs $(\mathcal{X}, d_X), (\mathcal{Y}, d_Y), (\mathcal{Z}, d_Z)$ , $k \geq 1$ , and $k$ -step couplings $\mu_{\bullet, \bullet}^{(k)} \in \mathcal{C}^{(k)}(m_{\bullet}^X, m_{\bullet}^Z)$ , $\eta_{\bullet, \bullet}^{(k)} \in \mathcal{C}^{(k)}(m_{\bullet}^Z, m_{\bullet}^Y)$ are given. Then, there are probability measures $\pi_{\bullet, \bullet, \bullet}^{(k)}: X \times Y \times Z \to \mathcal{P}(X \times Y \times Z)$ and $k$ -step coupling $\nu_{\bullet, \bullet}^{(k)} \in \mathcal{C}^{(k)}(m_{\bullet}^X, m_{\bullet}^Y)$ such that $\nu_{x,y}^{(k)}, \mu_{x,z}^{(k)}$ , and $\eta_{z,y}^{(k)}$ are the marginals of $\pi_{x,y,z}^{(k)}$ for any $(x,y,z) \in X \times Y \times Z$ . + +Proof. The proof is by induction on $k$ . First, consider $k = 1$ case. Fix an arbitrary $(x,y,z) \in X \times Y \times Z$ . Let + +$$ +\pi_ {x, y, z} ^ {(1)} (x ^ {\prime}, y ^ {\prime}, z ^ {\prime}) := \left\{ \begin{array}{l l} \frac {\mu_ {x , z} ^ {(1)} (x ^ {\prime} , z ^ {\prime}) \mu_ {z , y} ^ {(1)} (z ^ {\prime} , y ^ {\prime})}{m _ {z} ^ {Z} (z ^ {\prime})}, & m _ {z} ^ {Z} (z ^ {\prime}) > 0 \\ 0, & m _ {z} ^ {Z} (z ^ {\prime}) = 0 \end{array} \right. +$$ + +for each $(x', y', z') \in X \times Y \times Z$ . Observe that + +$$ +\begin{array}{l} \sum_ {(x ^ {\prime}, y ^ {\prime}, z ^ {\prime}) \in X \times Y \times Z} \pi_ {x, y, z} ^ {(1)} (x ^ {\prime}, y ^ {\prime}, z ^ {\prime}) = \sum_ {z ^ {\prime} \in Z, m _ {z} ^ {Z} (z ^ {\prime}) > 0} \sum_ {y ^ {\prime} \in Y} \frac {\mu_ {z , y} ^ {(1)} (z ^ {\prime} , y ^ {\prime})}{m _ {z} ^ {Z} (z ^ {\prime})} \sum_ {x ^ {\prime} \in X} \mu_ {x, z} ^ {(1)} (x ^ {\prime}, z ^ {\prime}) \\ = \sum_ {z ^ {\prime} \in Z, m _ {z} ^ {Z} (z ^ {\prime}) > 0} \sum_ {y ^ {\prime} \in Y} \frac {\mu_ {z , y} ^ {(1)} \left(z ^ {\prime} , y ^ {\prime}\right)}{m _ {z} ^ {Z} (z ^ {\prime})} \cdot m _ {z} ^ {Z} \left(z ^ {\prime}\right) = \sum_ {z ^ {\prime} \in Z, m _ {z} ^ {Z} (z ^ {\prime}) > 0} \sum_ {y ^ {\prime} \in Y} \mu_ {z, y} ^ {(1)} \left(z ^ {\prime}, y ^ {\prime}\right) = 1. \\ \end{array} +$$ + +Hence, $\pi_{x,y,z}^{(1)}\in \mathcal{P}(X\times Y\times Z)$ . Now, let $\nu_{x,y}^{(1)}(x',y')\coloneqq \sum_{z'\in Z}\pi_{x,y,z}^{(1)}(x',y',z')$ for each $(x^{\prime},y^{\prime})\in X\times Y$ . Then, for fixed $x^{\prime}\in X$ + +$$ +\begin{array}{l} \sum_ {y ^ {\prime} \in Y} \nu_ {x, y} ^ {(1)} \left(x ^ {\prime}, y ^ {\prime}\right) = \sum_ {y ^ {\prime} \in Y} \sum_ {z ^ {\prime} \in Z, m _ {z} ^ {Z} \left(z ^ {\prime}\right) > 0} \frac {\mu_ {x , z} ^ {(1)} \left(x ^ {\prime} , z ^ {\prime}\right) \mu_ {z , y} ^ {(1)} \left(z ^ {\prime} , y ^ {\prime}\right)}{m _ {z} ^ {Z} \left(z ^ {\prime}\right)} = \sum_ {z ^ {\prime} \in Z, m _ {z} ^ {Z} \left(z ^ {\prime}\right) > 0} \frac {\mu_ {x , z} ^ {(1)} \left(x ^ {\prime} , z ^ {\prime}\right)}{m _ {z} ^ {Z} \left(z ^ {\prime}\right)} \sum_ {y ^ {\prime} \in Y} \mu_ {z, y} ^ {(1)} \left(z ^ {\prime}, y ^ {\prime}\right) \\ = \sum_ {z ^ {\prime} \in Z, m _ {z} ^ {Z} (z ^ {\prime}) > 0} \frac {\mu_ {x , z} ^ {(1)} \left(x ^ {\prime} , z ^ {\prime}\right)}{m _ {z} ^ {Z} \left(z ^ {\prime}\right)} \cdot m _ {z} ^ {Z} \left(z ^ {\prime}\right) = \sum_ {z ^ {\prime} \in Z, m _ {z} ^ {Z} \left(z ^ {\prime}\right) > 0} \mu_ {x, z} ^ {(1)} \left(x ^ {\prime}, z ^ {\prime}\right) = m _ {x} ^ {X} \left(x ^ {\prime}\right). \\ \end{array} +$$ + +Similarly, for each fixed $y' \in Y$ , one can prove $\sum_{x' \in X} \nu_{x,y}^{(1)}(x', y') = m_y^Y(y')$ . Hence, indeed $\nu_{\bullet,\bullet}^{(1)} \in \mathcal{C}^{(1)}\big(m_\bullet^X, m_\bullet^Y\big)$ . + +Now, suppose the claim holds up to some $k \geq 1$ . We consider $k + 1$ case. For a $(k + 1)$ -step coupling $\mu_{\bullet,\bullet}^{(k + 1)} \in \mathcal{C}^{(k + 1)}(m_{\bullet}^{X}, m_{\bullet}^{Z})$ , there are $k$ -step coupling $\mu_{\bullet,\bullet}^{(k)} \in \mathcal{C}^{(k)}(m_{\bullet}^{X}, m_{\bullet}^{Z})$ and 1-step coupling $\mu_{\bullet,\bullet}^{(1)} \in \mathcal{C}^{(1)}(m_{\bullet}^{X}, m_{\bullet}^{Z})$ such that + +$$ +\mu_ {x, z} ^ {(k + 1)} \left(x ^ {\prime}, z ^ {\prime}\right) = \sum_ {\left(x ^ {\prime \prime}, z ^ {\prime \prime}\right) \in X \times Y} \mu_ {x ^ {\prime \prime}, z ^ {\prime \prime}} ^ {(k)} \left(x ^ {\prime}, z ^ {\prime}\right) \mu_ {x, z} ^ {(1)} \left(x ^ {\prime \prime}, z ^ {\prime \prime}\right) +$$ + +for any $(x,z),(x^{\prime},z^{\prime})\in X\times Z$ . Similarly, for a $(k + 1)$ -step coupling $\eta_{\bullet ,\bullet}^{(k + 1)}\in \mathcal{C}^{(k + 1)}(m_{\bullet}^{Z},m_{\bullet}^{Y})$ , there are $k$ step coupling $\eta_{\bullet ,\bullet}^{(k)}\in \mathcal{C}^{(k)}(m_{\bullet}^{Z},m_{\bullet}^{Y})$ and 1-step coupling $\eta_{\bullet ,\bullet}^{(1)}\in \mathcal{C}^{(1)}(m_{\bullet}^{Z},m_{\bullet}^{Y})$ such that + +$$ +\eta_ {z, y} ^ {(k + 1)} (z ^ {\prime}, y ^ {\prime}) = \sum_ {(z ^ {\prime \prime}, y ^ {\prime \prime}) \in Z \times Y} \eta_ {z ^ {\prime \prime}, y ^ {\prime \prime}} ^ {(k)} (z ^ {\prime}, y ^ {\prime}) \eta_ {z, y} ^ {(1)} (z ^ {\prime \prime}, y ^ {\prime \prime}) +$$ + +for any $(z,y),(z^{\prime},y^{\prime})\in Z\times Y$ + +Because of the inductive assumption, we have $\pi_{\bullet,\bullet,\bullet}^{(k)}: X \times Y \times Z \to \mathcal{P}(X \times Y \times Z)$ and $\pi_{\bullet,\bullet,\bullet}^{(1)}: X \times Y \times Z \to \mathcal{P}(X \times Y \times Z)$ satisfying the claim. Then, let + +$$ +\pi_{x,y,z}^{(k + 1)}(x^{\prime},y^{\prime},z^{\prime}):= \sum_{(x^{\prime \prime},y^{\prime \prime},z^{\prime \prime})\in X\times Y\times Z}\pi_{x^{\prime \prime},y^{\prime \prime},z^{\prime \prime}}^{(k)}(x^{\prime},y^{\prime},z^{\prime}) \pi_{x,y,z}^{(1)}(x^{\prime \prime},y^{\prime \prime},z^{\prime \prime}), +$$ + +and let $\nu_{x,y}^{(k + 1)}(x',y')\coloneqq \sum_{z'\in Z}\pi_{x,y,z}^{(k + 1)}(x',y',z')$ . Then, we have that + +$$ +\begin{array}{l} \nu_ {x, y} ^ {(k + 1)} (x ^ {\prime}, y ^ {\prime}) = \sum_ {z ^ {\prime} \in Z} \sum_ {(x ^ {\prime \prime}, y ^ {\prime \prime}, z ^ {\prime \prime}) \in X \times Y \times Z} \pi_ {x ^ {\prime \prime}, y ^ {\prime \prime}, z ^ {\prime \prime}} ^ {(k)} (x ^ {\prime}, y ^ {\prime}, z ^ {\prime}) \pi_ {x, y, z} ^ {(1)} (x ^ {\prime \prime}, y ^ {\prime \prime}, z ^ {\prime \prime}) \\ = \sum_ {\left(x ^ {\prime \prime}, y ^ {\prime \prime}, z ^ {\prime \prime}\right) \in X \times Y \times Z} \pi_ {x, y, z} ^ {(1)} \left(x ^ {\prime \prime}, y ^ {\prime \prime}, z ^ {\prime \prime}\right) \sum_ {z ^ {\prime} \in Z} \pi_ {x ^ {\prime \prime}, y ^ {\prime \prime}, z ^ {\prime \prime}} ^ {(k)} \left(x ^ {\prime}, y ^ {\prime}, z ^ {\prime}\right) \\ = \sum_ {(x ^ {\prime \prime}, y ^ {\prime \prime}, z ^ {\prime \prime}) \in X \times Y \times Z} \pi_ {x, y, z} ^ {(1)} (x ^ {\prime \prime}, y ^ {\prime \prime}, z ^ {\prime \prime}) \nu_ {x ^ {\prime \prime}, y ^ {\prime \prime}} ^ {(k)} (x ^ {\prime}, y ^ {\prime}) \\ = \sum_ {(x ^ {\prime \prime}, y ^ {\prime \prime}) \in X \times Y} \nu_ {x ^ {\prime \prime}, y ^ {\prime \prime}} ^ {(k)} (x ^ {\prime}, y ^ {\prime}) \sum_ {z ^ {\prime \prime} \in Z} \pi_ {x, y, z} ^ {(1)} (x ^ {\prime \prime}, y ^ {\prime \prime}, z ^ {\prime \prime}) \\ = \sum_ {(x ^ {\prime \prime}, y ^ {\prime \prime}) \in X \times Y} \nu_ {x ^ {\prime \prime}, y ^ {\prime \prime}} ^ {(k)} (x ^ {\prime}, y ^ {\prime}) \nu_ {x, y} ^ {(k)} (x ^ {\prime \prime}, y ^ {\prime \prime}). \\ \end{array} +$$ + +Since the choice of $(x,y,z)\in x\times y\times z$ is arbitrary, now we have $\nu_{\bullet ,\bullet}^{(k + 1)}\in \mathcal{C}^{(k + 1)}\big(m_{\bullet}^{X},m_{\bullet}^{Y}\big)$ as we required. Hence, this concludes the proof. + +Now we start to prove Proposition 5.1. + +First of all, $d_{\mathrm{GW}}^{\mathrm{MCMS}}$ is obviously symmetric. + +Next, we prove that $d_{\mathrm{GW}}^{\mathrm{MCMS}}((\mathcal{X}, d_X), (\mathcal{Y}, d_Y)) = 0$ happens if and only if $(\mathcal{X}, d_X)$ and $(\mathcal{Y}, d_Y)$ are isomorphic. To do this, we first provide a precise definition of MCMS isomorphism. + +Definition 15. Two MCMSs $(\mathcal{X},d_X)$ and $(\mathcal{Y},d_Y)$ are said to be isomorphic if there exists an isometry $\psi :X\to Y$ such that $\psi_{\#}\mu_{X} = \mu_{Y}$ and $\psi_{\#}m_x^X = m_{\psi (x)}^Y$ for all $x\in X$ + +When are $(\mathcal{X},d_X)$ and $(\mathcal{Y},d_Y)$ are isomorphic, without loss of generality, we simply assume that $(\mathcal{Y},d_Y) = (\mathcal{X},d_X)$ . + +Claim 3. Let $\Delta_{\mu_X}$ denote the diagonal coupling between $\mu_X$ and itself, i.e., + +$$ +\Delta_ {\mu_ {X}} = \sum_ {x \in X} \mu_ {X} (x) \delta_ {(x, x)}. +$$ + +Then, for each $k \in \mathbb{N}$ , there exists $\nu_{\bullet,\bullet}^{(k)} \in \mathcal{C}^{(k)}(m_{\bullet}^{X}, m_{\bullet}^{X})$ such that $\Delta_{\mu_X} = \nu_{\bullet,\bullet}^{(k)} \odot \Delta_{\mu_X}$ . + +Assume the claim for now. Then, we have that for each $k\in \mathbb{N}$ + +$$ +\begin{array}{l} d _ {\mathrm {G W}} ^ {(k)} \left(\left(\mathcal {X}, d _ {X}\right), \left(\mathcal {Y}, d _ {Y}\right)\right) \leq \operatorname {d i s} \left(\Delta_ {\mu_ {X}}, \nu_ {\bullet , \bullet} ^ {(k)}\right) \\ = \int_ {X \times X} \int_ {X \times X} | d _ {X} (x, x ^ {\prime}) - d _ {X} (x _ {1}, x _ {1} ^ {\prime}) | \nu_ {\bullet , \bullet} ^ {(k)} \odot \Delta_ {\mu_ {X}} (d x ^ {\prime} \times d x _ {1} ^ {\prime}) \Delta_ {\mu_ {X}} (d x \times d x _ {1}) \\ = \int_ {X \times X} | d _ {X} (x, x ^ {\prime}) - d _ {X} (x, x ^ {\prime}) | \mu_ {X} (d x) \mu_ {X} (d x ^ {\prime}) = 0. \\ \end{array} +$$ + +Hence, $d_{\mathrm{GW}}^{\mathrm{MCMS}}((\mathcal{X},d_X),(\mathcal{Y},d_Y)) = 0,$ + +Proof of Claim 3. We prove inductively on $k \in \mathbb{N}$ that there exists $\nu_{\bullet,\bullet}^{(k)} \in \mathcal{C}^{(k)}(\mathcal{X},\mathcal{X})$ so that $\nu_{x,x}^{(k)} = \Delta_{m_x^X,\otimes k}$ is the diagonal coupling between $m_x^{X,\otimes k}$ and itself for each $x \in X$ . + +For $k = 1$ , we define $\nu_{\bullet,\bullet}^{(1)}$ as follows: + +$$ +\nu_ {x, x ^ {\prime}} ^ {(1)} := \left\{ \begin{array}{l l} m _ {x} ^ {X} \otimes m _ {x ^ {\prime}} ^ {X} & x \neq x ^ {\prime} \\ \Delta_ {m _ {x} ^ {X}} & x = x ^ {\prime} \end{array} \right.. +$$ + +Since $X$ is finite, obviously we have that $\nu_{\bullet,\bullet}^{(1)} \in \mathcal{C}^{(1)}(\mathcal{X},\mathcal{X})$ . + +Assume that the statement holds for some $k \geq 0$ . Now, for $k + 1$ , by the induction assumption, there exists $\nu_{\bullet,\bullet}^{(k)} \in \mathcal{C}^{(k)}(\mathcal{X},\mathcal{X})$ so that $\nu_{x,x}^{(k)} = \Delta_{m_x^X,\otimes k}$ . We define $\nu_{\bullet,\bullet}^{(k + 1)} \in \mathcal{C}^{(k + 1)}(\mathcal{X},\mathcal{X})$ as follows + +$$ +\nu_ {x, x ^ {\prime}} ^ {(k + 1)} := \int_ {X \times X} \nu_ {x _ {1}, x _ {1} ^ {\prime}} ^ {(k)} \nu_ {x, x ^ {\prime}} ^ {(1)} (d x _ {1} \times d x _ {1} ^ {\prime}), \forall x, x ^ {\prime} \in X. +$$ + +Now, for any $x \in X$ , we have that + +$$ +\begin{array}{l} \nu_ {x, x} ^ {(k + 1)} = \int_ {X \times X} \nu_ {x _ {1}, x _ {1} ^ {\prime}} ^ {(k)} \nu_ {x, x} ^ {(1)} \left(d x _ {1} \times d x _ {1} ^ {\prime}\right) \\ = \sum_ {x ^ {\prime} \in X} m _ {x} ^ {X} \left(x ^ {\prime}\right) \sum_ {x ^ {\prime \prime} \in X} m _ {x ^ {\prime}} ^ {X, \otimes k} \left(x ^ {\prime \prime}\right) \delta_ {\left(x ^ {\prime \prime}, x ^ {\prime \prime}\right)} \\ = \sum_ {x ^ {\prime \prime} \in X} \left(\sum_ {x ^ {\prime} \in X} m _ {x ^ {\prime}} ^ {X, \otimes k} \left(x ^ {\prime \prime}\right) m _ {x} ^ {X} \left(x ^ {\prime}\right)\right) \delta_ {\left(x ^ {\prime \prime}, x ^ {\prime \prime}\right)} \\ = \sum_ {x ^ {\prime \prime} \in X} m _ {x} ^ {X, \otimes (k + 1)} \left(x ^ {\prime \prime}\right) \delta_ {\left(x ^ {\prime \prime}, x ^ {\prime \prime}\right)} \\ = \Delta_ {m _ {x} ^ {X, \otimes (k + 1)}}. \\ \end{array} +$$ + +Now, we turn to prove the claim. For each $k \in \mathbb{N}$ , let $\nu_{\bullet,\bullet}^{(k)} \in \mathcal{C}^{(k)}(\mathcal{X},\mathcal{X})$ be such that $\nu_{x,x}^{(k)} = \Delta_{m_x^{X,\otimes k}}$ is the diagonal + +coupling between $m_x^{X,\otimes k}$ and itself for each $x\in X$ . Then, + +$$ +\begin{array}{l} \int_ {X \times X} \nu_ {x, x ^ {\prime}} ^ {(k)} \Delta_ {\mu_ {X}} (d x \times d x ^ {\prime}) = \sum_ {x \in X} \nu_ {x, x} ^ {(k)} \mu_ {X} (x) \\ = \sum_ {x, x ^ {\prime} \in X} m _ {x} ^ {X, \otimes k} \left(x ^ {\prime}\right) \delta_ {\left(x ^ {\prime}, x ^ {\prime}\right)} \mu_ {X} (x) \\ = \sum_ {x ^ {\prime} \in X} \left(\sum_ {x \in X} m _ {x} ^ {X, \otimes k} \left(x ^ {\prime}\right) \mu_ {X} (x)\right) \delta_ {\left(x ^ {\prime}, x ^ {\prime}\right)} \\ = \sum_ {x ^ {\prime} \in X} \mu_ {X} \left(x ^ {\prime}\right) \delta_ {\left(x ^ {\prime}, x ^ {\prime}\right)} \\ = \Delta_ {\mu_ {X}}. \\ \end{array} +$$ + +![](images/eccf3ce31db365f4711f0443cc71e70e01676a0c556119a39396f4a48c5c66da.jpg) + +Now, we assume that $d_{\mathrm{GW}}^{\mathrm{MCMS}}((\mathcal{X},d_X),(\mathcal{Y},d_Y)) = 0$ for some MCMSs $(\mathcal{X},d_X)$ and $(\mathcal{Y},d_Y)$ . Then, $d_{\mathrm{GW}}^{(1)}((\mathcal{X},d_X),(\mathcal{Y},d_Y)) = 0$ . By Corollary B.12, there exist optimal $\nu_{\bullet,\bullet} \in \mathcal{C}^{(1)}(m_{\bullet}^{X},m_{\bullet}^{Y})$ and $\gamma \in \mathcal{C}(\mu_X,\mu_Y)$ such that + +$$ +\int_ {X \times Y} \int_ {X \times Y} \int_ {X \times Y} | d _ {X} (x, x ^ {\prime}) - d _ {Y} (y, y ^ {\prime}) | \nu_ {x ^ {\prime \prime}, y ^ {\prime \prime}} (d x ^ {\prime} \times d y ^ {\prime}) \gamma (d x ^ {\prime \prime} \times d y ^ {\prime \prime}) \gamma (d x \times d y) = 0. +$$ + +We let $\gamma' \coloneqq \nu_{\bullet, \bullet} \odot \gamma$ . Notice that $\gamma' \in \mathcal{C}(\mu_X, \mu_Y)$ . Since $X$ and $Y$ are finite, we rewrite the integral above as finite sums: + +$$ +\sum_ {(x, y) \in X \times Y} \sum_ {(x ^ {\prime}, y ^ {\prime}) \in X \times Y} | d _ {X} (x, x ^ {\prime}) - d _ {Y} (y, y ^ {\prime}) | \gamma^ {\prime} (x ^ {\prime}, y ^ {\prime}) \gamma (x, y) = 0. +$$ + +By Claim 1, there exists an isometry $\phi : X \to Y$ such that + +$$ +\{(x, \phi (x)): x \in X \} = \operatorname {s u p p} (\gamma) = \operatorname {s u p p} \left(\gamma^ {\prime}\right). +$$ + +Since $\gamma, \gamma' \in \mathcal{C}(\mu_X, \mu_Y)$ , this immediately implies that for any Borel subset $A \subseteq X$ , one has + +$$ +\mu_ {X} (A) = \gamma (A \times Y) = \gamma (A \times \phi (A)) = \gamma (X \times \phi (A)) = \mu_ {Y} (\phi (A)). +$$ + +Hence, $\phi_{\#}\mu_X = \mu_Y$ . Moreover, we have that + +$$ +\gamma = \gamma^ {\prime} = \sum_ {x \in X} \mu_ {X} (x) \delta_ {(x, \phi (x))}. +$$ + +Then, by the definition of $\gamma^\prime$ , we have that + +$$ +\begin{array}{l} \sum_ {x \in X} \mu_ {X} (x) \delta_ {(x, \phi (x))} = \gamma^ {\prime} = \sum_ {x _ {1} \in X, y _ {1} \in Y} \gamma (x _ {1}, y _ {1}) \nu_ {x _ {1}, y _ {1}} \\ = \sum_ {x \in X, y \in Y} \left(\sum_ {x _ {1} \in X, y _ {1} \in Y} \gamma (x _ {1}, y _ {1}) \nu_ {x _ {1}, y _ {1}} (x, y)\right) \delta_ {(x, y)} \\ = \sum_ {x \in X, y \in Y} \left(\sum_ {x _ {1} \in X} \gamma (x _ {1}, \phi (x _ {1})) \nu_ {x _ {1}, \phi (x _ {1})} (x, y)\right) \delta_ {(x, y)} \\ = \sum_ {x \in X, y \in Y} \left(\sum_ {x _ {1} \in X} \mu_ {X} \left(x _ {1}\right) \nu_ {x _ {1}, \phi \left(x _ {1}\right)} (x, y)\right) \delta_ {(x, y)}. \\ \end{array} +$$ + +By comparing coefficients for the Dirac delta measures above, one has that + +$$ +\nu_ {x _ {1}, \phi (x _ {1})} (x, y) = \left\{ \begin{array}{l l} 0, & \text {i f} y \neq \phi (x) \\ \nu_ {x _ {1}, \phi (x _ {1})} (x, y), & \text {i f} y = \phi (x) \end{array} \right. +$$ + +for any $x_1 \in X$ . This means that $\{(x, \phi(x)) : x \in X\} \supseteq \operatorname{supp}[\nu_{x_1, \phi(x_1)}]$ . Since $\nu_{x_1, \phi(x_1)} \in \mathcal{C}\left(m_{x_1}^X, m_{\phi(x_1)}^Y\right)$ , for any Borel subset $A \subseteq X$ , one has that + +$$ +m _ {x _ {1}} ^ {X} (A) = \nu_ {x _ {1}, \phi (x _ {1})} (A \times Y) = \nu_ {x _ {1}, \phi (x _ {1})} (A \times \phi (A)) = \nu_ {x _ {1}, \phi (x _ {1})} (X \times \phi (A)) = m _ {\phi (x _ {1})} ^ {Y} (\phi (A)). +$$ + +By an argument similar to the one for proving $\phi_{\#}\mu_X = \mu_Y$ , we have that + +$$ +\phi_ {\#} m _ {x _ {1}} ^ {X} = m _ {\phi (x _ {1})} ^ {Y}, \forall x _ {1} \in X. +$$ + +Therefore, $(\mathcal{X},d_X)$ is isomorphic to $(\mathcal{Y},d_Y)$ . + +Finally, we prove that $d_{\mathrm{GW}}^{\mathrm{MCMS}}$ satisfies the triangle inequality. It suffices to prove that for each $k \in \mathbb{N}$ , $d_{\mathrm{GW}}^{(k)}$ satisfies the triangle inequality. Fix arbitrary three MCMSs $(\mathcal{X}, d_X)$ , $(\mathcal{Y}, d_Y)$ , and $(\mathcal{Z}, d_Z)$ . Recall the notation $\Gamma_{X,Y}$ which defines a function sending $(x, y, x', y') \in X \times Y \times X \times Y$ to $|d_X(x, x') - d_Y(y, y')|$ . Then, for any $x, x' \in X$ , $y, y' \in Y$ , and $z, z' \in Z$ , we obviously have that + +$$ +\Gamma_ {X, Y} (x, y, x ^ {\prime}, y ^ {\prime}) \leq \Gamma_ {X, Z} (x, z, x ^ {\prime}, z ^ {\prime}) + \Gamma_ {Z, Y} (z, y, z ^ {\prime}, y ^ {\prime}). +$$ + +Now, fix arbitrary $\mu_{\bullet,\bullet}^{(k)} \in \mathcal{C}^{(k)}(m_{\bullet}^{X}, m_{\bullet}^{Z})$ , $\gamma_{X,Z} \in \mathcal{C}(\mu_X, \mu_Z)$ , $\eta_{\bullet,\bullet}^{(k)} \in \mathcal{C}^{(k)}(m_{\bullet}^{Z}, m_{\bullet}^{Y})$ , and $\gamma_{Z,Y} \in \mathcal{C}(\mu_Z, \mu_Y)$ . Then, by the Gluing Lemma (see Villani (2003, Lemma 7.6)), there exists a probability measure $\alpha \in \mathcal{P}(X \times Y \times Z)$ with marginals $\gamma_{X,Z}$ and $\gamma_{Z,Y}$ on $X \times Z$ and $Z \times Y$ , respectively. Let $\gamma_{X,Y}$ be the marginal of $\pi$ on $X \times Y$ which belongs to $\mathcal{C}(\mu_X, \mu_Y)$ . By Lemma B.13, there exists $\nu_{\bullet,\bullet}^{(k)} \in \mathcal{C}^{(k)}(m_{\bullet}^{X}, m_{\bullet}^{Y})$ such that $\nu_{x,y}^{(k)}, \mu_{x,z}^{(k)}, \eta_{z,y}^{(k)}$ are the marginals of some probability measure $\pi_{x,y,z}^{(k)} \in \mathcal{P}(X \times Y \times Z)$ for any $x,y,z \in X \times Y \times Z$ . Then, because of the triangle inequality for $L^1$ -norm, + +$$ +\begin{array}{l} d _ {\mathrm {G W}} ^ {(k)} ((\mathcal {X}, d _ {X}), (\mathcal {Y}, d _ {Y})) \\ \leq \int_ {X \times Y} \int_ {X \times Y} \int_ {X \times Y} \Gamma_ {X, Y} (x, y, x ^ {\prime}, y ^ {\prime}) \nu_ {x ^ {\prime \prime}, y ^ {\prime \prime}} ^ {(k)} (d x ^ {\prime} \times d y ^ {\prime}) \gamma_ {X, Y} (d x ^ {\prime \prime} \times d y ^ {\prime \prime}) \gamma_ {X, Y} (d x \times d y) \\ = \int_ {X \times Y \times Z} \int_ {X \times Y \times Z} \int_ {X \times Y \times Z} \Gamma_ {X, Y} (x, y, x ^ {\prime}, y ^ {\prime}) \pi_ {x ^ {\prime \prime}, y ^ {\prime \prime}, z ^ {\prime \prime}} ^ {(k)} (d x ^ {\prime} \times d y ^ {\prime} \times d z ^ {\prime}) \alpha (d x ^ {\prime \prime} \times d y ^ {\prime \prime} \times d z ^ {\prime \prime}) \alpha (d x \times d y \times d z) \\ \leq \int_ {X \times Y \times Z} \int_ {X \times Y \times Z} \int_ {X \times Y \times Z} \Gamma_ {X, Z} (x, z, x ^ {\prime}, z ^ {\prime}) \pi_ {x ^ {\prime \prime}, y ^ {\prime \prime}, z ^ {\prime \prime}} ^ {(k)} (d x ^ {\prime} \times d y ^ {\prime} \times d z ^ {\prime}) \alpha (d x ^ {\prime \prime} \times d y ^ {\prime \prime} \times d z ^ {\prime \prime}) \alpha (d x \times d y \times d z) \\ + \int_ {X \times Y \times Z} \int_ {X \times Y \times Z} \int_ {X \times Y \times Z} \Gamma_ {Z, Y} (z, y, z ^ {\prime}, y ^ {\prime}) \pi_ {x ^ {\prime \prime}, y ^ {\prime \prime}, z ^ {\prime \prime}} ^ {(k)} (d x ^ {\prime} \times d y ^ {\prime} \times d z ^ {\prime}) \alpha (d x ^ {\prime \prime} \times d y ^ {\prime \prime} \times d z ^ {\prime \prime}) \alpha (d x \times d y \times d z) \\ = \int_ {X \times Z} \int_ {X \times Z} \int_ {X \times Z} \Gamma_ {X, Z} (x, z, x ^ {\prime}, z ^ {\prime}) \mu_ {x ^ {\prime \prime}, z ^ {\prime \prime}} ^ {(k)} (d x ^ {\prime} \times d z ^ {\prime}) \gamma_ {X, Z} (d x ^ {\prime \prime} \times d z ^ {\prime \prime}) \gamma_ {X, Z} (d x \times d z) \\ + \int_ {Z \times Y} \int_ {Z \times Y} \int_ {Z \times Y} \Gamma_ {Z, Y} (z, y, z ^ {\prime}, y ^ {\prime}) \eta_ {z ^ {\prime \prime}, y ^ {\prime \prime}} ^ {(k)} (d x ^ {\prime} \times d y ^ {\prime} \times d z ^ {\prime}) \gamma_ {Z, Y} (d z ^ {\prime \prime} \times d y ^ {\prime \prime}) \gamma_ {Z, Y} (d z \times d y). \\ \end{array} +$$ + +Since the choice of $\mu_{\bullet,\bullet}^{(k)}, \gamma_{X,Z}, \eta_{\bullet,\bullet}^{(k)}, \gamma_{Z,Y}$ are arbitrary, by taking the infimum one concludes that + +$$ +d _ {\mathrm {G W}} ^ {(k)} ((\mathcal {X}, d _ {X}), (\mathcal {Y}, d _ {Y})) \leq d _ {\mathrm {G W}} ^ {(k)} ((\mathcal {X}, d _ {X}), (\mathcal {Z}, d _ {Z})) + d _ {\mathrm {G W}} ^ {(k)} ((\mathcal {Z}, d _ {Z}), (\mathcal {Y}, d _ {Y})) +$$ + +as we required. Then, we have that $d_{\mathrm{GW}}^{\mathrm{MCMS}} \coloneqq \sup_{k \geq 0} d_{\mathrm{GW}}^{(k)}$ satisfies the triangle inequality. + +# B.4.2. PROOF OF THE CLAIM IN EXAMPLE 3 + +The proof is based on the following lemma. + +Lemma B.14. Given two MMSs $\mathbf{X}$ and $\mathbf{Y}$ , for their corresponding MCMSs $\mathcal{M}(\mathbf{X})$ and $\mathcal{M}(\mathbf{Y})$ we have that + +1. $\mathcal{C}^{(k + 1)}\big(m_{\bullet}^{X},m_{\bullet}^{Y}\big)\subseteq \mathcal{C}^{(k)}\big(m_{\bullet}^{X},m_{\bullet}^{Y}\big)$ for all $k\geq 1$ +2. For any coupling measure $\gamma \in \mathcal{C}(\mu_X,\mu_Y)$ , the constant map $\nu_{\bullet ,\bullet}\equiv \gamma$ belongs to $\mathcal{C}^{(k)}\big(m_{\bullet}^{X},m_{\bullet}^{Y}\big)$ for all $k\geq 1$ . + +Proof. We first prove item 1. Since $m_x^X = \mu_X$ and $m_y^Y = \mu_Y$ for all $x\in X$ and $y\in Y$ , observe that $m_x^{X,\otimes k} = \mu_X$ and $m_y^{Y,\otimes k} = \mu_Y$ for all $x\in X, y\in Y$ , and $k\geq 1$ . Hence, $\mathcal{C}^{(k)}\big(m_{\bullet}^{X},m_{\bullet}^{Y}\big)\subseteq \mathcal{C}^{(1)}\big(m_{\bullet}^{X},m_{\bullet}^{Y}\big)$ for all $k\geq 1$ by Lemma A.4. Now, for any $k\geq 2$ , fix an arbitrary $\nu_{\bullet ,\bullet}^{(k + 1)}\in \mathcal{C}^{(k + 1)}\big(m_{\bullet}^{X},m_{\bullet}^{Y}\big)$ . Then, by the definition, there are $\nu_{\bullet ,\bullet}^{(k)}\in \mathcal{C}^{(k)}\big(m_{\bullet}^{X},m_{\bullet}^{Y}\big)$ and $\nu_{\bullet ,\bullet}^{(1)}\in \mathcal{C}^{(1)}\big(m_{\bullet}^{X},m_{\bullet}^{Y}\big) = \mathcal{C}(\mu_X,\mu_Y)$ such that + +$$ +\nu_ {x, y} ^ {(k + 1)} = \int_ {X \times Y} \nu_ {x ^ {\prime}, y ^ {\prime}} ^ {(k)} \nu_ {x, y} ^ {(1)} \left(d x ^ {\prime} \times d y ^ {\prime}\right) +$$ + +for all $(x,y)\in X\times Y$ . Again, by the definition, there are $\nu_{\bullet ,\bullet}^{(k - 1)}\in \mathcal{C}^{(k)}\left(m_{\bullet}^{X},m_{\bullet}^{Y}\right)$ and $\mu_{\bullet ,\bullet}^{(1)}\in \mathcal{C}^{(1)}\left(m_{\bullet}^{X},m_{\bullet}^{Y}\right) = \mathcal{C}(\mu_X,\mu_Y)$ such that + +$$ +\nu_ {x, y} ^ {(k)} = \int_ {X \times Y} \nu_ {x ^ {\prime}, y ^ {\prime}} ^ {(k - 1)} \mu_ {x, y} ^ {(1)} \left(d x ^ {\prime} \times d y ^ {\prime}\right) +$$ + +for all $(x,y)\in X\times Y$ . Therefore, + +$$ +\begin{array}{l} \nu_ {x, y} ^ {(k + 1)} = \int_ {X \times Y} \int_ {X \times Y} \nu_ {x ^ {\prime \prime}, y ^ {\prime \prime}} ^ {(k - 1)} \mu_ {x ^ {\prime}, y ^ {\prime}} ^ {(1)} (d x ^ {\prime \prime} \times d y ^ {\prime \prime}) \nu_ {x, y} ^ {(1)} (d x ^ {\prime} \times d y ^ {\prime}) \\ = \int_ {X \times Y} \nu_ {x ^ {\prime \prime}, y ^ {\prime \prime}} ^ {(k - 1)} \pi_ {x, y} ^ {(1)} \left(d x ^ {\prime \prime} \times d y ^ {\prime \prime}\right) \\ \end{array} +$$ + +for all $(x,y)\in X\times Y$ where $\pi_{\bullet ,\bullet}^{(1)}\coloneqq \int_{X\times Y}\mu_{x',y'}^{(1)}\nu_{\bullet ,\bullet}^{(1)}(dx'\times dy')\in \mathcal{C}^{(2)}\big(m_{\bullet}^{X},m_{\bullet}^{Y}\big)\subseteq \mathcal{C}^{(1)}\big(m_{\bullet}^{X},m_{\bullet}^{Y}\big).$ Hence, $\nu_{\bullet ,\bullet}^{(k + 1)}\in$ $\mathcal{C}^{(k)}\big(m_{\bullet}^{X},m_{\bullet}^{Y}\big)$ by the definition. The first item is proved. + +Next, we prove the second item. The proof is by induction on $k$ . Fix a coupling measure $\gamma \in \mathcal{C}(\mu_X,\mu_Y)$ and the constant map $\nu_{\bullet ,\bullet}\equiv \gamma$ . Obviously, $\nu_{\bullet ,\bullet}\in \mathcal{C}^{(1)}\big(m_{\bullet}^{X},m_{\bullet}^{Y}\big)$ . Then, we also have that the constant map $\mu_X\otimes \mu_Y\in \mathcal{C}^{(1)}\big(m_{\bullet}^{X},m_{\bullet}^{Y}\big)$ . Now, suppose the claim holds up to some $k\geq 1$ . Consider $k + 1$ case. Observe that + +$$ +\gamma = \int_ {X \times Y} \gamma \mu_ {X} \otimes \mu_ {Y} (d x ^ {\prime} \times d y ^ {\prime}) +$$ + +where $\gamma \in \mathcal{C}^{(k)}\big(m_{\bullet}^{X},m_{\bullet}^{Y}\big)$ by the inductive assumption and the constant map $\mu_X\otimes \mu_Y\in \mathcal{C}^{(1)}\big(m_{\bullet}^{X},m_{\bullet}^{Y}\big)$ . Hence, $\gamma \in \mathcal{C}^{(k + 1)}\big(m_{\bullet}^{X},m_{\bullet}^{Y}\big)$ by the definition. This completes the proof. + +Now, fix arbitrary couplings $\gamma, \gamma' \in \mathcal{C}(\mu_X, \mu_Y)$ and consider the constant map $\nu_{\bullet,\bullet} \equiv \gamma'$ . Then, by the second item of Lemma B.14, $\nu_{\bullet,\bullet} \in \mathcal{C}^{(k)}(m_{\bullet}^X, m_{\bullet}^Y)$ . Hence, + +$$ +\begin{array}{l} d _ {\mathrm {G W}} ^ {(k)} (\mathcal {M} (\mathbf {X}), \mathcal {M} (\mathbf {Y})) \leq \int_ {X \times Y} \int_ {X \times Y} \int_ {X \times Y} | d _ {X} (x, x ^ {\prime}) - d _ {Y} (y, y ^ {\prime}) | \nu_ {x ^ {\prime \prime}, y ^ {\prime \prime}} (d x ^ {\prime} \times d y ^ {\prime}) \gamma (d x ^ {\prime \prime} \times d y ^ {\prime \prime}) \gamma (d x \times d y) \\ = \int_ {X \times Y} \int_ {X \times Y} \int_ {X \times Y} | d _ {X} (x, x ^ {\prime}) - d _ {Y} (y, y ^ {\prime}) | \gamma^ {\prime} (d x ^ {\prime} \times d y ^ {\prime}) \gamma (d x ^ {\prime \prime} \times d y ^ {\prime \prime}) \gamma (d x \times d y) \\ = \int_ {X \times Y} \int_ {X \times Y} | d _ {X} (x, x ^ {\prime}) - d _ {Y} (y, y ^ {\prime}) | \gamma^ {\prime} (d x ^ {\prime} \times d y ^ {\prime}) \gamma (d x \times d y). \\ \end{array} +$$ + +Since the choice of $\gamma, \gamma'$ are arbitrary, one concludes that $d_{\mathrm{GW}}^{(k)}((\mathcal{M}(\mathbf{X}), \mathcal{M}(\mathbf{Y})) \leq d_{\mathrm{GW}}^{\mathrm{bi}}(\mathbf{X}, \mathbf{Y})$ . + +For the reverse direction, choose arbitrary $\gamma \in \mathcal{C}(\mu_X,\mu_Y)$ and a $k$ -step coupling $\nu_{\bullet ,\bullet}^{(k)}\in \mathcal{C}^{(k)}\big(m_{\bullet}^{X},m_{\bullet}^{Y}\big)$ . Let + +$$ +\gamma^ {\prime} := \int_ {X \times Y} \nu_ {x ^ {\prime \prime}, y ^ {\prime \prime}} ^ {(k)} \gamma (d x ^ {\prime \prime} \times d y ^ {\prime \prime}). +$$ + +Then, + +$$ +\begin{array}{l} \int_ {X \times Y} \int_ {X \times Y} \int_ {X \times Y} | d _ {X} (x, x ^ {\prime}) - d _ {Y} (y, y ^ {\prime}) | \nu_ {x ^ {\prime \prime}, y ^ {\prime \prime}} ^ {(k)} (d x ^ {\prime} \times d y ^ {\prime}) \gamma (d x ^ {\prime \prime} \times d y ^ {\prime \prime}) \gamma (d x \times d y) \\ = \int_ {X \times Y} \int_ {X \times Y} | d _ {X} (x, x ^ {\prime}) - d _ {Y} (y, y ^ {\prime}) | \gamma^ {\prime} (d x ^ {\prime} \times d y ^ {\prime}) \gamma (d x \times d y) \\ \geq d _ {\mathrm {G W}} ^ {\mathrm {b i}} (\mathbf {X}, \mathbf {Y}). \\ \end{array} +$$ + +Since the choice of $\gamma$ and $\nu_{\bullet,\bullet}^{(k)}$ are arbitrary, one concludes that $d_{\mathrm{GW}}^{(k)}(\mathcal{M}(\mathbf{X}),\mathcal{M}(\mathbf{Y})) \geq d_{\mathrm{GW}}^{\mathrm{bi}}(\mathbf{X},\mathbf{Y})$ . + +Hence, $d_{\mathrm{GW}}^{(k)}(\mathcal{M}(\mathbf{X}),\mathcal{M}(\mathbf{Y})) = d_{\mathrm{GW}}^{\mathrm{bi}}(\mathbf{X},\mathbf{Y})$ as we required. + +# B.4.3. PROOF OF PROPOSITION 5.2 + +For any $x \in X$ , we let $\ell_{X}^{x} \coloneqq d_{X}(x, \bullet)$ . For $i = 1, \ldots, k$ , let $\mathfrak{l}_{x}^{(i)}: X \to \mathcal{P}^{\circ i}(\mathbb{R})$ be the shorthand for the $i$ th WL measure hierarchy $\mathfrak{l}_{(\mathcal{X}, \ell_{X}^{x})}^{(k)}$ generated from the label $d_{X}(x, \bullet)$ . We similarly define $\ell_{Y}^{y}$ and $\mathfrak{l}_{y}^{(i)}: Y \to \mathcal{P}^{\circ i}(\mathbb{R})$ for any $y \in Y$ and each $i = 1, \ldots, k$ . + +For any $\nu_{\bullet,\bullet}^{(k)} \in \mathcal{C}^{(k)}\left(m_{\bullet}^{X}, m_{\bullet}^{Y}\right)$ , there exist $(\nu_i)_{\bullet,\bullet} \in \mathcal{C}^{(1)}\left(m_{\bullet}^{X}, m_{\bullet}^{Y}\right)$ for $i = 1, \ldots, k$ such that + +$$ +\nu_ {x, y} ^ {(k)} = \int_ {X \times Y} \dots \int_ {X \times Y} (\nu_ {k}) _ {x _ {k - 1}, y _ {k - 1}} (\nu_ {k - 1}) _ {x _ {k - 2}, y _ {k - 2}} (d x _ {k - 1} \times d y _ {k - 1}) \dots (\nu_ {1}) _ {x, y} (d x _ {1} \times d y _ {1}) +$$ + +for any $x\in X$ and $y\in Y$ . Hence, for any $\gamma \in \mathcal{C}(\mu_X,\mu_Y)$ , we have that + +$$ +\begin{array}{l} \int_ {X \times Y} \int_ {X \times Y} \int_ {X \times Y} | d _ {X} (x, x ^ {\prime}) - d _ {Y} (y, y ^ {\prime}) | \nu_ {x ^ {\prime \prime}, y ^ {\prime \prime}} ^ {(k)} (d x ^ {\prime} \times d y ^ {\prime}) \gamma (d x ^ {\prime \prime} \times d y ^ {\prime \prime}) \gamma (d x \times d y) \\ = \int_ {X \times Y} \dots \int_ {X \times Y} | d _ {X} (x, x ^ {\prime}) - d _ {Y} (y, y ^ {\prime}) | (\nu_ {k}) _ {x _ {k - 1}, y _ {k - 1}} (d x ^ {\prime} \times d y ^ {\prime}) \dots (\nu_ {1}) _ {x ^ {\prime \prime}, y ^ {\prime \prime}} (d x _ {1} \times d y _ {1}) \gamma (d x ^ {\prime \prime} \times d y ^ {\prime \prime}) \gamma (d x \times d y) \\ \geq \int_ {X \times Y} \dots \int_ {X \times Y} d _ {\mathrm {W}} \Big ((\ell_ {X} ^ {x}) _ {\#} m _ {x _ {k - 1}} ^ {X}, (\ell_ {Y} ^ {y}) _ {\#} m _ {y _ {k - 1}} ^ {Y} \Big) \\ (\nu_ {k - 1}) _ {x _ {k - 2}, y _ {k - 2}} (d x _ {k - 1} \times d y _ {k - 1}) \dots (\nu_ {1}) _ {x ^ {\prime \prime}, y ^ {\prime \prime}} (d x _ {1} \times d y _ {1}) \gamma (d x ^ {\prime \prime} \times d y ^ {\prime \prime}) \gamma (d x \times d y) \\ = \int_ {X \times Y} \dots \int_ {X \times Y} d _ {\mathrm {W}} \left(\mathfrak {l} _ {x} ^ {(1)} \left(x _ {k - 1}\right), \mathfrak {l} _ {y} ^ {(1)} \left(y _ {k - 1}\right)\right) \\ \left(\nu_ {k - 1}\right) _ {x _ {k - 2}, y _ {k - 2}} \left(d x _ {k - 1} \times d y _ {k - 1}\right) \dots \left(\nu_ {1}\right) _ {x ^ {\prime \prime}, y ^ {\prime \prime}} \left(d x _ {1} \times d y _ {1}\right) \gamma \left(d x ^ {\prime \prime} \times d y ^ {\prime \prime}\right) \gamma \left(d x \times d y\right) \\ \geq \dots \\ \geq \int_ {X \times Y} \int_ {X \times Y} d _ {\mathrm {W}} \left(\mathfrak {l} _ {x} ^ {(k)} \left(x ^ {\prime \prime}\right), \mathfrak {l} _ {y} ^ {(k)} \left(y ^ {\prime \prime}\right)\right) \gamma \left(d x ^ {\prime \prime} \times d y ^ {\prime \prime}\right) \gamma (d x \times d y) \\ \geq \int_ {X \times Y} d _ {\mathrm {W L}} ^ {(k)} \left(\left(\mathcal {X}, \ell_ {X} ^ {x}\right), \left(\mathcal {Y}, \ell_ {Y} ^ {y}\right)\right) \gamma (d x \times d y) \\ \end{array} +$$ + +Therefore, + +$$ +\begin{array}{l} d _ {\mathrm {G W}} ^ {(k)} \left(\left(\mathcal {X}, d _ {X}\right), \left(\mathcal {Y}, d _ {Y}\right)\right) \\ = \inf_{\gamma \in \mathcal{C}(\mu_{X},\mu_{Y}),\nu_{\bullet ,\bullet}^{(k)}\in \mathcal{C}^{(k)}(m_{\bullet}^{X},m_{\bullet}^{Y})}\int \limits_{X\times Y}\int \limits_{X\times Y}\int \limits_{X\times Y}|d_{X}(x,x^{\prime}) - d_{Y}(y,y^{\prime})|\nu_{x^{\prime \prime},y^{\prime \prime}}^{(k)}(dx^{\prime}\times dy^{\prime})\gamma (dx^{\prime \prime}\times dy^{\prime \prime})\gamma (dx\times dy) \\ \geq \inf_{\gamma \in \mathcal{C}(\mu_{X},\mu_{Y})}\int \limits_{X\times Y}d_{\mathrm{WL}}^{(k)}((\mathcal{X},\ell_{X}^{x}),(\mathcal{Y},\ell_{Y}^{y}))\gamma (dx\times dy). \\ \end{array} +$$ + +# B.4.4. PROOF OF THE STATEMENT IN REMARK 5.3 + +We first recall the third lower bound (TLB) from (Mémoli, 2011): + +$$ +\operatorname {T L B} (\mathbf {X}, \mathbf {Y}) := \inf _ {\gamma \in \mathcal {C} (\mu_ {X}, \mu_ {Y})} \int_ {X \times Y} \left(\inf _ {\gamma^ {\prime} \in \mathcal {C} (\mu_ {X}, \mu_ {Y})} \int_ {X \times Y} | d _ {X} (x, x ^ {\prime}) - d _ {Y} (y, y ^ {\prime}) | \gamma^ {\prime} (d x ^ {\prime} \times d y ^ {\prime})\right) \gamma (d x \times d y). +$$ + +where we omit the $\frac{1}{2}$ factor from (Mémoli, 2011) for simplicity of presentation. + +We adopt notation from the previous section. Notice that + +$$ +\inf_{\gamma^{\prime}\in \mathcal{C}(\mu_{X},\mu_{Y})}\int \limits_{X\times Y}|d_{X}(x,x^{\prime}) - d_{Y}(y,y^{\prime})|\gamma^{\prime}(dx^{\prime}\times dy^{\prime}) = d_{\mathrm{WL}}^{(1)}((\mathscr{X},\ell_{X}^{x}),(\mathscr{Y},\ell_{Y}^{y})). +$$ + +We hence have that + +$$ +\mathrm {T L B} (\mathbf {X}, \mathbf {Y}) = \inf _ {\gamma \in \mathcal {C} (\mu_ {X}, \mu_ {Y})} \int_ {X \times Y} d _ {\mathrm {W L}} ^ {(1)} ((\mathcal {X}, \ell_ {X} ^ {x}), (\mathcal {Y}, \ell_ {Y} ^ {y})) \gamma (d x \times d y). +$$ + +For any $k\in \mathbb{N}$ , we show that + +$$ +\operatorname {T L B} (\mathbf {X}, \mathbf {Y}) = \inf _ {\gamma \in \mathcal {C} (\mu_ {X}, \mu_ {Y})} \int_ {X \times Y} d _ {\mathrm {W L}} ^ {(k)} ((\mathcal {X}, \ell_ {X} ^ {x}), (\mathcal {Y}, \ell_ {Y} ^ {y})) \gamma (d x \times d y) +$$ + +by the lemma below. + +Lemma B.15. For any $k\in \mathbb{N}$ we have that $d_{\mathrm{WL}}^{(k)}((\mathcal{X},\ell_X^x),(\mathcal{Y},\ell_Y^y)) = d_{\mathrm{WL}}^{(1)}((\mathcal{X},\ell_X^x),(\mathcal{Y},\ell_Y^y))$ + +Proof. By item 2 in Lemma B.14 and Theorem A.7, we have that + +$$ +\begin{array}{l} d _ {\mathrm {W L}} ^ {(k)} \left(\left(\mathcal {X}, \ell_ {X} ^ {x}\right), \left(\mathcal {Y}, \ell_ {Y} ^ {y}\right)\right) = \inf _ {\gamma^ {\prime} \in \mathcal {C} ^ {(k)} \left(\mu_ {X}, \mu_ {Y}\right)} \int_ {X \times Y} \left| d _ {X} \left(x, x ^ {\prime}\right) - d _ {Y} \left(y, y ^ {\prime}\right) \right| \gamma^ {\prime} \left(d x ^ {\prime} \times d y ^ {\prime}\right) \\ = \inf _ {\nu_ {\bullet , \bullet} \in \mathcal {C} ^ {(k)} \left(m _ {\bullet} ^ {X}, m _ {\bullet} ^ {Y}\right), \mu \in \mathcal {C} \left(\mu_ {X}, \mu_ {Y}\right)} \int_ {X \times Y} \int_ {X \times Y} | d _ {X} (x, x ^ {\prime}) - d _ {Y} (y, y ^ {\prime}) | \nu_ {x _ {1}, y _ {1}} (d x ^ {\prime} \times d y ^ {\prime}) \mu (d x _ {1} \times d y _ {1}) \\ \leq \inf _ {\mu \in \mathcal {C} (\mu_ {X}, \mu_ {Y})} \int_ {X \times Y} \int_ {X \times Y} | d _ {X} (x, x ^ {\prime}) - d _ {Y} (y, y ^ {\prime}) | \mu (d x ^ {\prime} \times d y ^ {\prime}) \mu (d x _ {1} \times d y _ {1}) \\ = \inf _ {\mu \in \mathcal {C} (\mu_ {X}, \mu_ {Y})} \int_ {X \times Y} | d _ {X} (x, x ^ {\prime}) - d _ {Y} (y, y ^ {\prime}) | \mu (d x ^ {\prime} \times d y ^ {\prime}) \\ = d _ {\mathrm {W L}} ^ {(1)} \left(\left(\mathcal {X}, \ell_ {X} ^ {x}\right), \left(\mathcal {Y}, \ell_ {Y} ^ {y}\right)\right). \\ \end{array} +$$ + +By Proposition 3.1, we conclude that $d_{\mathrm{WL}}^{(k)}((\mathcal{X},\ell_X^x),(\mathcal{Y},\ell_Y^y)) = d_{\mathrm{WL}}^{(1)}((\mathcal{X},\ell_X^x),(\mathcal{Y},\ell_Y^y))$ + +![](images/176480bdf7385a734a840631e617b423ae4e7f88fc405f778f349c54e357b8f5.jpg) + +# B.4.5. PROOF OF THE STATEMENT IN EXAMPLE 4 + +Given $\mathcal{X}$ and $\mathcal{Y}$ , we have for any $\gamma \in \mathcal{C}(\mu_X, \mu_Y)$ and $\nu_{\bullet,\bullet}^{(k)}$ that + +$$ +\begin{array}{l} \int_ {X \times Y} \int_ {X \times Y} | \operatorname {e c c} _ {X} (x ^ {\prime}) - \operatorname {e c c} _ {Y} (y ^ {\prime})) | \nu_ {x, y} ^ {(k)} (d x ^ {\prime} \times d y ^ {\prime}) \gamma (d x \times d y) \\ = \int_ {X \times Y} \int_ {X \times Y} \left| \int_ {X} d _ {X} \left(x ^ {\prime}, x ^ {\prime \prime}\right) \mu_ {X} \left(d x ^ {\prime \prime}\right) - \int_ {Y} d _ {Y} \left(y ^ {\prime}, y ^ {\prime \prime}\right) \mu_ {Y} \left(y ^ {\prime \prime}\right) \right| v _ {x, y} ^ {(k)} \left(d x ^ {\prime} \times d y ^ {\prime}\right) \gamma (d x \times d y) \\ = \int_ {X \times Y} \int_ {X \times Y} \left| \int_ {X \times Y} d _ {X} \left(x ^ {\prime}, x ^ {\prime \prime}\right) \gamma \left(d x ^ {\prime \prime} \times d y ^ {\prime \prime}\right) - \int_ {X \times Y} d _ {Y} \left(y ^ {\prime}, y ^ {\prime \prime}\right) \gamma \left(d x ^ {\prime \prime} \times d y ^ {\prime \prime}\right) \right| \nu_ {x, y} ^ {(k)} \left(d x ^ {\prime} \times d y ^ {\prime}\right) \gamma (d x \times d y) \\ \leq \int_ {X \times Y} \int_ {X \times Y} \int_ {X \times Y} | d _ {X} (x ^ {\prime}, x ^ {\prime \prime}) - d _ {Y} (y ^ {\prime}, y ^ {\prime \prime}) | \nu_ {x, y} ^ {(k)} (d x ^ {\prime} \times d y ^ {\prime}) \gamma (d x \times d y) \gamma (d x ^ {\prime \prime} \times d y ^ {\prime \prime}). \\ \end{array} +$$ + +Hence, we conclude that $\mathrm{ecc}_{\bullet}$ is stable. + +# B.4.6. PROOF OF PROPOSITION 5.4 + +By Theorem A.7 we have that + +$$ +\begin{array}{l} d _ {\mathrm {W L}} ^ {(k)} \left(\left(\mathcal {X}, \ell_ {X}\right), \left(\mathcal {Y}, \ell_ {Y}\right)\right) = \inf _ {\gamma^ {(k)} \in \mathcal {C} ^ {(k)} \left(\mu_ {X}, \mu_ {Y}\right)} \int_ {X \times Y} d _ {Z} \left(\ell_ {X} (x), \ell_ {Y} (y)\right) \gamma^ {(k)} (d x \times d y) \\ = \inf _ {\gamma \in \mathcal {C} (\mu_ {X}, \mu_ {Y}), \nu_ {\bullet , \bullet} ^ {(k)} \in \mathcal {C} ^ {(k)} (m _ {\bullet} ^ {X}, m _ {\bullet} ^ {Y})} \int_ {X \times Y} \int_ {X \times Y} d _ {Z} (\ell_ {X} (x ^ {\prime}), \ell_ {Y} (y ^ {\prime})) \nu_ {x, y} ^ {(k)} (d x ^ {\prime} \times d y ^ {\prime}) \gamma (d x \times d y) \\ \leq \inf_{\substack{\gamma \in \mathcal{C}(\mu_{X},\mu_{Y}),\nu_{\bullet ,\bullet}^{(k)}\in \mathcal{C}^{(k)}(m_{\bullet}^{X},m_{\bullet}^{Y})}}\operatorname{dis}^{(k)}\bigl(\gamma ,\nu_{\bullet ,\bullet}^{(k)}\bigr) \\ = d _ {\mathrm {G W}} ^ {(k)} \left(\left(\mathscr {X}, d _ {X}\right), \left(\mathscr {Y}, d _ {Y}\right)\right). \\ \end{array} +$$ + +The inequality follows from the fact that $\ell_{\bullet}$ is stable. Hence we conclude the proof. + +Table 4. SVM classification accuracy. Let $f_{1}(G,v) = \deg_{G}(v)$ , $f_{2}(G,v) = \frac{1}{|V_{G}|} + \deg_{G}(v)$ . For $d_{\mathrm{WL}}^{(k)}$ and $d_{\mathrm{WLLB}}$ , we show SVM classification accuracies using both the indefinite kernel as well as with a KSVM (Loosli et al., 2015). + +
METHODMUTAGPROTEINSPTC-FMPTC-MRIMDB-BIMDB-MCOX2
d(1)WL, f187.7 ± 6.271.7 ± 3.357.6 ± 6.455.5 ± 4.574.5 ± 4.151.3 ± 3.078.1 ± 0.8
d(2)WL, f189.9 ± 6.471.3 ± 3.359.3 ± 3.754.9 ± 6.375.0 ± 3.051.4 ± 3.478.1 ± 0.8
d(3)WL, f187.6 ± 8.872.6 ± 3.159.0 ± 3.757.8 ± 7.974.9 ± 5.151.6 ± 4.078.1 ± 0.8
d(4)WL, f187.7 ± 4.172.4 ± 4.162.1 ± 3.956.7 ± 3.775.9 ± 2.751.4 ± 3.278.1 ± 0.8
d(1)WL, f1, KSVM88.3 ± 4.672.1 ± 2.661.0 ± 3.952.9 ± 7.675.6 ± 5.151.4 ± 4.877.5 ± 2.8
d(2)WL, f1, KSVM87.8 ± 5.772.8 ± 2.458.1 ± 5.056.9 ± 5.874.5 ± 3.451.4 ± 4.177.9 ± 1.0
d(3)WL, f1, KSVM88.8 ± 6.872.6 ± 3.761.3 ± 4.655.2 ± 6.175.0 ± 3.851.8 ± 3.878.7 ± 1.7
d(4)WL, f1, KSVM87.2 ± 5.573.5 ± 2.358.1 ± 6.353.4 ± 6.373.3 ± 3.751.2 ± 3.277.7 ± 1.3
d(1)WL, f287.3 ± 8.271.1 ± 3.258.7 ± 7.655.2 ± 5.574.1 ± 4.150.5 ± 4.578.1 ± 0.8
d(2)WL, f286.2 ± 7.473.5 ± 2.860.2 ± 5.354.0 ± 6.475.0 ± 4.551.4 ± 3.978.1 ± 0.8
d(3)WL, f288.8 ± 5.474.5 ± 2.961.6 ± 5.359.2 ± 6.475.4 ± 5.450.8 ± 4.077.0 ± 1.5
d(4)WL, f287.2 ± 5.873.9 ± 3.560.4 ± 5.154.3 ± 7.775.7 ± 3.750.8 ± 3.278.1 ± 0.8
d(1)WL, f2, KSVM88.8 ± 7.974.3 ± 3.363.3 ± 2.360.1 ± 6.376.2 ± 4.151.5 ± 3.378.1 ± 0.8
d(2)WL, f2, KSVM87.7 ± 9.474.5 ± 3.863.2 ± 5.954.0 ± 6.675.8 ± 4.551.0 ± 3.678.1 ± 1.7
d(3)WL, f2, KSVM86.6 ± 5.974.2 ± 2.362.7 ± 7.658.1 ± 6.173.9 ± 3.951.7 ± 3.179.2 ± 1.8
d(4)WL, f2, KSVM88.2 ± 5.374.0 ± 2.863.6 ± 7.056.4 ± 6.976.1 ± 3.851.9 ± 3.578.3 ± 2.5
d(1)WLLB, f187.9 ± 5.968.0 ± 1.359.6 ± 6.457.4 ± 8.174.7 ± 2.552.0 ± 1.878.1 ± 0.8
d(2)WLLB, f189.4 ± 5.268.9 ± 1.958.6 ± 5.759.0 ± 8.375.1 ± 2.250.8 ± 1.678.1 ± 0.8
d(3)WLLB, f190.0 ± 5.668.6 ± 1.657.3 ± 6.258.7 ± 8.175.2 ± 2.151.0 ± 1.678.1 ± 0.8
d(4)WLLB, f189.4 ± 5.266.7 ± 2.058.2 ± 6.156.6 ± 7.274.5 ± 2.050.3 ± 1.477.5 ± 2.1
d(1)WLLB, f1, KSVM88.2 ± 5.772.0 ± 1.960.1 ± 4.854.3 ± 4.875.7 ± 3.250.2 ± 3.378.1 ± 1.9
d(2)WLLB, f1, KSVM88.3 ± 10.770.6 ± 4.359.3 ± 4.555.8 ± 8.575.2 ± 3.650.6 ± 3.677.1 ± 2.2
d(3)WLLB, f1, KSVM88.8 ± 5.471.7 ± 2.758.1 ± 6.654.6 ± 4.575.4 ± 3.850.8 ± 4.178.1 ± 0.8
d(4)WLLB, f1, KSVM87.2 ± 5.871.6 ± 4.360.5 ± 5.852.6 ± 7.676.5 ± 2.951.5 ± 3.178.3 ± 1.1
d(1)WLLB, f288.9 ± 4.570.5 ± 1.060.5 ± 5.456.6 ± 8.075.0 ± 2.552.0 ± 1.878.1 ± 0.8
d(2)WLLB, f290.0 ± 4.270.0 ± 1.458.0 ± 5.658.5 ± 8.975.1 ± 2.250.8 ± 1.678.1 ± 0.8
d(3)WLLB, f290.0 ± 4.270.3 ± 2.456.4 ± 6.258.8 ± 7.875.2 ± 2.151.0 ± 1.677.9 ± 1.3
d(4)WLLB, f290.0 ± 4.270.2 ± 1.858.3 ± 5.658.2 ± 6.974.5 ± 2.050.3 ± 1.478.2 ± 0.8
d(1)WLLB, f2, KSVM86.7 ± 7.832.0 ± 4.261.8 ± 2.752.0 ± 5.427.1 ± 4.520.0 ± 2.878.1 ± 0.8
d(2)WLLB, f2, KSVM82.9 ± 8.730.9 ± 1.163.3 ± 5.654.3 ± 7.220.1 ± 4.419.8 ± 2.778.1 ± 0.8
d(3)WLLB, f2, KSVM86.1 ± 4.930.6 ± 2.161.6 ± 6.555.5 ± 6.325.2 ± 1.118.0 ± 1.878.1 ± 0.8
d(4)WLLB, f2, KSVM86.1 ± 7.230.7 ± 2.058.7 ± 6.052.1 ± 7.133.7 ± 8.717.0 ± 3.278.1 ± 0.8
WWL85.3 ± 7.372.9 ± 3.662.2 ± 6.163.0 ± 7.472.5 ± 3.750.0 ± 5.378.2 ± 0.8
WL85.5± 1.671.6 ± 0.656.6 ± 2.156.2 ± 2.072.4 ± 0.750.9 ± 0.478.4 ± 1.1
WL-OA86.3 ± 2.172.6 ± 0.758.4 ± 2.054.2 ± 1.673.0 ± 1.150.2 ± 1.178.8 ± 1.3
\ No newline at end of file diff --git a/weisfeilerlehmanmeetsgromovwasserstein/images.zip b/weisfeilerlehmanmeetsgromovwasserstein/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..12621dc03c80009d69f56ee0591dd550e00fd795 --- /dev/null +++ b/weisfeilerlehmanmeetsgromovwasserstein/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fc7cbee7d13f377cc8b09e3e1e63dfca148d72d297389c3053db504cefcc2ab2 +size 3448878 diff --git a/weisfeilerlehmanmeetsgromovwasserstein/layout.json b/weisfeilerlehmanmeetsgromovwasserstein/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..9dd209719686d071e8d21ef790eaed3d18373b19 --- /dev/null +++ b/weisfeilerlehmanmeetsgromovwasserstein/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eacb82d463eab6be5fb6171586d3856f7cd9a77eff498f7bd2fbb81bfd23b935 +size 2741851 diff --git a/welfaremaximizationincompetitiveequilibriumreinforcementlearningformarkovexchangeeconomy/30bca0bb-941c-4814-8443-b793c011d2a7_content_list.json b/welfaremaximizationincompetitiveequilibriumreinforcementlearningformarkovexchangeeconomy/30bca0bb-941c-4814-8443-b793c011d2a7_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..7478b73f46090e974b9881e170a79e51435d48c7 --- /dev/null +++ b/welfaremaximizationincompetitiveequilibriumreinforcementlearningformarkovexchangeeconomy/30bca0bb-941c-4814-8443-b793c011d2a7_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d7e973b359389b6e0bcd06a39fece5d7bc87bab73e807eed06ee3a0a17d3fe99 +size 345497 diff --git a/welfaremaximizationincompetitiveequilibriumreinforcementlearningformarkovexchangeeconomy/30bca0bb-941c-4814-8443-b793c011d2a7_model.json b/welfaremaximizationincompetitiveequilibriumreinforcementlearningformarkovexchangeeconomy/30bca0bb-941c-4814-8443-b793c011d2a7_model.json new file mode 100644 index 0000000000000000000000000000000000000000..07084ee2556ea93f6b4cb1d3687c26c4afc93d3f --- /dev/null +++ b/welfaremaximizationincompetitiveequilibriumreinforcementlearningformarkovexchangeeconomy/30bca0bb-941c-4814-8443-b793c011d2a7_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4adb277e0ee21149cad6d7cadd5723db116f4fd30683c415dc0417d67592126d +size 399216 diff --git a/welfaremaximizationincompetitiveequilibriumreinforcementlearningformarkovexchangeeconomy/30bca0bb-941c-4814-8443-b793c011d2a7_origin.pdf b/welfaremaximizationincompetitiveequilibriumreinforcementlearningformarkovexchangeeconomy/30bca0bb-941c-4814-8443-b793c011d2a7_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..06de91d1a84d661412bb996bde80e54c8515ca57 --- /dev/null +++ b/welfaremaximizationincompetitiveequilibriumreinforcementlearningformarkovexchangeeconomy/30bca0bb-941c-4814-8443-b793c011d2a7_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7bc376730dbd82043c7cd05f8638269d7fb1cfe70e58e4c041bc802d94e13cf0 +size 856714 diff --git a/welfaremaximizationincompetitiveequilibriumreinforcementlearningformarkovexchangeeconomy/full.md b/welfaremaximizationincompetitiveequilibriumreinforcementlearningformarkovexchangeeconomy/full.md new file mode 100644 index 0000000000000000000000000000000000000000..ce93185690ba8f25c914389f3f7932a5b5ffb616 --- /dev/null +++ b/welfaremaximizationincompetitiveequilibriumreinforcementlearningformarkovexchangeeconomy/full.md @@ -0,0 +1,1820 @@ +# Welfare Maximization in Competitive Equilibrium: Reinforcement Learning for Markov Exchange Economy + +Zhihan Liu $^{*1}$ Miao Lu $^{*2}$ Zhaoran Wang $^{1}$ Michael I. Jordan $^{3}$ Zhuoran Yang $^{4}$ + +# Abstract + +We study a bilevel economic system, which we refer to as a Markov exchange economy (MEE), from the point of view of multi-agent reinforcement learning (MARL). An MEE involves a central planner and a group of self-interested agents. The goal of the agents is to form a Competitive Equilibrium (CE), where each agent myopically maximizes her own utility at each step. The goal of the central planner is to steer the system so as to maximize social welfare, which is defined as the sum of the utilities of all agents. Working in a setting in which the utility function and the system dynamics are both unknown, we propose to find the socially optimal policy and the CE from data via both online and offline variants of MARL. Concretely, we first devise a novel suboptimality metric specifically tailored to MEE, such that minimizing such a metric certifies globally optimal policies for both the planner and the agents. Second, in the online setting, we propose an algorithm, dubbed as MOLM, which combines the optimism principle for exploration with subgame CE seeking. Our algorithm can readily incorporate general function approximation tools for handling large state spaces and achieves a sublinear regret. Finally, we adapt the algorithm to an offline setting based on the pessimism principle and establish an upper bound on the suboptimality. + +*Equal contribution $^{1}$ Department of Industrial Engineering and Management Sciences, Northwestern University $^{2}$ School of the Gifted Young, University of Science and Technology of China $^{3}$ Department of Statistics, University of California, Berkeley $^{4}$ Department of Statistics and Data Science, Yale University. Correspondence to: Zhihan Liu , Miao Lu , Zhaoran Wang , Zhuoran Yang , Michael I. Jordan . + +Proceedings of the $39^{th}$ International Conference on Machine Learning, Baltimore, Maryland, USA, PMLR 162, 2022. Copyright 2022 by the author(s). + +# 1. Introduction + +Many real-world economic systems involve interactions between a central planner and a group of self-interested agents, where the planner aims to find a policy that steers the agents to some ideal equilibrium that maximizes social welfare. One widely studied instance is optimal tax policy design (Mirrlees, 1976; Mankiw et al., 2009), where the tax policy-maker aims at balancing equality and productivity for tax-payers in the society. Less studied in the previous literature, the design of learning mechanisms for a bilevel economic system remains challenging due to the instability and co-adaptation between agents and the planner, especially for sequential decision-making problems. Despite the progress shown by several works (Kutschinski et al., 2003; Mannion et al., 2016; Zheng et al., 2020; 2021; Lussange et al., 2021) that apply multi-agent reinforcement learning (MARL) to instances of economic systems, it is still an open theoretical challenge to design efficient mechanisms for bilevel economic systems with provable guarantees. + +Our approach brings MARL methods together with the classic model exchange economy (EE). The EE framework has a wide range of applications, including ride-sharing, operations management, crowdsourcing, wireless networks, and compute clusters (Cohen & Cyert, 1965; Hussain et al., 2013; Dissanayake et al., 2015; Rauch & Schleicher, 2015). In an exchange economy, a set of rational agents with individual initial endowments allocate and exchange a finite set of valuable resources based on a common price system. The target of EE is to achieve Competitive Equilibrium (CE), where all agents maximize their own utility under their budget constraint. Adapted from EE, our proposed framework, the Markov exchange economy (MEE), comprises a central planner, multiple agents, and contextual states which follow a Markov Decision Process (MDP). In MEE, the agents follow the same procedure as in EE conditioned on a contextual state. The central planner's action affects the evolution of the endowments of the agents as well as the contextual states. The goal of each agent is to myopically maximize its own utility at each step, which leads to a Competitive Equilibrium (CE) as the agents' subproblem. The goal of the central planner is to steer the system so as to achieve social welfare maximization (SWM), where social welfare + +is defined as the sum of the utilities of all agents over the entire episode. Instead of adding restrictive assumptions that utility functions are known as in many prior works on EE (Tiwari et al., 2009; Hindman et al., 2011; Dissanayake et al., 2015), we aim to solve MEEs when learning both the unknown utility functions and transitions. In reality, it is difficult to collect an exact utility function through automated systems (Hindman et al., 2011; Delimitrou & Kozyrakis, 2013; Venkataraman et al., 2016; Rzadca et al., 2020; Guo et al., 2021) and assuming the full knowledge of transition probability is also unrealistic, which makes the problem still more challenging. + +Taking one specific example for illustration, we consider a developer community. In this community, there are multiple developers who wish to myopically maximize their utility and an administrator who plans to maximize the sum of these developers' utilities. Each developer has her own endowments, e.g., computing resources, memory, bandwidth, and programmer time, for exchange within the community that are available for a finite number of timesteps. At each timestep, developers report their utilities based on their current allocations and contextual states (electricity fee or available time for device usage) to the administrator through rating systems. Meanwhile, the administrator implements a regulatory regime based on the collected utilities and current contextual state. The transition probability of the next contextual state is only determined by administrator's conducted regulation and current contextual state. + +In this paper, we advocate MARL as a principled method for solving MEE. When interaction with environment is accessible, we learn the policies of the agents and the planner through online MARL methods. When only a historical dataset is available, we turn to an offline MARL protocol. To this end, we focus on the following question. + +Can we design provably efficient online and offline algorithms for learning the policies of the planner and agents to achieve CE and SWM simultaneously in MEE? + +Several challenges arise when addressing this question. First, from a theoretical point of view, it remains unknown how to mathematically characterize the jointly optimal policy of a planner and agents such that we can directly measure the performance of any planner-agent policy in terms of SWM while achieving CE among agents. Secondly, in the online and offline settings, where the MEE model is not known a priori, it remains unknown how to find the optimal policy for both planner and agents when this is coupled with the problem of balancing the exploration-exploitation trade-off in an online setting and the problem of distribution shift in an offline setting. Finally, there are generally infinitely many states since the endowments of agents can be continuous, and it is unknown how to handle large state spaces in such online and offline learning problems, especially when + +the utilities and transitions are of general functional forms. + +Our work addresses these challenges and provides an affirmative answer to the desired question. Specifically, by characterizing the optimal policy of planner and agents via a fixed-point formulation, we devise a novel suboptimality metric such that the suboptimality being zero is equivalent to the planner-agent policy being jointly optimal. Then, for the online setting where we learn the optimal policy by interacting with the MEE, we propose a model-based MARL algorithm, dubbed as MOLM, which combines the Optimism in Face of Uncertainty (OFU) principle (Auer et al., 2002; 2009; Jin et al., 2018; 2019) with a subroutine which solves the subgame CE for the agents at each timestep. Our algorithm can readily incorporate general function approximators such as kernel functions and neural networks in the estimation of the transition model and is shown to achieve a sublinear regret with respect to the newly designed suboptimality metric. Furthermore, for the offline setting where we aim to learn the optimal policy solely from a given dataset, we propose a similar algorithm that incorporates the pessimism principle (Buckman et al., 2020; Jin et al., 2021b) to overcome the distributional shift between trajectories in the dataset and those induced by the optimal policy. This algorithm is also able to employ general function approximators and is shown to find a policy whose suboptimality decays sublinearly in the size of the dataset. Finally, as a byproduct, we prove that our algorithms achieve approximately fair division among the agents (Varian, 1973; Budish et al., 2017; Babaioff et al., 2019) in both the online and offline settings. + +Contributions. Our contributions are three-fold. First, we propose a new economic system known as MEE in attempt to understand the theoretical properties of solutions to planner-agent economic systems via MARL approaches. We define a suboptimality function to characterize the optimal policy for the planner and the agents in an MEE, with another suboptimality proposed to characterize the fair division property among the agents. Second, we design a MARL-style algorithm MOLM to find the optimal policy for the planner and the agents from data in online setting. For MOLM we establish an online regret upper bound, $\widetilde{\mathcal{O}} (\sqrt{dH^4N^2K})$ , where $K$ is the number of episodes, $H$ is the time step, $N$ is the number of agents, $d$ is the eluder dimension of the general function class used by MOLM, and $\widetilde{\mathcal{O}} (\cdot)$ hides the logarithmic terms and constants. Third, in addition to MOLM, we design MPLM for offline MEE. For MPLM, we establish an offline suboptimality bound, $\widetilde{\mathcal{O}} (\sqrt{C_{\rho}^{\star}H^{4}N^{2} / K})$ , where $K$ is the size of dataset and $C_{\rho}^{\star}$ is the distribution shift coefficient in sense of partial coverage. Theoretical results show that both MOLM and MPLM provably find the optimal policy for planner and agents in the two settings. In addition, they provably achieve + +fair division among agents as a byproduct. + +# 1.1. Related Work + +Our work adds to the line of research in applying machine learning methods to economic problems such as EE (Guo et al., 2021), mechanism design (Kandasamy et al., 2020), and social planning problems (Blaug, 2007). Our analysis of MEE is based on previous works on EE (Debreu, 1982; Zhang, 2011). Motivated by the extensive literature on online and offline RL, our works apply the optimism principle (Auer et al., 2002; Jin et al., 2018) and pessimism principle (Buckman et al., 2020; Jin et al., 2021b) in online and offline settings, respectively. Our work is also related to literature in MARL (Bucarey et al., 2019; Zhong et al., 2021) and RL with general function approximations (Xie et al., 2021; Cai et al., 2020b). However, none of the previous work analyzes bilevel economic systems, as we do for MEE in this paper. See Appendix B for full discussions of related work. + +Notations We provide a table of notation in Appendix A. + +# 2. Preliminaries + +In this section, we introduce our economic model known as Markovian Exchange Economy (MEE) which involves several self-interested agents and a social planner. We specify the goal for both planner and agents, and we characterize their jointly optimal policy via a fixed-point formulation. All the proofs for the theorems are referred to Appendix E. + +# 2.1. Markovian Exchange Economy + +We define a finite horizon Markovian exchange economy as $(\mathcal{S},\mathcal{A},\mathcal{B},N,L,H,\{u_h^{(i)}\}_{i\in [N],h\in [H]},\{P_h\}_{h\in [H]})$ which consists of $N$ agents, one social planner, $L$ goods, and $H$ time steps. The state space is denoted by $\mathcal{S} = \mathcal{C}\times \mathcal{E}^N$ where $\mathcal{C}$ is the context space and $\mathcal{E}\subseteq [0,1]^L$ is the space of each agent's endowments. A state at step $h$ is denoted by $s_h = (c_h,e_h^{(1)},\dots ,e_h^{(N)})\in \mathcal{S}$ . The agents' action space is denoted by $\mathcal{A} = \mathcal{X}^{(1)}\times \dots \times \mathcal{X}^{(N)}\times [0,1]^L$ , where $\mathcal{X}^{(i)}\in [0,1]^L$ is the allocation space of the $i^{\mathrm{th}}$ agent and $[0,1]^L$ is the price space. We denote by $a_{h} = (x_{h}^{(1)},\dots ,x_{h}^{(N)},p_{h})$ the agents' action at step $h$ . The planner's action space is denoted by $\mathcal{B}$ which is discrete, and the planner's action at step $h$ is denoted by $b_{h}\in \mathcal{B}$ . The utility function of the $i^{\mathrm{th}}$ agent at step $h$ is denoted by $u_h^{(i)}:\mathcal{S}\times \mathcal{X}^{(i)}\mapsto [0,1]$ . The transition kernel at step $h$ is denoted by $P_{h}(s^{\prime}|s,b)$ : $\mathcal{S}\times \mathcal{B}\mapsto \Delta (\mathcal{S})$ . We note that the transition kernel $P_{h}$ does not depend on the agents' action, but only the planner's. + +Policy and Value Functions. Without loss of generality, in the sequel we always focus on deterministic policies for both planner and agents. A planner's policy is denoted by $\pi = \{\pi_h\}_{h\in [H]}$ where $\pi_h:\mathcal{S}\mapsto \mathcal{B}$ . An agents' policy + +is denoted by $\nu = \{\nu_h\}_{h\in [H]}$ where $\nu_{h}:\mathcal{S}\mapsto \mathcal{A},s\mapsto$ $(\nu_h^{(1)}(s),\dots ,\nu_h^{(N)}(s),\nu_h^{\mathbf{P}}(s))$ . That is, $\nu_{h}^{(i)}$ determines the allocation of the $i^{\mathrm{th}}$ agent and $\nu_{h}^{\mathbf{P}}$ determines the price. We assume that $\pi$ and $\nu$ belong to classes $\Pi$ and $\mathbf{N}$ respectively. Given any pair of policy $(\pi ,\nu)$ , we define its action-value function and state value function recursively as + +$$ +\begin{array}{l} Q _ {h} ^ {(\pi , \nu), (i)} \left(s _ {h}, x _ {h} ^ {(i)}, b _ {h}\right) = u _ {h} ^ {(i)} \left(s _ {h}, x _ {h} ^ {(i)}\right) \\ + \int_ {\mathcal {S}} V _ {h + 1} ^ {(\pi , \nu), (i)} \left(s ^ {\prime}\right) P _ {h} \left(\mathrm {d} s ^ {\prime} \mid s _ {h}, b _ {h}\right), \tag {1} \\ \end{array} +$$ + +$$ +V _ {h} ^ {(\pi , \nu), (i)} (s _ {h}) = Q _ {h} ^ {(\pi , \nu), (i)} (s _ {h}, \nu_ {h} ^ {(i)} (s _ {h}), \pi_ {h} (s _ {h})), +$$ + +for any $(s_h,x_h^{(i)},b_h,h,i)\in \mathcal{S}\times \mathcal{X}^{(i)}\times \mathcal{B}\times [H - 1]\times [N]$ For step $H$ , we define $Q_{H}^{(\pi ,\nu),(i)}(s_{H},x_{H}^{(i)}) = u_{H}^{(i)}(s_{H},x_{H}^{(i)})$ and $V_{H}^{(\pi ,\nu),(i)}(s_{H}) = Q_{H}^{(\pi ,\nu),(i)}(s_{H},\nu_{H}^{(i)}(s_{H}))$ . By the definition, all these functions take value between O and $H$ + +# 2.2. The Goal of MEE: Social Welfare Maximization with Competitive Equilibrium + +Now we specify the goal for both social planner and agents in an MEE, that is, the agents aim to achieve competitive equilibrium at each step and the planner aims to maximize the social welfare which is the sum of utilities of all agents. We first study the optimal policy for the agents and the planner respectively, and after we define the joint optimality for planner-agents policy pair $(\pi, \nu)$ . The joint optimality can be characterized by a fixed-point formulation, which allows us to define the suboptimality for any policy pair. + +One-Step Competitive Equilibrium. The agents' optimal policy $\nu^{\star}$ is defined as the one giving competitive equilibrium with respect to the utility functions $\{u^{(i)}\}_{i\in [N]}$ at each step $h$ . To this end, we first define a competitive equilibrium (Mas-Colell et al., 1995; Guo et al., 2021) as follows, which is adapted to the Markovian exchange economy. + +Definition 2.1 (Competitive Equilibrium). A competitive equilibrium (CE) at state $s = (c, e^{(1)}, \dots, e^{(N)}) \in S$ is an allocation and price-vector pair $(x^{(1),\star}, \dots, x^{(N),\star}, p^{\star}) \in \mathcal{A}$ such that $(i)$ the allocation is feasible and $(ii)$ all agents maximize their utilities under the budget induced by price $p^{\star}$ . In other words, following two conditions hold, + +$$ +\sum_ {i \in [ N ]} x _ {j} ^ {(i), \star} \leqslant \sum_ {i \in [ N ]} e _ {j} ^ {(i)}, \forall j \in [ L ], \tag {2} +$$ + +$$ +x ^ {(i), \star} \in \underset {\left(x ^ {(i)}\right) ^ {\top} p ^ {\star} \leq \left(e ^ {(i)}\right) ^ {\top} p ^ {\star}} {\arg \max } u ^ {(i)} \left(s, x ^ {(i), \star}\right), \forall i \in [ N ]. \tag {3} +$$ + +For simplicity, we denote any competitive equilibrium allocation and price pair at state $s$ with respect to $\{u^{(i)}\}_{i\in [N]}$ as $(x^{(1),\star},\dots ,x^{(N),\star},p^{\star})\in \mathbb{C}\mathbb{E}(\{u^{(i)}(s,\cdot)\}_{i\in [N]})$ . Based on Definition 2.1, we define the agents' optimal policy as the one that outputs CE pairs at each time step. + +Definition 2.2 (Optimal Policy of Agent). The agents' optimal policy $\nu^{\star}$ is the policy in $\Pi$ such that for any $(h,s_h)\in [H]\times \mathcal{S},\nu_h^\star (s_h) = (\nu_h^{\star ,(1)}(s_h),\dots ,\nu_h^{\star ,(N)}(s_h),\nu_h^{\star ,\mathbf{p}}(s_h))$ satisfies $\nu_{h}^{\star}(s_{h})\in \mathbb{C}\mathsf{E}(\{u_{h}^{(i)}(s_{h},\cdot)\}_{i\in [N]})$ + +Under certain assumptions (Mas-Colell et al., 1995; Guo et al., 2021) on the utility functions $\{u_h^{(i)}\}_{i\in [N],h\in [H]}$ , the competitive equilibrium exists. To measure the suboptimality of a given policy $\nu$ , we further define the best response policy of $\nu$ that reallocates among agents given the price system of $\nu$ to achieve competitive equilibrium. + +Definition 2.3 (Best Response of Agent Policy). Given any agents' policy $\nu \in \Pi$ , the best response agents' policy $\nu^{\star}(\nu)$ is the one in $\Pi$ such that for any $(h, s_h) \in [H] \times S$ , $\nu_{h}^{\star}(\nu)(s_h) = (\nu_{h}^{\star,(1)}(\nu), \dots, \nu_{h}^{\star,(N)}(\nu), \nu_{h}^{\star,\mathbf{p}}(\nu))(s_h)$ satisfies $\nu_{h}^{\star,\mathbf{p}}(\nu)(s_h) = \nu_{h}^{\mathbf{p}}(s_h)$ and $\nu_{h}^{\star,(i)}(\nu)(s_h) \in$ + +$$ +\underset {x _ {h} ^ {(i)} \in \mathcal {X} ^ {(i)}: (x _ {h} ^ {(i)}) ^ {\top} \nu_ {h} ^ {\mathbf {P}} (s _ {h}) \leq (e _ {h} ^ {(i)}) ^ {\top} \nu_ {h} ^ {\mathbf {P}} (s _ {h})} {\arg \max } u _ {h} ^ {(i)} (s _ {h}, x _ {h} ^ {(i)}). \tag {4} +$$ + +The existence of $\nu^{\star}(\nu)$ is guaranteed by the theorem of the maximum, see Theorem A.2.21 of (Jehle, 2001). With the best resonance agent policy $\nu^{\star}(\nu)$ , we can measure the suboptimality of $\nu$ by comparing the value functions induced by $\nu$ and $\nu^{\star}(\nu)$ , which also gives a fixed-point formulation of the agents' optimal policy. We conclude this property in the following theorem whose proof is in Appendix E.1. + +Theorem 2.4. For any policy pair $(\pi, \nu)$ satisfying the resource constraints, i.e., for any $(j, h, s_h) \in [L] \times [H] \times S$ , + +$$ +\sum_ {i = 1} ^ {N} \left(\nu_ {h} ^ {(i)} \left(s _ {h}\right)\right) _ {j} \leq \sum_ {i = 1} ^ {N} \left(e _ {h} ^ {(i)}\right) _ {j}, +$$ + +the following two conclusions hold. (i) For any step $h \in [H]$ and state $s_h \in S$ , we have that + +$$ +V _ {h} ^ {(\pi , \nu), (i)} (s _ {h}) \leq V _ {h} ^ {(\pi , \nu^ {\star} (\nu)), (i)} (s _ {h}). \tag {5} +$$ + +(ii) If the equality $V_{1}^{(\pi, \nu^{*}(\nu)), (i)}(s_{1}) = V_{1}^{(\pi, \nu), (i)}(s_{1})$ holds for any $s_{1} \in S$ , then for any $h \in [H]$ and $s_{h} \in S$ , $\nu_{h}(s_{h})$ is a competitive equilibrium with respect to $\{u_{h}^{(i)}(s_{h}, \cdot)\}_{i \in [N]}$ . + +Theorem 2.4 tells that we end up higher values when substituting $\nu$ by $\nu^{\star}(\nu)$ . Whenever the equality holds, the agent policy $\nu$ is optimal. Motivated by this fixed-point characterization of $\nu^{\star}$ , we define the suboptimality of agents' policy to be $\mathrm{SubOpt}_{\mathrm{A}}^{(i)}(\pi, \nu, s_1)$ for each agent $i \in [N]$ as + +$$ +V _ {1} ^ {(\pi , \nu^ {\star} (\nu)), (i)} (s _ {1}) - V _ {1} ^ {(\pi , \nu), (i)} (s _ {1}). \tag {6} +$$ + +Social Welfare Maximization. For given agents' policy $\nu$ , we define the planner's optimal $\pi^{\star}(\nu)$ to be the one in $\mathbf{N}$ that maximizes the social welfare $\sum_{i=1}^{N} V_1^{(\nu, \pi), (i)}(s_1)$ , i.e., the sum of utility functions over agents and time steps. + +Definition 2.5 (Optimal Policy of Planner). The planner's optimal policy $\pi^{\star}(\nu)$ given agents' policy $\nu$ is the one in $\mathbf{N}$ such that for any $(h, s_h) \in [H] \times S$ , $\pi_h^{\star}(s_h)$ belongs to + +$$ +\underset {b _ {h} \in \mathcal {B}} {\arg \max } \int_ {\mathcal {S}} \sum_ {i = 1} ^ {N} V _ {h + 1} ^ {(\pi^ {\star} (\nu), \nu), (i)} \left(s ^ {\prime}\right) P _ {h} \left(\mathrm {d} s ^ {\prime} \mid s _ {h}, b _ {h}\right). \tag {7} +$$ + +We note that $V_{h + 1}^{(\pi^{\star}(\nu),\nu),(i)}$ only depends on $\pi_j^\star (\nu)$ for $j > h$ and thus $\pi^{\star}(\nu)$ is well-defined. Given any policy pair $(\pi ,\nu)$ , we can measure the suboptimality of $\pi$ with respect to $\pi^{\star}(\nu)$ by comparing the social welfare induced by $\pi$ and $\pi^{\star}(\nu)$ . We show this result by the following theorem proven in Appendix E.2. + +Theorem 2.6. For any policy pair $(\pi, \nu)$ , the following two conclusions hold. (i) For any step $h \in [H]$ and state $s_h \in S$ , + +$$ +\sum_ {i = 1} ^ {N} V _ {h} ^ {(\pi , \nu), (i)} \left(s _ {h}\right) \leq \sum_ {i = 1} ^ {N} V _ {h} ^ {\left(\pi^ {\star} (\nu), \nu\right), (i)} \left(s _ {h}\right). \tag {8} +$$ + +(ii) Furthermore, if the equality $\sum_{i=1}^{N} V_1^{(\pi^*(\nu), \nu), (i)}(s_1) = \sum_{i=1}^{N} V_1^{(\pi, \nu), (i)}(s_1)$ holds for any $s_1 \in S$ , then for any $h \in [H]$ and $s_h \in S$ we have that + +$$ +\pi_{h}(s_{h})\in \operatorname *{arg max}_{b_{h}\in \mathcal{B}}\int_{\mathcal{S}}\sum_{i = 1}^{N}V_{h + 1}^{(\pi^{\star}(\nu),\nu),(i)}(s^{\prime})P_{h}(\mathrm{d}s^{\prime}|s_{h},b_{h}). +$$ + +Parallel to Theorem 2.4, Theorem 2.6 shows that we end up higher values when substituting $\pi$ by $\pi^{\star}(\nu)$ . Whenever the equality holds, the planner policy $\pi$ is optimal given $\nu$ . Motivated by the fixed-point formulation of $\pi^{\star}(\nu)$ , we define the suboptimality of planner's policy $\mathrm{SubOpt}_{\mathrm{P}}(\pi, \nu, s_1)$ as + +$$ +\sum_ {i = 1} ^ {N} V _ {1} ^ {(\pi^ {\star} (\nu), \nu), (i)} (s _ {1}) - V _ {1} ^ {(\pi , \nu), (i)} (s _ {1}). \tag {9} +$$ + +Joint Optimality. Now we define the jointly optimal policy for the planner and the agents as $(\pi^{\star}(\nu^{\star}),\nu^{\star})$ , where $\nu^{\star}$ and $\pi^{\star}(\nu^{\star})$ satisfies Definition 2.2 and 2.5 respectively, i.e., the agents find one-step CE and the planner maximizes the social welfare induced by the agents' CE policy. Based on the suboptimality (6) and (9) for agents and planner, we further define the suboptimality $\mathrm{SubOpt}(\pi ,\nu ,s_1)$ for any planner-agents policy pair $(\pi ,\nu)$ as the following sum, + +$$ +\sum_ {i = 1} ^ {N} \operatorname {S u b O p t} _ {\mathrm {A}} ^ {(i)} (\pi , \nu , s _ {1}) + \operatorname {S u b O p t} _ {\mathrm {P}} (\pi , \nu^ {\star} (\nu), s _ {1}). \tag {10} +$$ + +Plugging in the expression of suboptimalities (6) and (9), the suboptimality (10) is equivalent to the following expression, + +$$ +\sum_ {i = 1} ^ {N} V _ {1} ^ {(\pi^ {\dagger} (\nu), \nu^ {\star} (\nu)), (i)} \left(s _ {1}\right) - V _ {1} ^ {(\pi , \nu), (i)} \left(s _ {1}\right), \tag {11} +$$ + +where for simplicity, we denote $\pi^{\dagger}(\nu) := \pi^{\star}(\nu^{\star}(\nu))$ the optimal planner policy given the best response agent policy of $\nu$ . We keep to this notation in the sequel. The following theorem, a corollary of Theorem 2.4 and 2.6, shows that the joint optimality is equivalent to that (11) vanishes. + +Theorem 2.7 (Fixed-Point Characterization of Joint Optimality). A planner-agents policy pair $(\pi, \nu)$ is jointly optimal if and only if $\operatorname{SubOpt}(\pi, \nu, s_1)$ (11) equals to zero. + +# 2.3. Fair Division Property + +Achieving competitive equilibrium among agents is also related to the notion of fair division mechanism which requires sharing incentive (SI) and Pareto-efficiency (PE) (Varian, 1973; Budish et al., 2017; Babaioff et al., 2019; 2021; Guo et al., 2021). An allocation $x_{h} \in \mathcal{X}^{(1)} \times \dots \times \mathcal{X}^{(n)}$ satisfies SI at step $h$ and state $s_{h} = (c_{h}, e_{h})$ if the utility the $i$ -th agent receives is at least as much as its utility when using its endowment, i.e. $u_{h}^{(i)}(s_{h}, x_{h}^{(i)}) \geq u_{h}^{(i)}(s_{h}, e_{h}^{(i)})$ . This implies that all agents have the incentive to participate in this division mechanism. Besides, a feasible allocation $x_{h}$ is PE at step $h$ and state $s_{h} = (c_{h}, e_{h})$ if the utility of one agent can be increased only by decreasing the utility of others. Formally, allocation $x_{h}$ is said to dominate another allocation $\widetilde{x}_{h}$ given state $s_{h}$ , if $u_{h}^{(i)}(s_{h}, x_{h}^{(i)}) \geq u_{h}^{(j)}(s_{h}, \widetilde{x}_{h}^{(i)})$ for all $i \in [N]$ and there exists some $j \in [N]$ such that $u_{h}^{(i)}(s_{h}, x_{h}^{(i)}) > u_{h}^{(j)}(s_{h}, \widetilde{x}_{h}^{(i)})$ . An allocation $x_{h}$ is Pareto-efficient given state $s_{h}$ if it is not dominated by any other allocations. We denote the set of Pareto-efficient allocations at step $h$ and state $s_{h}$ by $\mathcal{P}\mathcal{E}(s_{h}, h)$ . + +To characterize the fair division property when finding the optimal policy of agents, we further introduce corresponding loss functions. We first define the SI loss $\ell_h^{\mathrm{SI}}$ for any agents' policy $\nu$ at step $h$ and state $s_h$ as the sum, over all agents, of how much they are worse off than their endowment utilities, i.e., we define $\ell_h^{\mathrm{SI}}(\nu, s_h)$ as + +$$ +\sum_ {i = 1} ^ {N} \left(u _ {h} ^ {(i)} \left(s _ {h}, e _ {h} ^ {(i)}\right) - u _ {h} ^ {(i)} \left(s _ {h}, \nu_ {h} ^ {(i)} \left(s _ {h}\right)\right)\right) ^ {+}. \tag {12} +$$ + +Then we define the PE loss $\ell_h^{\mathrm{PE}}$ for $\nu$ at step $h$ and state $s_h$ as the minimal sum, over all agents, of how much they are worse off than PE allocations, i.e., we define $\ell_h^{\mathrm{PE}}(\nu, s_h)$ as + +$$ +\inf _ {x \in \mathcal {P E} \left(s _ {h}, h\right)} \sum_ {i = 1} ^ {N} \left(u _ {h} ^ {(i)} \left(s _ {h}, x ^ {(i)}\right) - u _ {h} ^ {(i)} \left(s _ {h}, v _ {h} ^ {(i)} \left(s _ {h}\right)\right)\right) ^ {+}. \tag {13} +$$ + +Finally, we define the FD loss $\ell_h^{\mathrm{FD}}$ for policy $\nu$ at step $h$ as the maximum of SI loss $\ell_h^{\mathrm{SI}}$ and PE loss $\ell_h^{\mathrm{PE}}$ , i.e., + +$$ +\ell_ {h} ^ {\mathrm {F D}} (\nu , s _ {h}) = \max \left\{\ell_ {h} ^ {\mathrm {P E}} (\nu , s _ {h}), \ell_ {h} ^ {\mathrm {S I}} (\nu , s _ {h}) \right\}. \tag {14} +$$ + +# 2.4. General Function Approximation and CE Oracle + +In this paper, we apply MARL-style approaches to solve MEE in both online and offline settings with general function approximations. Specifically, we consider two function classes $\mathcal{U}$ and $\mathcal{P}$ to represent the utility functions $\{u_h^{(i)}\}_{(i,h)\in [N]\times [H]}$ and the transition kernels $\{P_h\}_{h\in [H]}$ respectively. We make the following realizability assumptions (Uehara & Sun, 2021; Xie et al., 2021) on them. + +Assumption 2.8 (Realizability). Without loss of generality, we assume that $\mathcal{X}^{(i)}$ 's are the same for all $i \in [N]$ . Then we assume that utility function $u_h^{(i)} \in \mathcal{U}$ and transition $P_h \in \mathcal{P}$ holds for any $(i,h) \in [N] \times [H]$ . + +Besides, we assume that for each set of $\{u^{(i)}\}_{i\in [N]}$ in $\mathcal{U}$ , there exists a CE oracle $\mathsf{CE}(\{u^{(i)}(s,\cdot)\}_{i\in [N]})$ for any $s\in S$ that returns CE allocation-price vector pair. This can be realized efficiently via methods introduced in Varian & Varian (1992); Zhang (2011); Zahedi et al. (2018). + +# 3. Online Learning Algorithm + +# 3.1. Setup and Learning Objective + +Online Learning Protocol. We study online episodic setting where an online learning algorithm plays an MEE for $K$ episodes. At the beginning of the $k$ -th episode, the algorithm determines the planner's and agents' policy pair $(\pi^k,\nu^k)$ , and an initial state $s_1^k$ is chosen by the environment. At each time step $h\in [H]$ , the agents and the planner observe state $s_h^k\in S$ and pick their own actions $a_{h}^{k} = \nu_{h}^{k}(s_{h}^{k})$ and $b_{h}^{k} = \pi_{h}^{k}(s_{h}^{k})$ . Subsequently, the environment transits to the next state $s_{h + 1}^{k}\sim P_{h}(\cdot |s_{h}^{k},b_{h}^{k})$ and they observe the utilities $\{u_h^{k,(i)}\}_{i\in [N]}$ with $u_{h}^{k,(i)} = u_{h}^{(i)}(s_{h}^{k},x_{h}^{k,(i)})$ . + +Learning Objective. Based on the definition of suboptimality (11) for any policy pair $(\pi, \nu)$ , we define the following online regret with respect to achieving joint optimality. + +Definition 3.1 (Online Regret for Joint Optimality). Let $(\pi^k,\nu^k)$ be the policy pair executed by any online learning algorithm in the $k$ -th episode. After a total of $K$ episodes, the online regret for joint optimality is defined as + +$$ +\operatorname {R e g r e t} _ {\mathrm {C E}, \mathrm {S W M}} (K) = \sum_ {k = 1} ^ {K} \operatorname {S u b O p t} \left(\pi^ {k}, \nu^ {k}, s _ {1} ^ {k}\right). \tag {15} +$$ + +Moreover, we also define the online regret with respect to achieving fair division based on the notion of FD loss (14). + +Definition 3.2 (Online Regret for Fair Division Property). Let $(\pi^k,\nu^k)$ be the policy pair executed by any online algorithm in the $k$ -th episode. After a total of $K$ episodes, the + +the online regret for fair division property is defined as + +$$ +\operatorname {R e g r e t} _ {\mathrm {F D}} (K) = \sum_ {k = 1} ^ {K} \mathbb {E} _ {\pi^ {k}} \left[ \sum_ {h = 1} ^ {H} \ell_ {h} ^ {\mathrm {F D}} \left(\nu^ {k}, s _ {h}\right) \right]. \tag {16} +$$ + +Each summand in (16) reflects the expected total FD loss of $\nu^k$ along the trajectories induced by $\pi^k$ . We remark that $\mathrm{Regret}_{\mathrm{FD}}(K)$ is an extension of the FD loss defined in (Guo et al., 2021) to sequential settings. Our goal in the online setting is to design algorithms with both regrets sublinear in $K$ , and polynomial in $d$ and $H$ , where $d$ is some dimension of the function class used by the algorithm. + +# 3.2. Algorithm: Model-based Optimistic Online Learning for MEE + +We propose Model-based Optimistic online Learning for MEE (MOLM, Algorithm 1) to learn the joint optimal policy for planner and agents in the online setting, which involves a model estimation step and an optimistic planning step. + +Model Estimation Step (Line 3). At the beginning of $k$ -th episode, we construct confidence sets for the utility $u_h^{(i)}$ and the transition $P_h$ using data collected before the $k$ -th episode, inspired by Russo & Van Roy (2013); Ayoub et al. (2020); Cai et al. (2020b). For utility $u_h^{(i)}$ , we let $u_h^{k,(i)}$ minimize the empirical mean squared error in $\mathcal{U}$ and let confidence set $\mathcal{U}_h^{k,(i)}$ consist of all the utility functions in $\mathcal{U}$ with empirical mean squared discrepancy from $u_h^{k,(i)}$ less than a given threshold $\beta^{(1)}$ . For transition $P_h$ , we similarly construct the confidence set $\mathcal{P}_h^k$ via value-targeted regression (Ayoub et al., 2020; Cai et al., 2020b). Given value function estimators $\{V_{h + 1}^{\tau ,(i)}\}_{\tau = 1}^{k - 1}$ , we let $P_h^k$ minimize the empirical mean squared error in predicting the value of future social welfare $\sum_{i = 1}^{N}V_{h + 1}^{\tau ,(i)}$ given $s_h^\tau$ , $b_h^\tau$ , and the confidence set $\mathcal{P}_h^k$ constrains all transitions in $\mathcal{P}$ that make similar predictions to $P_h^k$ with empirical mean squared discrepancy less than another threshold $\beta^{(2)}$ . Details of the model estimation step are concluded in Algorithm 3 in Appendix C. + +Optimistic Planning Step (Line 4 to Line 8). Then using $\mathcal{U}_h^{k,(i)}$ and $\mathcal{P}_h^k$ , MOLM performs optimistic planning according to (1), Definition 2.2 and 2.5 to obtain $(\pi^k,\nu^k)$ which is executed in the $k$ -th episode. Intuitively, we first solve the sub-problem of one-step CE for the agents by choosing the optimal agents' policy with respect to the estimated optimistic utilities. After, we cast the sub-problem of social welfare maximization for the planner as finding the optimal policy in an Markov decision process whose reward is induced by the agents' utilities. Specifically, given the value function estimators $V_{h + 1}^{k,(i)}$ at step $h + 1$ with $V_{H + 1}^{k,(i)}$ being zero functions, we first choose the most optimistic model + +estimator at step $h$ from $\mathcal{U}_h^{k,(i)}$ and $\mathcal{P}_h^k$ respectively as + +$$ +\widehat {u} _ {h} ^ {k, (i)} (s, x ^ {(i)}) = \underset {u \in \mathcal {U} _ {h} ^ {(i), k}} {\arg \max } u (s, x ^ {(i)}), \tag {17} +$$ + +$$ +\widehat {P} _ {h} ^ {k} (\cdot | s, b) = \underset {P \in \mathcal {P} _ {h} ^ {k}} {\arg \max } \int_ {\mathcal {S}} \sum_ {i = 1} ^ {N} V _ {h + 1} ^ {k, (i)} \left(s ^ {\prime}\right) P \left(\mathrm {d} s ^ {\prime} \mid s, b\right), \tag {18} +$$ + +for any $(i,s,x^{(i)},b)\in [N]\times S\times \mathcal{X}^{(i)}\times \mathcal{B}$ . Then we choose the agents' policy $\nu_h^k = (\nu_h^{k,(1)}(s),\dots ,\nu_h^{k,(N)}(s),\nu_h^{k,\mathbf{p}}(s))$ so as to output CE pairs with respect to the estimated optimistic utility function $\widehat{u}_h^{k,(i)}$ by a CE oracle (Section 2.4), + +$$ +\nu_ {h} ^ {k} (s) = \operatorname {C E} \left(\left\{\widehat {u} _ {h} ^ {k, (i)} (s, \cdot) \right\} _ {i \in [ N ]}\right). \tag {19} +$$ + +Meanwhile, we choose the planner policy $\pi_h^k$ so as to maximize the estimated optimistic future social welfare, + +$$ +\pi_ {h} ^ {k} (s) = \underset {b \in \mathcal {B}} {\arg \max } \sum_ {i = 1} ^ {N} \int_ {\mathcal {S}} V _ {h + 1} ^ {k, (i)} \left(s ^ {\prime}\right) \widehat {P} _ {h} ^ {k} \left(\mathrm {d} s ^ {\prime} \mid s, b\right). \tag {20} +$$ + +We note that $V_{h + 1}^{k,(i)}$ can be seen as the state-value function of a finite-horizon MDP whose reward of state $s$ and action $b$ is given by $\widehat{u}_h^{k,(i)}(s,\nu_h^k (s),b)$ . After that, the value function estimators at step $h$ are updated accordingly, i.e., + +$$ +\begin{array}{l} Q _ {h} ^ {k, (i)} (s, x _ {h} ^ {(i)}, b) = \widehat {u} _ {h} ^ {k, (i)} (s, x _ {h} ^ {(i)}) + \\ \operatorname {C l i p} _ {[ 0, H - h ]} \left\{\int_ {\mathcal {S}} V _ {h + 1} ^ {k, (i)} \left(s ^ {\prime}\right) \widehat {P} _ {h} ^ {k} \left(\mathrm {d} s ^ {\prime} \mid s, b\right) \right\}, \tag {21} \\ \end{array} +$$ + +$$ +V _ {h} ^ {k, (i)} (s) = Q _ {h} ^ {k, (i)} \big (s, \nu_ {h} ^ {k, (i)} (s), \pi_ {h} ^ {k} (s) \big), +$$ + +for any $(s,a,b)\in S\times \mathcal{A}\times \mathcal{B}$ , where we clip the second term in $Q_h^{k,(i)}$ between 0 and $H - h$ due to the assumption that utility functions fall in the range [0,1]. Finally, MOLM executes the joint policy $(\pi_h^k,\nu_h^k)$ and collects the data for the $k$ -th episode according to the protocol in Section 3.1 + +# 3.3. Main Theoretical Results for Online Learning + +Our main theoretical results are upper bounds on the two online regrets (15) and (16) incurred by Algorithm 1. For the analysis, we introduce the notion of eluder dimension which is firstly proposed by (Russo & Van Roy, 2013). + +Definition 3.3 (Eluder Dimension). Let $\mathcal{Z}$ be a set of real-valued functions on $\mathcal{X}$ . For any $\varepsilon > 0$ and $\tau \in [K]$ , we say that $x_{\tau} \in \mathcal{X}$ is $(\mathcal{Z}, \varepsilon)$ -independent of $x_1, \dots, x_{\tau-1} \in \mathcal{X}$ if there exists $f_1, f_2 \in \mathcal{Z}$ such that both $\sum_{j=1}^{\tau-1} |f_1(x_j) - f_2(x_j)|^2 \leq \varepsilon^2$ and $|f_1(x_\tau) - f_2(x_\tau)| > \varepsilon$ hold. The eluder dimension of $\mathcal{Z}$ at scale $\varepsilon$ , denoted by $\dim_{\mathbb{E}}(\mathcal{Z}, \varepsilon)$ , is then defined as the length of the longest sequence $\{x_j\}_{j=1}^\tau$ such that $x_j$ is $(\mathcal{Z}, \varepsilon)$ -independent of $\{x_i\}_{i=1}^{j-1}$ for any $j \in [\tau]$ . + +We refer to Russo & Van Roy (2013) for a detailed discussion of the eluder dimension. For simplicity, we define + +Algorithm 1 Model-based Optimistic Online Learning for Markov Exchange Economy (MOLM) +Input: Optimism parameters $\beta^{(1)}$ and $\beta^{(2)}$ . Function classes $\mathcal{U}$ and $\mathcal{P}$ . +1: Initialize dataset $\mathcal{D}_h^0 = \emptyset$ for all $h \in [H]$ . Set $V_{H+1}^{k,(i)}(\cdot) = 0$ for all $(i, k) \in [N] \times [K]$ . +2: for $k = 1$ to $K$ do +3: $\{\mathcal{U}_h^{k,(i)}\}_{(h,i) \in [H] \times [N]}, \{\mathcal{P}_h^k\}_{h \in [H]} = \mathbb{M}\mathbb{E}(\mathcal{U}, \mathcal{P}, \{\mathcal{D}_h^k\}_{h \in [H]}, \beta^{(1)}, \beta^{(2)})$ // Model Estimation, Algorithm 3. +4: $\pi^k, \nu^k, \{V_h^{k,(i)}\}_{(h,i) \in [H] \times [N]} = \mathsf{OPL}(\{\mathcal{U}_h^{k,(i)}\}_{(h,i) \in [H] \times [N]}, \{\mathcal{P}_h^k\}_{h \in [H]})$ . // Optimistic Planning, Algorithm 4. +5: Observe initial state $s_h^k$ of episode $k$ . +6: for $h = 1$ to $H$ do +7: Take actions $a_h^k = \nu_h^k(s_h^k)$ and $b_h^k = \pi_h^k(s_h^k)$ . Observe the next state $s_{h+1}^k$ and the utilities $u_h^{k,(i)}$ . +8: Update dataset $\mathcal{D}_h^k = \mathcal{D}_h^{k-1} \cup \{s_h^k, a_h^k, b_h^k, \{u_h^{k,(i)}\}_{i \in [N]}, \{V_h^{k,(i)}\}_{i \in [N]}\}$ . +9: end for +10: end for + +$\mathcal{Z}_{\mathcal{P}}$ to be the class of mappings $z_{P}:\mathcal{S}\times \mathcal{B}\times \{f:\mathcal{S}\mapsto [0,HN]\} \mapsto [0,1],(s,b,f(\cdot))\mapsto \int_{\mathcal{S}}f(s^{\prime})P(\mathrm{d}s^{\prime}|s,b)$ , for any $P\in \mathcal{P}$ . With these preparations, we define dimension $d = \max \{\dim_{\mathbb{E}}(\mathcal{U},1 / K),\dim_{\mathbb{E}}(\mathcal{Z}_{\mathcal{P}},1 / K)\}$ to characterize the complexity of function classes $\mathcal{U}$ and $\mathcal{P}$ . The following theorem is the main theoretical results in the online setting. All the omitted proofs are in Appendix C.1 and F. + +Theorem 3.4 (Regret of Algorithm 1). By setting parameters $\beta^{(1)}$ as $C_1\log (\mathcal{N}(1 / K,\mathcal{U},\| \cdot \|_{\infty})NHK^2 /\delta)$ and $\beta^{(2)}$ as $C_2H^2 N^2\log (\mathcal{N}(1 / (NHK),\mathcal{P},\| \cdot \|_{\infty ,1})NHK^2 /\delta)$ for some absolute constants $C_1$ and $C_2$ in Algorithm 1, it holds with probability at least $1 - \delta$ that the regret for joint optimality (15) and the regret for fair division property (16) of Algorithm 1 satisfies that + +$$ +\operatorname {R e g r e t} _ {\mathrm {C E}, \mathrm {S W M}} (K) \leq \mathcal {O} \left(\sqrt {d H ^ {2} \left(N ^ {2} \beta^ {(1)} + \beta^ {(2)}\right) K}\right). \tag {22} +$$ + +$$ +\operatorname {R e g r e t} _ {\mathrm {F D}} (K) \leq \mathcal {O} \left(\sqrt {d H ^ {2} N ^ {2} \beta^ {(1)} K}\right). \tag {23} +$$ + +We show the exact expression of $\beta^{(1)}$ and $\beta^{(2)}$ in the proof of Theorem 3.4 in Appendix C.1. Theorem 3.4 indicates that the regret for joint optimality of Algorithm 1 is of order $\widetilde{\mathcal{O}} (\sqrt{dH^4N^2K})$ , which shows that MOLM efficiently finds the jointly optimal policy approximately. Besides joint optimality, Algorithm 1 also achieves fair division among agents approximately as a byproduct, i.e., it approximately finds agents' policy which simultaneously achieves SI and PE in the online setting. We specialize Theorem 3.4 to tabular, linear, and kernel cases in Appendix D. + +# 4. Offline Learning Algorithm + +# 4.1. Setup and Learning Objective + +Offline Learning Protocol. Now we study the offline setting where the learner only has access to an offline dataset $\mathcal{D} = \{(s_h^\tau, \{x_h^{\tau,(i)}\}_{i \in [N]}, b_h^\tau, \{u_h^{\tau,(i)}\}_{i \in [N]})\}_{(\tau,h) \in [K] \times [H]}$ which is generated as a prior by an economist in the MEE. + +We characterize the generation process of $\mathcal{D}$ by the following definition. + +Definition 4.1 (Offline Data Generation). The dataset $\mathcal{D}$ consists of $K$ i.i.d. trajectories $\{\mathcal{D}^{\tau}\}_{\tau \in [K]}$ , where each trajectory $\mathcal{D}^{\tau} = \{(s_h^\tau, \{x_h^{\tau,(i)}\}_{i \in [N]}, b_h^\tau, \{u_h^{\tau,(i)}\}_{i \in [N]})\}_{h \in [H]}$ is collected as a prior in the MEE. Specifically, for each $\tau \in [K]$ , it holds that $s_{h+1} \sim P_h(\cdot | s_h^\tau, b_h^\tau)$ , $u_h^{\tau,(i)} = u_h(s_h^\tau, x_h^{\tau,(i)})$ . + +Learning Objective. In offline learning, the goal is to design algorithm that outputs policy pair $(\widehat{\pi}, \widehat{\nu})$ which is joint optimal and achieves fair division. For being joint optimal, we measure the performance of $(\widehat{\pi}, \widehat{\nu})$ by SubOpt $(\widehat{\pi}, \widehat{\nu}, s_1)$ defined in (11). For achieving fair division, we adapt the FD loss defined in (14) to offline setting as follows. + +$$ +\mathcal {L} _ {\mathrm {F D}} (\pi , \nu) = \sum_ {h = 1} ^ {H} \mathbb {E} _ {\rho_ {h}} \left[ \ell_ {h} ^ {\mathrm {F D}} (\nu , s _ {h}) \right], \tag {24} +$$ + +where $\rho_h$ is the visitation measure at step $h\in [H]$ that the dataset $\mathcal{D}$ obeys, i.e., $\rho_h(s,\{x^{(i)}\}_{i\in [N]},b)$ is defined as + +$$ +\mathbb {P} \left(s _ {h} ^ {\tau} = s, \left\{x ^ {\tau , (i)} \right\} _ {i \in [ N ]} = \left\{x _ {h} ^ {(i)} \right\} _ {i \in [ N ]}, b _ {h} ^ {\tau} = b\right), \tag {25} +$$ + +for any $\tau \in [K]$ in $\mathcal{D}$ . We hope to design an algorithm that achieves suboptimality $\mathrm{SubOpt}(\widehat{\pi},\widehat{\nu},s_1)$ and offline FD loss $\mathcal{L}_{\mathrm{FD}}(\widehat{\pi},\widehat{\nu})$ decaying at a negative square root rate with respect to $K$ . + +# 4.2. Algorithm: Model-based Pessimistic Offline Learning for MEE + +We propose Model-based Pessimistic offline Learning for MEE (MPLM, Algorithm 2) to learn the desired planner-agent policy pair, which involves a model estimation step and a pessimistic policy optimization step. We use $\widehat{V}^{(\pi ,\widehat{\nu}),(i)}_{h,(\widehat{P},\widehat{u})}$ to denote the value function of policy pair $(\widehat{\pi},\widehat{\nu})$ induced by the estimated utility function $\widehat{u} = \{\widehat{u}_h^{(i)}\}_{(h,i)\in [H]\times [N]}$ and the estimated transition $\widehat{P} = \{\widehat{P}_h\}_{h\in [H]}$ according to (1). + +Algorithm 2 Model-based Pessimistic Online Learning for Markov Exchange Economy (MPLM) + +Input: Pessimism Parameter $\xi_1, \xi_2$ . Function classes $\mathcal{U}$ and $\mathcal{P}$ . + +1: for $h = 1$ to $H$ do +2: Construct confidence sets $\{\mathcal{U}_{h,\xi_1}^{(i)}\}_{i\in [N]}$ and $\mathcal{P}_{h,\xi_2}$ according to (26), (27). // Model Estimation. +3: end for +4: for $h = 1$ to $H$ do +5: Set $\widehat{u}_h^{(i)}(s,x^{(i)}) = \arg \min_{u\in \mathcal{U}_{h,\xi_1}^{(i)}}u(s,x^{(i)})$ and $\widehat{\nu}_h(s) = \mathbb{C}\mathbb{E}(\{\widehat{u}_h^{(i)}(s,\cdot)\}_{i\in [N]})$ , for any $(i,s,x^{(i)})\in [N]\times \mathcal{S}\times \mathcal{X}^{(i)}$ . +6: end for +7: Set $(\widehat{\pi},\widehat{P}) = \arg \max_{\pi \in \Pi}\min_{\widehat{P}:\{\widehat{P}_h\in \mathcal{P}_{h,\xi_2},\forall h\in [H]\}}\cdot \sum_{i = 1}^{N}\widehat{V}_{1,(\widehat{P},\widehat{u})}^{(\pi ,\widehat{\nu}),(i)}(s_1). / /$ Pessimistic Policy Optimization. + +Output: Policy pair $(\widehat{\pi},\widehat{\nu})$ + +Model Estimation (Line 1 to 3). We first construct confidence sets for the utility $u_h^{(i)}$ and the transition $P_h$ respectively. For $u_h^{(i)}$ , we let the confidence set $\mathcal{U}_{h,\xi_1}^{(i)}$ consist of all functions in $\mathcal{U}$ whose empirical mean squared errors are less than a given threshold $\xi_1$ , i.e., we set $\mathcal{U}_{h,\xi_1}^{(i)}$ as + +$$ +\left\{u \in \mathcal {U}: \frac {1}{K} \sum_ {\tau = 1} ^ {K} \left(u _ {h} ^ {\tau , (i)} - u \left(s _ {h} ^ {\tau}, x _ {h} ^ {\tau , (i)}\right)\right) ^ {2} \leq \xi_ {1} \right\}, \tag {26} +$$ + +For $P_{h}$ , we first obtain the maximum likelihood estimator $\widehat{P}_h^{\mathrm{MLE}}$ that maximizes the empirical likelihood function, i.e., $\widehat{P}_h^{\mathrm{MLE}} = \arg \max_{P\in \mathcal{P}}\sum_{\tau = 1}^{K}\log P(s_{h + 1}^\tau |s_h^\tau ,b_h^\tau)$ . Then we set the confidence set $\mathcal{P}_{h,\xi_2}$ to be transitions in $\mathcal{P}$ whose empirical mean squared TV-distance to $\widehat{P}_h^{\mathrm{MLE}}$ is less than a given threshold $\xi_{2}$ , i.e., we set $\mathcal{P}_{h,\xi_2}$ as + +$$ +\left\{P \in \mathcal {P}: \frac {1}{K} \sum_ {\tau = 1} ^ {K} \| \left(\widehat {P} _ {h} ^ {\mathrm {M L E}} - P\right) \left(\cdot \mid s _ {h} ^ {\tau}, b _ {h} ^ {\tau}\right) \| _ {1} ^ {2} \leq \xi_ {2} \right\}. \tag {27} +$$ + +Pessimistic Optimization (Line 4 to 8). With $\mathcal{U}_{h,\xi_1}^{(i)}$ and $\mathcal{P}_{h,\xi_2}$ , MPLM then performs pessimistic policy optimization to find the policy pair $(\widehat{\pi},\widehat{\nu})$ as its output. Parallel to the online setting, we first solve the sub-problem for agents via choosing the optimal agents' policy $\widehat{\nu}$ with respect to the estimated pessimistic utilities. After, we cast the sub-problem of social welfare maximization for the planner as an offline policy optimization problem in MDP with reward induced by the agents' utilities. Inspired by Uehara & Sun (2021), we solve this sub-problem by jointly optimizing over $\pi$ and $P$ such that the pessimistic social welfare estimator is maximized, which can be formulated as a minimax optimization problem. See Algorithm 2 for a detailed description. + +# 4.3. Main Theoretical Results for Offline Learning + +Our main theoretical results are upper bounds on the suboptimality (11) and offline FD loss (24) incurred by Algorithm 2. To guarantee provably efficient learning, we make certain assumptions on the coverage property of the dataset $\mathcal{D}$ . Recall that the visitation measure $\rho_h$ at step $h\in [H]$ the + +dataset $\mathcal{D}$ obeys is defined in (25). In parallel, we define the visitation measure $d_h^{(\pi ,\nu)}(s,\{x^{(i)}\}_{i\in [N]},b)$ at step $h\in [H]$ of any given joint policy $(\pi ,\nu)$ as + +$$ +\mathbb {P} \left(s _ {h} = s, \left\{x ^ {(i)} \right\} _ {i \in [ N ]} = \left\{x _ {h} ^ {(i)} \right\} _ {i \in [ N ]}, b _ {h} = b \mid \pi , \nu\right). \tag {28} +$$ + +Definition 4.2 (Distribution Shift). We define the distribution shift coefficient between a given joint policy $(\pi, \nu)$ and the dataset visitation measure $\rho = \{\rho_h\}_{h \in [H]}$ as + +$$ +C _ {\rho} ^ {(\pi , \nu)} = \sup _ {h \in [ H ]} \mathbb {E} _ {\rho_ {h}} \left(\frac {d _ {h} ^ {(\pi , \nu)} (s , \{x ^ {(i)} \} _ {i \in [ N ]} , b)}{\rho_ {h} (s , \{x ^ {(i)} \} _ {i \in [ N ]} , b)}\right) ^ {2}. \tag {29} +$$ + +Assumption 4.3 (Partial Coverage). We assume that the distribution shift between all the possible jointly optimal policy and the dataset visitation measure is finite, that is, + +$$ +C _ {\rho} ^ {\star} := \sup _ {\nu \in \mathbf {N} ^ {\star}, \pi \in \Pi^ {\star}} C _ {\rho} ^ {(\pi , \nu)} < \infty , \tag {30} +$$ + +where $\Pi^{\star} := \{\pi^{\star}(\nu) : \nu \in \mathbf{N}\}, \mathbf{N}^{\star} := \{\nu^{\star}(\nu) : \nu \in \mathbf{N}\}$ . + +Similar partial coverage assumptions are widely adopted in offline RL literature (Kidambi et al., 2020; Jin et al., 2021b), which is weaker than uniform coverage assumptions (Munos & Szepesvári, 2008; Chen & Jiang, 2019). The following two theorems are our main results in offline setting. All the omitted proofs are in Appendix C.2 and G. + +Theorem 4.4 (Suboptimality of Algorithm 2). By setting the parameters $\xi_{1}$ as $C_1\log (\mathcal{N}(1 / K,\mathcal{U},\| \cdot \|_{\infty})\cdot NH / \delta) / K$ and $\xi_{2}$ as $C_2\log (\mathcal{N}_{\mathbb{I}}(1 / K,\mathcal{P},\| \cdot \|_{2,\infty})H / \delta) / K$ for some absolute constants $C_1$ and $C_2$ in Algorithm 2, it holds with probability at least $1 - \delta$ that the suboptimality (11) and offline FD loss (24) of Algorithm 2 satisfies + +$$ +\operatorname {S u b O p t} (\widehat {\pi}, \widehat {\nu}) \leq \mathcal {O} \left(\sqrt {H ^ {4} N ^ {2} \iota C _ {\rho} ^ {\star} / K}\right), \tag {31} +$$ + +$$ +\mathcal {L} _ {\mathrm {F D}} (\widehat {\pi}, \widehat {\nu}) \leq \mathcal {O} \left(\sqrt {H ^ {2} N ^ {2} \iota^ {\prime} / K}\right), \tag {32} +$$ + +where $\iota = \log \mathcal{N}_{\mathbb{I}}(1 / K^2,\mathcal{P},\| \cdot \|_{1,\infty}) + \log \mathcal{N}(1 / K^2,\mathcal{U},\| \cdot$ $\|_{\infty}) + \log (HN / \delta)$ $\iota^{\prime} = \log (\mathcal{N}(1 / K^{2},\mathcal{U},\| \cdot \|_{\infty})\cdot NH / \delta)$ and $C_\rho^\star$ is defined in (30). + +According to Theorem 4.4, the suboptimality of Algorithm 2 decays at a rate of $K^{-1/2}$ , which shows that MPLM provably finds the jointly optimal policy approximately from dataset satisfying partial coverage assumptions. Parallel to the online setting, Theorem 4.4 also shows that Algorithm 2 achieves fair division among agents as a byproduct of achieving joint optimality in the offline setting, i.e., Algorithm 2 can output policy of agents which simultaneously achieves SI and PE in offline setting. We specialize Theorem 4.4 to tabular, linear, and kernel cases in Appendix D. + +# 5. Experiments + +To verify our theoretical results, we conduct an experiment for finding joint optimal policies for an MEE in online setting through our proposed MOLM algorithm. The codes are available on https://github.com/YSLIU627/RL-for-Markov-Exchange-Economy. + +Settings. We focus on an MEE with a finite context space $|\mathcal{C}| = 10$ , a finite planner's action space $|\mathcal{B}| = 5$ , type of goods $L = 3$ , a continuous agents' allocation space $[0,1]^L$ , number of agents $N = 3$ , and horizon $H = 3$ . We randomly generate $P \in \mathbb{R}^{|\mathcal{C}|^2 \times |B|}$ for transition kernel and $A \in \mathbb{R}^{|H| \times |\mathcal{C}| \times N \times L}$ for utility functions by + +$$ +u _ {h} ^ {(i)} (c _ {h}, x _ {h} ^ {(i)}) = \sum_ {j = 1} ^ {L} A _ {(h, c _ {h}, i, j)} \cdot x _ {h, j} ^ {(i)}, +$$ + +where we have let endowments $e^{(i)} = \delta_{ij}$ be time-invariant. Here $\delta_{ij} = 1$ if $i = j$ and $\delta_{ij} = 0$ if $i\neq j$ + +Practical Algorithm. We implement our MOLM algorithm for 100 epochs. In order to find CE given utility functions, we adopt the method of PRD (Brânzei et al., 2021) for 10 iterations. Also, for ease of implementation, we adopt the ucb-style optimism with uncertainty quantification + +$$ +\Gamma_ {h} (c, b) = \kappa | \mathcal {C} | H \sqrt {\frac {\log (H | \mathcal {C} | | \mathcal {B} | / \delta)}{(N _ {h} (c , b) \lor 1)}}, +$$ + +which is equivalent to finding the optimistic model in our confidence set (Yang & Wang, 2020). Here $N_{h}(c,b)$ denotes the times for visiting the pair $(c,b)$ , and we use $a \lor b$ to denote $\max \{a,b\}$ . Finally, we adopt the Thompson sampling method (Guo et al., 2021) for optimistic utility estimation. + +Experimental Results. We present the regret of MOLM (defined in (15), the sum of performance gap between MOLM's policy and joint optimal policy) in Figure 1, and we compare it to the linear regret induced by uniformly random policy, showing that MOLM has the sublinear regret, in correspondence to Theorem 3.4. + +![](images/2bda3331e53d1e51596b565ade051ca0f4c74198bbb76ac4508c0266e0abbb77.jpg) +Figure 1. The regret of a uniformly random policy and the policy learned by MOLM. The results are averaged over 5 random seeds. We can see that the uniform random policy incurs a linear regret, while the policy learned by MOLM incurs a sublinear regret. + +# 6. Discussions and Conclusions + +In this work, we design provably efficient learning algorithms for online and offline MEE. Specifically, we propose MOLM/MPLM to learn agents' and planner's policies, respectively, achieving social welfare maximization and competitive equilibrium simultaneously, with fair division as a byproduct. To the best of our knowledge, we have presented the first provably efficient MARL-style algorithms for a bilevel economic system. Exploring and understanding learning methods in this general microeconomic setting promises to greatly extend the scope and range of applications of machine learning systems. + +# Acknowledgements + +Zhaoran Wang acknowledges National Science Foundation (Awards 2048075, 2008827, 2015568, 1934931), Amazon, J.P. Morgan, and Two Sigma for their supports. We would like to thank Wenshuo Guo for valuable discussions. + +# References + +Antos, A., Munos, R., and Szepesvári, C. Fitted q-iteration in continuous action-space mdps. 2007. +Auer, P., Cesa-Bianchi, N., and Fischer, P. Finite-time analysis of the multiarmed bandit problem. Machine learning, 47(2):235-256, 2002. +Auer, P., Jaksch, T., and Ortner, R. Near-optimal regret bounds for reinforcement learning. In Advances in Neural Information Processing Systems, 2009. +Ayoub, A., Jia, Z., Szepesvari, C., Wang, M., and Yang, L. Model-based reinforcement learning with value-targeted regression. In International Conference on Machine Learning, pp. 463-474. PMLR, 2020. + +Azar, M. G., Osband, I., and Munos, R. Minimax regret bounds for reinforcement learning. In International Conference on Machine Learning, pp. 263-272. PMLR, 2017. +Babaioff, M., Kleinberg, R., and Slivkins, A. Multi-parameter mechanisms with implicit payment computation. In Proceedings of the fourteenth ACM conference on Electronic commerce, pp. 35-52, 2013. +Babaioff, M., Nisan, N., and Talgam-Cohen, I. Fair allocation through competitive equilibrium from generic incomes. In FAT, pp. 180, 2019. +Babaioff, M., Nisan, N., and Talgam-Cohen, I. Competitive equilibrium with indivisible goods and generic budgets. Mathematics of Operations Research, 46(1):382-403, 2021. +Bai, Y., Jin, C., Wang, H., and Xiong, C. Sample-efficient learning of stackelberg equilibria in general-sum games. arXiv preprint arXiv:2102.11494, 2021. +Balcan, M.-F. F., Sandholm, T., and Vitercik, E. Sample complexity of automated mechanism design. In Advances in Neural Information Processing Systems, pp. 2083-2091, 2016. +Basar, T. and Olsder, G. J. Dynamic noncooperative game theory. SIAM, 1998. +Bergemann, D. and Valimaki, J. Efficient dynamic auctions. 2006. +Blaug, M. The fundamental theorems of modern welfare economics, historically contemplated. History of Political Economy, 39(2):185-207, 2007. +Brânzei, S., Devanur, N., and Rabani, Y. Proportional dynamics in exchange economies. In Proceedings of the 22nd ACM Conference on Economics and Computation, pp. 180-201, 2021. +Bucarey, V., Jean-Marie, A., Della Vecchia, E., and Ordóñez, F. On the value iteration method for dynamic strong stackelberg equilibria. In ROADEF 2019-20ème congress annuel de la société Française de Recherche Opérationnelle et d'Aide à la Decision, 2019. +Buckman, J., Gelada, C., and Bellemare, M. G. The importance of pessimism in fixed-dataset policy optimization. arXiv preprint arXiv:2009.06799, 2020. +Budish, E., Cachon, G. P., Kessler, J. B., and Othman, A. Course match: A large-scale implementation of approximate competitive equilibrium from equal incomes for combinatorial allocation. Operations Research, 65(2): 314-336, 2017. + +Busoniu, L., Babuska, R., and De Schutter, B. A comprehensive survey of multiagent reinforcement learning. IEEE Transactions on Systems, Man, and Cybernetics, Part C (Applications and Reviews), 38(2):156-172, 2008. +Cai, Q., Yang, Z., Jin, C., and Wang, Z. Provably efficient exploration in policy optimization. In International Conference on Machine Learning, pp. 1283-1294. PMLR, 2020a. +Cai, Q., Yang, Z., Szepesvari, C., and Wang, Z. Optimistic policy optimization with general function approximations. 2020b. +Cao, D. Recursive equilibrium in krusell and smith (1998). Journal of Economic Theory, 186:104978, 2020. +Chatrapati, K. S., Rekha, J. U., and Babu, A. V. Recursive competitive equilibrium approach for dynamic load balancing a distributed system. In International Conference on Distributed Computing and Internet Technology, pp. 162-174. Springer, 2011. +Chen, J. and Jiang, N. Information-theoretic considerations in batch reinforcement learning. In International Conference on Machine Learning, pp. 1042-1051. PMLR, 2019. +Cohen, K. J. and Cyert, R. M. Theory of the firm; resource allocation in a market economy. Technical report, Prentice-Hall, 1965. +Debreu, G. Existence of competitive equilibrium. Handbook of mathematical economics, 2:697-743, 1982. +Delimitrou, C. and Kozyrakis, C. Paragon: Qos-aware scheduling for heterogeneous datacenters. ACM SIGPLAN Notices, 48(4):77-88, 2013. +Dissanayake, I., Zhang, J., and Gu, B. Task division for team success in crowdsourcing contests: Resource allocation and alignment effects. Journal of Management Information Systems, 32(2):8-39, 2015. +Dudík, M., Haghtalab, N., Luo, H., Schapire, R. E., Syrgkànis, V., and Vaughan, J. W. Oracle-efficient online learning and auction design. In 2017 IEEE 58th annual symposium on foundations of computer science (focuss), pp. 528-539. IEEE, 2017. +Geer, S. A., van de Geer, S., and Williams, D. Empirical Processes in M-estimation, volume 6. Cambridge university press, 2000. +Georgiadis, L., Neely, M. J., and Tassiulas, L. Resource allocation and cross-layer control in wireless networks. Now Publishers Inc, 2006. + +Guo, W., Kandasamy, K., Gonzalez, J. E., Jordan, M. I., and Stoica, I. Online learning of competitive equilibria in exchange economies. arXiv preprint arXiv:2106.06616, 2021. +Hernandez-Leal, P., Kartal, B., and Taylor, M. E. Is multiagent deep reinforcement learning the answer or the question? a brief survey. learning, 21:22, 2018. +Hernandez-Leal, P., Kartal, B., and Taylor, M. E. A survey and critique of multiagent deep reinforcement learning. Autonomous Agents and Multi-Agent Systems, 33(6):750-797, 2019. +Hindman, B., Konwinski, A., Zaharia, M., Ghodsi, A., Joseph, A. D., Katz, R. H., Shenker, S., and Stoica, I. Mesos: A platform for fine-grained resource sharing in the data center. In NSDI, volume 11, pp. 22-22, 2011. +Hussain, H., Malik, S. U. R., Hameed, A., Khan, S. U., Bickler, G., Min-Allah, N., Qureshi, M. B., Zhang, L., Yongji, W., Ghani, N., et al. A survey on resource allocation in high performance distributed computing systems. Parallel Computing, 39(11):709-736, 2013. +Jehle, G. A. Advanced microeconomic theory. Pearson Education India, 2001. +Jin, C., Allen-Zhu, Z., Bubeck, S., and Jordan, M. I. Is Q-learning provably efficient? In Advances in Neural Information Processing Systems, 2018. +Jin, C., Yang, Z., Wang, Z., and Jordan, M. I. Provably efficient reinforcement learning with linear function approximation. In Annual Conference on Learning Theory, 2019. +Jin, C., Liu, Q., and Miryoosefi, S. Bellman eluder dimension: New rich classes of rl problems, and sample-efficient algorithms. arXiv preprint arXiv:2102.00815, 2021a. +Jin, Y., Yang, Z., and Wang, Z. Is pessimism provably efficient for offline rl? In International Conference on Machine Learning, pp. 5084-5096. PMLR, 2021b. +Kahn, A. J. Theory and practice of social planning. Russell Sage Foundation, 1969. +Kakade, S. M., Lobel, I., and Nazerzadeh, H. An optimal dynamic mechanism for multi-armed bandit processes. arXiv preprint arXiv:1001.4598, 2010. +Kandasamy, K., Gonzalez, J. E., Jordan, M. I., and Stoica, I. Mechanism design with bandit feedback. arXiv preprint arXiv:2004.08924, 2020. + +Kidambi, R., Rajeswaran, A., Netrapalli, P., and Joachims, T. Morel: Model-based offline reinforcement learning. arXiv preprint arXiv:2005.05951, 2020. +Kutschinski, E., Uthmann, T., and Polani, D. Learning competitive pricing strategies by multi-agent reinforcement learning. Journal of Economic Dynamics and Control, 27 (11-12):2207-2218, 2003. +Liu, Y., Swaminathan, A., Agarwal, A., and Brunskill, E. Provably good batch reinforcement learning without great exploration. arXiv preprint arXiv:2007.08202, 2020. +Lussange, J., Lazarevich, I., Bourgeois-Gironde, S., Palminteri, S., and Gutkin, B. Modelling stock markets by multi-agent reinforcement learning. Computational Economics, 57(1):113-147, 2021. +Mankiw, N. G., Weinzierl, M., and Yagan, D. Optimal taxation in theory and practice. Journal of Economic Perspectives, 23(4):147-74, 2009. +Mannion, P., Mason, K., Devlin, S., Duggan, J., and Howley, E. Dynamic economic emissions dispatch optimisation using multi-agent reinforcement learning. In Proceedings of the Adaptive and Learning Agents workshop (at AAMAS 2016), 2016. +Mas-Colell, A., Whinston, M. D., Green, J. R., et al. Microeconomic theory, volume 1. Oxford university press New York, 1995. +Mehra, R. Recursive competitive equilibrium, 2006. +Min, Y., Wang, T., Xu, R., Wang, Z., Jordan, M. I., and Yang, Z. Learn to match with no regret: Reinforcement learning in markov matching markets. arXiv preprint arXiv:2203.03684, 2022. +Mirrlees, J. A. Optimal tax theory: A synthesis. Journal of public Economics, 6(4):327-358, 1976. +Munos, R. and Szepesvári, C. Finite-time bounds for fitted value iteration. Journal of Machine Learning Research, 9 (5), 2008. +OroojlooyJadid, A. and Hajinezhad, D. A review of cooperative multi-agent deep reinforcement learning. arXiv preprint arXiv:1908.03963, 2019. +Rajaraman, N., Yang, L. F., Jiao, J., and Ramachandran, K. Toward the fundamental limits of imitation learning. arXiv preprint arXiv:2009.05990, 2020. +Rashidinejad, P., Zhu, B., Ma, C., Jiao, J., and Russell, S. Bridging offline reinforcement learning and imitation learning: A tale of pessimism. arXiv preprint arXiv:2103.12021, 2021. + +Rauch, D. E. and Schleicher, D. Like uber, but for local government law: the future of local regulation of the sharing economy. Ohio St. LJ, 76:901, 2015. +Ross, S. and Bagnell, J. A. Agnostic system identification for model-based reinforcement learning. arXiv preprint arXiv:1203.1007, 2012. +Russo, D. and Van Roy, B. Eluder dimension and the sample complexity of optimistic exploration. In NIPS, pp. 2256-2264. CiteSeer, 2013. +Russo, D. and Van Roy, B. Learning to optimize via posterior sampling. Mathematics of Operations Research, 39 (4):1221-1243, 2014. +Rzadca, K., Findeisen, P., Swiderski, J., Zych, P., Broniek, P., Kusmierek, J., Nowak, P., Strack, B., Witusowski, P., Hand, S., et al. Autopilot: workload autoscaling at google. In Proceedings of the Fifteenth European Conference on Computer Systems, pp. 1-16, 2020. +Salyer, K. D. Interpreting a stochastic monetary growth model as a modified social planner's problem. Journal of Economic Dynamics and Control, 20(4):681-689, 1996. +Sen, B. A gentle introduction to empirical process theory and applications, 2018. +Steinwart, I. and Christmann, A. Support vector machines. Springer Science & Business Media, 2008. +Tiwari, M., Groves, T., and Cosman, P. C. Competitive equilibrium bitrate allocation for multiple video streams. IEEE Transactions on Image Processing, 19(4):1009-1021, 2009. +Uehara, M. and Sun, W. Pessimistic model-based offline reinforcement learning under partial coverage. arXiv preprint arXiv:2107.06226, 2021. +Varian, H. R. Equity, envy, and efficiency. 1973. +Varian, H. R. and Varian, H. R. Microeconomic analysis, volume 3. Norton New York, 1992. +Vavilapalli, V. K., Murthy, A. C., Douglas, C., Agarwal, S., Konar, M., Evans, R., Graves, T., Lowe, J., Shah, H., Seth, S., et al. Apache hadoop yarn: Yet another resource negotiator. In Proceedings of the 4th annual Symposium on Cloud Computing, pp. 1-16, 2013. +Venkataraman, S., Yang, Z., Franklin, M., Recht, B., and Stoica, I. Ernest: Efficient performance prediction for large-scale advanced analytics. In 13th {USENIX} Symposium on Networked Systems Design and Implementation (\{NSDI\} 16), pp. 363-378, 2016. + +Vershynin, R. Introduction to the non-asymptotic analysis of random matrices. arXiv preprint arXiv:1011.3027, 2010. +Wang, Y., Wang, R., Du, S. S., and Krishnamurthy, A. Optimism in reinforcement learning with generalized linear function approximation. arXiv preprint arXiv:1912.04136, 2019. +Wolski, R., Plank, J. S., Brevik, J., and Bryan, T. Analyzing market-based resource allocation strategies for the computational grid. The International Journal of High Performance Computing Applications, 15(3):258-281, 2001. +Xie, T., Cheng, C.-A., Jiang, N., Mineiro, P., and Agarwal, A. Bellman-consistent pessimism for offline reinforcement learning. arXiv preprint arXiv:2106.06926, 2021. +Yang, L. and Wang, M. Reinforcement learning in feature space: Matrix bandit, kernels, and regret bound. In International Conference on Machine Learning, pp. 10746-10756, 2020. +Yang, M., Nachum, O., Dai, B., Li, L., and Schuurmans, D. Off-policy evaluation via the regularized lagrangian. arXiv preprint arXiv:2007.03438, 2020. +Zahedi, S. M., Llull, Q., and Lee, B. C. Amdahl's law in the datacenter era: A market for fair processor allocation. In 2018 IEEE International Symposium on High Performance Computer Architecture (HPCA), pp. 1-14. IEEE, 2018. +Zanette, A. Exponential lower bounds for batch reinforcement learning: Batch rl can be exponentially harder than online rl. In International Conference on Machine Learning, pp. 12287-12297. PMLR, 2021. +Zhang, K., Yang, Z., and Bāsar, T. Multi-agent reinforcement learning: A selective overview of theories and algorithms. Handbook of Reinforcement Learning and Control, pp. 321-384, 2021. +Zhang, L. Proportional response dynamics in the fishermarket. Theoretical Computer Science, 412(24):2691- 2698, 2011. +Zhang, Z., Zhou, Y., and Ji, X. Almost optimal model-free reinforcement learning via reference-advantage decomposition. arXiv preprint arXiv:2004.10019, 2020. +Zheng, S., Trott, A., Srinivasa, S., Naik, N., Gruesbeck, M., Parkes, D. C., and Socher, R. The ai economist: Improving equality and productivity with ai-driven tax policies. arXiv preprint arXiv:2004.13332, 2020. + +Zheng, S., Trott, A., Srinivasa, S., Parkes, D. C., and Socher, R. The ai economist: Optimal economic policy design via two-level deep reinforcement learning. arXiv preprint arXiv:2108.02755, 2021. +Zhong, H., Yang, Z., Wang, Z., and Jordan, M. I. Can reinforcement learning find stackelberg-nash equilibria in general-sum markov games with myopic followers? arXiv preprint arXiv:2112.13521, 2021. + +# A. Notations + +Throughout this paper, we denote by $[N] = \{1,\dots,N\}$ . We also denote by $\Delta (\mathcal{X})$ the probability space on set $\mathcal{X}$ . We denote by $a = \mathcal{O}(b)$ if there exists an absolute constant $c$ such that $a\leq cb$ when $a$ and $b$ are both large enough. We use $\widetilde{\mathcal{O}} (\cdot)$ to hide the constants term and logarithmic terms in $\mathcal{O}(\cdot)$ . We use $\operatorname {Clip}_{[a,b]}(c)$ to represent $\min \{\max \{a,c\},b\}$ for real numbers $a,b$ , and $c$ . We use $\{a\}^{+}$ to represent $\max \{a,0\}$ for real number $a$ . Given a function class $\mathcal{F}$ , we denote by $\mathcal{N}(\epsilon ,\mathcal{F},\| \cdot \|)$ the $\epsilon$ -covering number of $\mathcal{F}$ by $\| \cdot \|$ norm, and we denote by $\mathcal{N}_{\llbracket}(\epsilon ,\mathcal{F},\| \cdot \|)$ the $\epsilon$ -bracket number of $\mathcal{F}$ by $\| \cdot \|$ norm. For function class $\mathcal{P}:S\times \mathcal{B}\mapsto \Delta (S)$ , we denote by $\| P\|_{1,\infty} = \sup_{s,b}\int_{S}|P(s^{\prime}|s,b)|\mathrm{d}s^{\prime}$ for any $P\in \mathcal{P}$ . We define that $\delta_{ij} = 1$ if $i = j$ and $\delta_{ij} = 0$ if $i\neq j$ . For a distribution $\rho$ , we use $\mathbb{E}_{\rho}[\cdot ]$ and $\mathbb{V}_{\rho}[\cdot ]$ to denote the expectation and the variance taken with respect to $\rho$ , respectively. + +
General NotationExplanation
sh=(ch,eh(1),···,eh(N))∈Sstate at step h, ch∈C is context, eh(i)∈E is endowments of theithagent
ah=(xh(1),···,xh(N),ph)∈Aaction of agents at step h, xh(i)∈X(i) is allocation of theithagent, ph∈[0,1]L is price
bh∈Baction of planner at step h
uh(i)utility function of theithagent at step h
Phtransition kernel at step h
ν={νh}h∈[H]agents' policy, νh=(νh(1),···,νh(N),νhP)
ν*={νh*}h∈[H]optimal agents' policy νh*=(νh*,(1),···,νh*,(N),νh*,P)
ν*({νh}ν)={νh(ν)}h∈[H]best responce agents' policy of ννh*({νh})=(νh*,(1)(ν),···,νh*,(N)(ν),νh*,P(ν))
π={πh}h∈[H]planner's policy
π*({νh}ν)={πh*}ν(h∈[H]optimal planner's policy given agents' policy ν (Definition 2.5)
π†({νh})={πh†}ν(h∈[H]abbreviation of π*(ν*({ν}))
Vh(π,ν),(i),Qh(π,ν),(i)value functions of policy pair (π,ν) for theithagent at step h
+ +
Notations for Online SettingExplanation
shk=(chk,ehk,(1), ..., ehk,(N)) ∈ Sstate at step h of episode k
ahk=(xh,k,(1), ..., xhk,(N), phk) ∈ Aaction of agents at step h of episode k
bhk∈Baction of planner at step h of episode k
uhk,(i)utility of theithagent at step h of episode k
Uhk,(i)confidence set of utility functions for theithagent at step h of episode k
Phkconfidence set of transition kernels at step h of episode k
uhk,(i)optimistic utility function estimator of theithagent at step h of episode k
Pfkoptimistic transition estimator at step h of episode k
νk= {νhk}h∈[H]agents' policy of episode k, νhk=(νhk,(1), ..., νhk,(N), νhk,k,p)
πk= {πhk}h∈[H]planner's policy of episode k
Vhk,(i), Qhk,(i)value function estimators at step h of episode k
Notation for Offline SettingExplanation
shτ=(chτ,ehτ(1),···,ehτ(N))∈Sstate at step h in dataset D
ahτ=(xτ(1),···,xτ(N),phτ)∈Aaction of agents at step h in dataset D
bhτ∈Baction of planner at step h in dataset D
uhτ(i)utility of theithagent in dataset D
Uh(h,ξ1)confidence set of utility functions for theithagent at step h
Ph,h,ξ2confidence set of transition kernels at step h
u(h)(i)pessimistic utility function estimator of theithagent at step h
Pppessimistic transition estimator at step h
ˆν={ˆνh}h∈[H]estimated optimal agents' policy,ˆνh=(ˆνh(1),···,ˆνh(N),ˆνp)
ˆπ={ˆπh}h∈[H]estimated optimal planner's policy
V(π,ˆv),(i)value function of (ˆπ,ˆv) induced byˆu={ˆu(h)(i)}{h,i∈[H]×[N] andˆP={ˆPh}h∈[H]
h,(ˆP,ˆu)
+ +For the completeness of the paper, we provide the definitions of covering number and bracketing number as follows. + +Definition A.1 (Covering Number by $\| \cdot \|$ -norm). Let $\mathcal{N}(\delta ,\mathcal{G},\| \cdot \|)$ be the smallest value of $M$ for which there exist a subset $\{g_j^{\mathrm{Cover}}\}_{j\in [M]}\subset \mathcal{G}$ such that for each $g\in \mathcal{G}$ , there is a $j = j(g)\in [M]$ such that + +$$ +\left\| g _ {j} ^ {\text {C o v e r}} - g \right\| \leq \delta . +$$ + +Definition A.2 (Bracketing Number by $\| \cdot \|$ -norm (Geer et al., 2000)). Let $\mathcal{N}_{\mathbb{I}}(\delta, \mathcal{G}, \| \cdot \|)$ be the smallest value of $M$ for which there exist pairs of functions $\{[g_j^L, g_j^U]\}_{j \in [M]}$ such that $\| g_j^U - g_j^L \| \leq \delta$ for all $j \in [M]$ , and for each $g \in \mathcal{G}$ , there is a $j = j(g) \in [M]$ such that + +$$ +g _ {j} ^ {L} \leq g \leq g _ {j} ^ {U}. +$$ + +# B. Related Work + +We present detailed discussions on the related work in this section. + +Machine learning for Economy. Our work adds to the vast body of existing literature on applying machine learning methods to solving various economical issues, where the utility functions for agents are not given a priori but learnable. For EE, Guo et al. (2021) propose the first online learning mechanism which adopts generalized linear function approximation and achieves $\widetilde{O}(\sqrt{K})$ online regret and online fair division loss. This theoretical result matches the conclusion of our proposed mechanism, when MEE is specialized to EE and the function class of utility is chosen as generalized linear function. Aimed at analyzing the optimal allocation rules among agents, the automated mechanism design of revenue-maximizing combinatorial auctions has been widely studied with online learning methods (Bergemann & Valimaki, 2006; Kakade et al., 2010; Babaioff et al., 2013; Balcan et al., 2016; Dudik et al., 2017; Kandasamy et al., 2020). They analyze the online regret of the proposed mechanism even under the dynamic setting, while they do not consider bilevel economic systems and general function approximations for handling continuous state space as in this paper. Besides, several other works also adopt deep RL in multi-agent economic simulations, achieving empirical success (Zheng et al., 2021). Among them, Zheng et al. (2021) provide the first experimental MARL framework for the policy design of bilevel economic systems and obtain satisfactory results on the simulation baseline. However, the theory behind MARL methods is less studied. More recently, Min et al. (2022) apply MARL to study the problem of matching in a Markov matching market. + +Exchange Economy. Our work is based on a rich line of aforementioned works in CE and fair division of EE (Cohen & Cyert, 1965; Debreu, 1982; Georgiadis et al., 2006; Zhang, 2011; Dissanayake et al., 2015). Under certain regularity conditions on utility functions, Debreu (1982) study the existence of CE of EE and Zhang (2011) propose a computationally efficient algorithm to compute CE of EE, both of which lay the foundation of our work. Besides, fair division of EE has been studied from both theoretical aspects (Varian, 1973; Budish et al., 2017; Babaioff et al., 2019; 2021) and practical points of view (Wolski et al., 2001; Vavilapalli et al., 2013; Zahedi et al., 2018). However, most previous works on EE assume the full knowledge of the utility functions of agents. As the initial attempt for learning unknown utility, some works (Zahedi et al., 2018; Le et al., 2020) assert some explicit but also restrictive assumptions on utility. + +Moreover, Mehra (2006); Chatrapati et al. (2011); Cao (2020) study recursive CE (RCE) on dynamic EE, where agents exchange resources for multiple timesteps but no planner is involved. Cao (2020) study the existence of RCE under several restrictive assumptions on the transition kernel of dynamic EE. Different from MEE, dynamic EE neglects the co-adaptation between the agents and the planner and hence is not our interested bilevel system. + +Social Planning Problem. Our work is also related to the social planning problem (SPP), a classic topic in welfare economics (Kahn, 1969; Salyer, 1996; Blaug, 2007). In SPP, a social planner who desires to maximize a predefined social welfare function can make all decisions in the economy. Different from EE, there is no price system in SPP, while the second social welfare theorem (Blaug, 2007) shows that any SPP can be decentralized to solving CE. Since SPP ignores the co-adaptation between the social planner and the agents in the economy, previous works on SPP can not solve or decentralize bilevel systems, such as MEE. + +Multi-Agent Reinforcement Learning and Stackelberg Equilibrium. Our work is also related to a rich line of works in MARL which extends RL to decision-making involving multiple interacting agents (Busoniu et al., 2008; Hernandez-Leal et al., 2018; 2019; OroojlooyJadid & Hajinezhad, 2019; Zhang et al., 2021). We advocate MARL as a principled method for solving economical issues. In MARL, agents might have asymmetric roles such leader-follower structure (Bucarey et al., 2019; Bai et al., 2021; Zhong et al., 2021) which is related to our work, while previous works mainly focus on finding the Stackelberg-Nash equilibrium (Başar & Olsder, 1998). Among these works, our MARL application in economics is most related to Zhong et al. (2021) who also study a myopic follower setting. In contrast, in their work the followers aim to find Nash equilibrium while we hope to find competitive equilibrium in EE. Also, we study general function approximations which bears more generality when handling large state space. + +Optimism and Online Reinforcement Learning. Our work is related to another flurry line of works studying online RL cooperated with optimism. wFor tabular setting where state space is finite, how to propose online RL algorithms achieving $\tilde{\mathcal{O}} (\sqrt{K})$ online regret is thoroughly studied (Azar et al., 2017; Jin et al., 2018; Zhang et al., 2020). Adopting the principle of Optimism in the face of Uncertainty (OFU) (Auer et al., 2002; 2009; Jin et al., 2018; 2019), they overestimate action-value functions by adding a bonus to incentive exploration. When the state space is large or even continuous, the use of function approximation is necessary. Also based on OFU, there are several researches (Jin et al., 2019; Wang et al., 2019; Cai et al., 2020a) apply (generalized) linear function approximation on the transition kernel or action-value function and prove $\tilde{\mathcal{O}} (\sqrt{K})$ online regret. Beyond linear setting, a recent line of works study RL with general function approximation (Ayoub et al., 2020; Cai et al., 2020b; Jin et al., 2021a). Based on the notion of eluder dimension introduced by Russo & Van Roy (2014) that characterizes the complexity of function class, Ayoub et al. (2020); Cai et al. (2020b) combine non-linear value target regression and OFU, proposing online RL algorithms with general function approximations achieving $\tilde{\mathcal{O}} (\sqrt{K})$ online regret. Jin et al. (2021a) also achieve such a goal by proposing a more generalized complexity measure: Bellman eluder dimension. All works mentioned above study RL problem involving a single agent, which is different from our interested bilevel systems. + +Pessimism and Offline Reinforcement Learning. Our works are also related to many literature concerning pessimism and offline RL in recent years (Liu et al., 2020; Rashidinejad et al., 2021; Jin et al., 2021b; Xie et al., 2021; Uehara & Sun, 2021). Different from online RL, the introduction of offline dataset leads to a potential distribution shift. When the dataset has no coverage guarantee, Buckman et al. (2020); Zanette (2021) find that the lower bound of offline RL could even be exponential. Rather than assuming a well-explored dataset in many previous literature (Antos et al., 2007; Munos & Szepesvári, 2008; Yang et al., 2020; Ross & Bagnell, 2012; Chen & Jiang, 2019), several works (Rajaraman et al., 2020; Kidambi et al., 2020; Jin et al., 2021b) adopt pessimism in model estimation and prove $\widetilde{\mathcal{O}}(K^{-1/2})$ suboptimality even under a partial coverage dataset. Liu et al. (2020) propose a pessimistic variant of fitted Q-learning algorithm (Antos et al., 2007), achieving the optimal policy within a restricted class of policies without assuming the dataset to be well-explored. Jin et al. (2021b) propose a provably efficient algorithm with the spirit of pessimism to solve offline RL with linear function approximations, under no coverage assumption on the dataset. Rashidinejad et al. (2021) study the offline RL in the tabular case through lower confidence bound (LCB), only assuming the partial coverage assumption on the dataset. With general function approximations on offline RL and partial coverage dataset, the suboptimality bound $\widetilde{\mathcal{O}}(K^{-1/2})$ is achieved by both model-based (Uehara & Sun, 2021) and model-free (Xie et al., 2021) algorithms. They both apply Berstein inequality to sharpen the convergence rate to $\widetilde{\mathcal{O}}(K^{-1/2})$ . Besides, all works mentioned above analyze the optimization problem over a single agent, different from a bilevel system. + +# C. Omitted Algorithms and Proof Sketches + +# C.1. Online Setting + +# C.1.1. OMITTED ALGORITHMS + +We present the omitted algorithm ME (Algorithm 3) for model estimation and OPL (Algorithm 4) for optimistic planning respectively. + +# Algorithm 3 Model Estimation (ME) + +Input: Feasible utility set $\mathcal{U}$ and transition set $\mathcal{P}$ . Historical data $\{(s_h^\tau, a_h^\tau, b_h^\tau, \{u_h^{\tau,(i)}\}_{i \in [N]})\}_{(\tau,h) \in [k-1] \times [H]}$ and value function estimators $\{V_{h+1}^{\tau,(i)}\}_{(\tau,h,i) \in [k-1] \times [H] \times [N]}$ . Optimism parameter $\beta^{(1)}, \beta^{(2)}$ . + +1: for $h = 1$ to $H$ do +2: $u_{h}^{k,(i)} = \operatorname*{argmin}_{u\in \mathcal{U}}\sum_{\tau = 1}^{k - 1}(u_{h}^{\tau ,(i)} - u(s_{h}^{\tau},x_{h}^{\tau ,(i)}))^{2}$ , for all $i\in [N]$ +3: $\mathcal{U}_h^{k,(i)} = \{u\in \mathcal{U}:\sum_{\tau = 1}^{k - 1}(u_h^{k,(i)}(s_h^\tau ,x_h^{\tau ,(i)}) - u(s_h^\tau ,x_h^{\tau ,(i)}))^2\leq \beta^{(1)}\}$ for all $i\in [N]$ +4: $P_{h}^{k} = \operatorname{argmin}_{P\in \mathcal{P}}\sum_{\tau = 1}^{k - 1}(\sum_{i = 1}^{N}V_{h + 1}^{\tau ,(i)}(s_{h + 1}^{\tau}) - \int_{\mathcal{S}}\sum_{i = 1}^{N}V_{h + 1}^{\tau ,(i)}(s^{\prime})P(\mathrm{d}s^{\prime}|s_{h}^{\tau},b_{h}^{\tau}))^{2}.$ +5: $\mathcal{P}_h^k = \{P\in \mathcal{P}:\sum_{\tau = 1}^{k - 1}(\int_{\mathcal{S}}\sum_{i = 1}^N V_{h + 1}^{\tau ,(i)}(s')P_h^k (s'|s_h^\tau ,b_h^\tau)\mathrm{d}s' - \int_{\mathcal{S}}\sum_{i = 1}^N V_{h + 1}^{\tau ,(i)}(s')P(s'|s_h^\tau ,b_h^\tau))^2\leq \beta^{(2)}\} .$ +6: end for +7: Return $\{\mathcal{U}_h^{k,(i)}\}_{(h,i)\in [H]\times [N]}$ and $\{\mathcal{P}_h^k\}_{h\in [H]}$ . + +# Algorithm 4 Optimistic Planning (OPL) + +Input: Utility confidence sets $\{\mathcal{U}_h^{k,(i)}\}_{(h,i)\in [H]\times [N]}$ and transition confidence sets $\{\mathcal{P}_h^k\}_{h\in [H]}$ . + +1: for $h = H$ to 1 do +2: $\widehat{u}_h^{k,(i)}(\cdot ,\cdot) = \arg \max_{u\in \mathcal{U}_h^{k,(i)}}u(\cdot ,\cdot),\forall i\in [N].$ +3: $\widehat{P}_h^k (\cdot |\cdot ,\cdot) = \arg \max_{P\in \mathcal{P}_h^k}\int_S\sum_{i = 1}^N V_{h + 1}^{k,(i)}(s')P(\mathrm{d}s'|\cdot ,\cdot).$ +4: $\nu_{h}^{k}(\cdot) = \mathrm{CE}\big(\{\widehat{u}_{h}^{k,(i)}(\cdot ,\cdot)\}_{i\in [N]}\big).$ +5: $\pi_h^k (\cdot) = \arg \max_{b\in \mathcal{B}}\sum_{i = 1}^N\int_S V_{h + 1}^{k,(i)}(s')\widehat{P}_h^k (\mathrm{d}s'|\cdot ,b).$ +6: $Q_{h}^{k,(i)}(\cdot ,\cdot ,\cdot) = \hat{u}_{h}^{k,(i)}(\cdot ,\cdot) + \mathsf{Clip}_{[0,H - h]}\{\int_{\mathcal{S}}V_{h + 1}^{k,(i)}(s^{\prime})\widehat{P}_{h}^{k}(\mathrm{d}s^{\prime}|\cdot ,\cdot)\}, \forall i\in [N].$ +7: $V_{h}^{k,(i)}(\cdot) = Q_{h}^{k,(i)}(\cdot, \nu_{h}^{k,(i)}(\cdot), \pi_{h}^{k}(\cdot)), \forall i \in [N]$ . +8: end for + +# C.1.2. PROOF SKETCH OF THEOREM 3.4 + +In the sequel, we sketch the proof of the first conclusion of Theorem 3.4, i.e., the upper bound on the regret for joint optimality. Missing details are left to Appendix F. The proof of the regret for fair division property is left to Appendix F.4. We start from a decomposition of the online learning regret in the following lemma. + +Lemma C.1 (Regret Decomposition). We can decompose the online regret defined in (15) as following, + +$$ +\begin{array}{l} \operatorname {R e g r e t} (K) = \sum_ {k = 1} ^ {K} \sum_ {h = 1} ^ {H} \sum_ {i = 1} ^ {N} \mathbb {E} _ {\pi^ {\dagger} (\nu^ {k}), \nu^ {\star} (\nu^ {k})} \left[ Q _ {h} ^ {k, (i)} (s _ {h} ^ {k}, \nu_ {h} ^ {\star , (i)} (\nu^ {k}) (s _ {h} ^ {k}), \pi_ {h} ^ {\dagger} (\nu^ {k}) (s _ {h} ^ {k})) - Q _ {h} ^ {k, (i)} (s _ {h} ^ {k}, \nu_ {h} ^ {k, (i)} (s _ {h} ^ {k}), \pi_ {h} ^ {k} (s _ {h} ^ {k})) \right] \\ + \sum_ {k = 1} ^ {K} \sum_ {h = 1} ^ {H} \mathbb {E} _ {\pi^ {\dagger} (\nu^ {k}), \nu^ {\star} (\nu^ {k})} \left[ \iota_ {h} ^ {k} \left(s _ {h} ^ {k}, a _ {h} ^ {k}, b _ {h} ^ {k}\right) \right] + \sum_ {k = 1} ^ {K} \sum_ {i = 1} ^ {N} V _ {1} ^ {k, (i)} \left(s _ {1} ^ {k}\right) - V _ {1} ^ {\left(\pi^ {k}, \nu^ {k}\right), (i)} \left(s _ {1} ^ {k}\right), \tag {33} \\ \end{array} +$$ + +where $\iota_h^k (\cdot ,\cdot ,\cdot)$ is defined as for any $(s_h,a_h,b_h)\in \mathcal{S}\times \mathcal{A}\times \mathcal{B},$ + +$$ +\iota_ {h} ^ {k} \left(s _ {h}, a _ {h}, b _ {h}\right) = \sum_ {i = 1} ^ {N} u _ {h} ^ {(i)} \left(s _ {h}, x _ {h} ^ {(i)}\right) + \int_ {\mathcal {S}} V _ {h + 1} ^ {k, (i)} \left(s ^ {\prime}\right) P _ {h} \left(\mathrm {d} s ^ {\prime} \mid s _ {h}, b _ {h}\right) - Q _ {h} ^ {k, (i)} \left(s _ {h}, x _ {h} ^ {(i)}, b _ {h}\right). \tag {34} +$$ + +Here the functions $V_h^{k,(i)}, Q_h^{k,(i)}$ , and the policies $(\pi_h^k, \nu_h^k)$ are selected by Algorithm 1. + +Proof of Lemma C.1. See Appendix F.1 for a detailed proof. + +Therefore, it suffices to establish upper bounds for each term on the right-hand side of (33). The first term is characterized by the following lemma, which is derived from the choice of $(\pi^k,\nu^k)$ on each episode. + +Lemma C.2 (One-Step Competitive Equilibrium and Social Welfare Maximization). According to Algorithm 1, for any $(k,h) \in [K] \times [H]$ and any $s_h \in S$ , it holds that + +$$ +\sum_ {i = 1} ^ {N} Q _ {h} ^ {k, (i)} \left(s _ {h} ^ {k}, \nu_ {h} ^ {\star , (i)} \left(\nu^ {k}\right) \left(s _ {h} ^ {k}\right), \pi_ {h} ^ {\dagger} \left(\nu^ {k}\right) \left(s _ {h} ^ {k}\right)\right) - Q _ {h} ^ {k, (i)} \left(s _ {h} ^ {k}, \nu_ {h} ^ {k, (i)} \left(s _ {h} ^ {k}\right), \pi_ {h} ^ {k} \left(s _ {h} ^ {k}\right)\right) \leq 0. \tag {35} +$$ + +Proof of Lemma C.2. See Appendix F.2 for a detailed proof. + +Besides, the second and the third terms of the right-hand side of (33) are characterized by the next lemma. + +Lemma C.3 (Optimism and Accuracy). By setting the optimism parameter $\beta^{(1)}$ and $\beta^{(2)}$ as + +$$ +\beta^ {(1)} = 2 \log (\mathcal {N} (1 / K, \mathcal {U}, \| \cdot \| _ {\infty}) \cdot 2 N H / \delta) + 4 \left(1 + \sqrt {\log \left(8 K ^ {2} H / \delta\right)}\right), \tag {36} +$$ + +$$ +\beta^ {(2)} = 2 H ^ {2} N ^ {2} \cdot \log \left(\mathcal {N} (1 / (K H N), \mathcal {P}, \| \cdot \| _ {\infty , 1}) \cdot 2 H / \delta\right) + 4 \big (H N + \sqrt {H ^ {2} N ^ {2} / 4 \cdot \log (8 K ^ {2} H / \delta)} \big). \qquad (3 7) +$$ + +in Algorithm 1, then with probability at least $1 - \delta$ , the following two things hold. + +(1) (Optimism) For all $(k,h)\in [K]\times [H]$ and any $(s_h,a_h,b_h)\in \mathcal{S}\times \mathcal{A}\times \mathcal{B},$ it holds that + +$$ +\sum_ {i = 1} ^ {N} u _ {h} ^ {(i)} \left(s _ {h}, x _ {h} ^ {(i)}\right) + \int_ {\mathcal {S}} V _ {h + 1} ^ {k, (i)} \left(s ^ {\prime}\right) P _ {h} \left(\mathrm {d} s ^ {\prime} \mid s _ {h}, b _ {h}\right) - Q _ {h} ^ {k, (i)} \left(s _ {h}, x _ {h} ^ {(i)}, b _ {h}\right) \leq 0. \tag {38} +$$ + +(2) (Accuracy) By denoting $d = \max \{\dim_{\mathbb{E}}(\mathcal{U},1 / K),\dim_{\mathbb{E}}(\mathcal{Z}_{\mathcal{P}},1 / K)\}$ , it holds that + +$$ +\sum_ {k = 1} ^ {K} \sum_ {i = 1} ^ {N} V _ {1} ^ {k, (i)} \left(s _ {1} ^ {k}\right) - V _ {1} ^ {\left(\pi^ {k}, \nu^ {k}\right), (i)} \left(s _ {1} ^ {k}\right) \leq \mathcal {O} \left(\sqrt {K H ^ {3} N ^ {2} \log \left(4 / \delta\right)}\right) + H \sqrt {d \left(N ^ {2} \beta^ {(1)} + \beta^ {(2)}\right) K}) + d H ^ {2} N. \tag {39} +$$ + +Proof of Lemma C.3. See Appendix F.3 for a detailed proof. + +Proof of Theorem 3.4. Combining Lemma C.1, Lemma C.2, and Lemma C.3, we can prove Theorem 3.4. According to Lemma C.1, Lemma C.2, and Lemma C.3, with probability at least $1 - \delta$ , it holds that + +$$ +\begin{array}{l} \operatorname {R e g r e t} (K) \leq \sqrt {8 K H ^ {3} N ^ {2} \log (4 / \delta)} + 4 H \sqrt {2 d \left(N ^ {2} \beta^ {(1)} + \beta^ {(2)}\right) K} + d H ^ {2} N \\ \leq \mathcal {O} (\sqrt {d H ^ {2} N ^ {2} (\beta^ {1} + \beta^ {2}) K}), \\ \end{array} +$$ + +which finishes the proof of Theorem 3.4. + +# C.2. Offline Setting + +Our proof is based on the following two key lemmas. + +Lemma C.4 (Upper Bound of Suboptimality). For the output $(\widehat{\pi},\widehat{\nu})$ of Algorithm 2, it holds that, + +$$ +\begin{array}{l} \operatorname {S u b O p t} (\widehat {\pi}, \widehat {\nu}) \leq \sqrt {C _ {\rho} ^ {\star}} \cdot \sum_ {h = 1} ^ {H} \left(\sqrt {\epsilon_ {h} ^ {\widehat {u}}} + H N \cdot \sqrt {\epsilon_ {h} ^ {\widehat {P}}}\right) \\ + \sum_ {i = 1} ^ {N} \left(\widehat {V} _ {1, (\widehat {P}, \widehat {u})} ^ {(\widehat {\pi}, \widehat {\nu}), (i)} - V _ {1} ^ {(\widehat {\pi}, \widehat {\nu}), (i)}\right) (s _ {1}), \\ \end{array} +$$ + +where error terms are defined as $\epsilon_h^{\widehat{u}}\coloneqq \mathbb{E}_{\rho_h}\sum_{i = 1}^{N}|\widehat{u}_h^{(i)}(s,x^{(i)}) - u_h(s,x^{(i)})|^2$ and $\epsilon_h^{\widehat{P}}\coloneqq \mathbb{E}_{\rho_h}\| \widehat{P}_h(\cdot |s,b) - P_h(\cdot |s,b)\| _1^2$ + +Proof of Lemma C.4. See Appendix G.1 for detailed proof. + +In the sequel, we bound the two summations in the suboptimality upper bound in Theorem C.4 respectively. To this end, we introduce the following results, concluded in Lemma C.5, Theorem C.6, and Theorem C.7. + +Lemma C.5 (Pessimistic). Under event $E \coloneqq \{u_h^{(i)} \in \mathcal{U}_{h,\xi_1}^{(i)}, P_h \in \mathcal{P}_{h,\xi_2}, \text{for all } (i,h) \in [N] \times [H]\}$ , it holds that, + +$$ +\sum_ {i = 1} ^ {N} \widehat {V} _ {1, (\widehat {P}, \widehat {u})} ^ {(\widehat {\pi}, \widehat {\nu}), (i)} (s _ {1}) - V _ {1} ^ {(\widehat {\pi}, \widehat {\nu}), (i)} (s _ {1}) \leq 0. +$$ + +Proof of Lemma C.5. See Appendix G.2 for detailed proof. + +Based on Lemma C.4 and Lemma C.5, what remains is to upper bound $\epsilon_h^{\widehat{u}}$ and $\epsilon_h^{\widehat{P}}$ in Lemma C.4 respectively and to show that the event $E$ holds with high probability. These are shown by the following two theorems. + +Theorem C.6 (Analysis for Utility Function Estimation). For the output $(\widehat{\pi}, \widehat{\nu})$ of Algorithm 2, the following statements hold with probability at least $1 - \delta / 2$ , + +1. $E_0 \coloneqq \{u_h^{(i)} \in \mathcal{U}_{h,\xi_1}^{(i)}$ , for all $(i,h) \in [N] \times [H]\}$ holds. +2. $\epsilon_h^{\widehat{u}}\leq \mathcal{O}(\log (\mathcal{N}(1 / K^2,\mathcal{U},\| \cdot \|_\infty)\cdot NH / \delta)N / K),$ for all $(i,h)\in [N]\times [H]$ + +Proof of Theorem C.6. See Appendix G.3 for detailed proof. + +Theorem C.7 (Analysis for Transition Kernel Estimation). For the output $(\widehat{\pi},\widehat{\nu})$ of Algorithm 2, the following statements hold with probability at least $1 - \delta /2$ + +1. $E_{1}\coloneqq \{P_{h}\in \mathcal{P}_{h,\xi_{2}}$ , for all $h\in [H]\}$ holds. +2. $\epsilon_h^{\widehat{P}}\leq \mathcal{O}(\log (\mathcal{N}_{\mathbb{I}}(1 / K^2,\mathcal{P},\| \cdot \|_{2,\infty})H / \delta) / K)$ for all $h\in [H]$ + +Proof of Theorem C.7. See Appendix G.4 for detailed proof. + +Now combining the result of Theorem C.7 and Theorem C.6 and noting that $E = E_0 \cap E_1$ , we can show that with probability at least $1 - \delta$ , the event $E$ holds, which implies that the conclusion of Lemma C.5 holds. Meanwhile, error terms defined in Lemma C.4 are bounded as follows + +$$ +\epsilon_ {h} ^ {\widehat {u}} \leq \mathcal {O} (N \iota / K), \quad \epsilon_ {h} ^ {\widehat {P}} \leq \mathcal {O} (\iota / K), +$$ + +where we define $\iota = \log \mathcal{N}_{\mathbb{I}}(1 / K^2,\mathcal{P},\| \cdot \|_{1,\infty}) + \log \mathcal{N}(1 / K^2,\mathcal{U},\| \cdot \|_{\infty}) + \log (HN / \delta)$ + +Finally, according to Lemma C.4, we have that + +$$ +\operatorname {S u b O p t} (\widehat {\pi}, \widehat {\nu}, s _ {1}) \leq \sqrt {C _ {\rho} ^ {\star}} \cdot \sum_ {h = 1} ^ {H} \left(\sqrt {\epsilon_ {h} ^ {\widehat {u}}} + H N \cdot \sqrt {\epsilon_ {h} ^ {\widehat {P}}}\right) \leq \mathcal {O} (\sqrt {H ^ {4} N ^ {2} \iota C _ {\rho} ^ {\star} / K}), +$$ + +which finishes the proof of Theorem 4.4. + +# D. Special Cases + +# D.1. Linear Function Approximation + +On the first case, we parameterize $\mathcal{P}$ and $\mathcal{U}$ by a common parameter vector $\theta \in \mathbb{R}^d$ . We assume there exist an absolute constant $d$ , known feature maps $\phi$ and $\{\psi_i\}_{i\in [N]}$ , such that $\mathcal{P} = \{P(s' | s, b) = \phi (s', s, b)^{\top}\theta : \theta \in \Theta\}$ and $\mathcal{U} = \{u(s, x^{(i)}) = \psi_i(s, x^{(i)})^{\top}\theta : \theta \in \Theta\}$ . Following Russo & Van Roy (2013), we assert the following assumption. + +Assumption D.1 (Regularity of Linear Function Approximation). We assume the following two regularity conditions. (1) $\sup_{(s', s, b) \in \mathcal{S} \times \mathcal{S} \times \mathcal{B}} \| \phi(s', s, b) \|_2 \leq 1$ and $\sup_{(s, x^{(i)}) \in \mathcal{S} \times \mathcal{X}^{(i)}} \| \psi_i(s, x^{(i)}) \|_2 \leq 1$ . (2) $\Theta = \{\theta \in \mathbb{R}^d : \| \theta \|_2 \leq 1\}$ . + +Corollary D.2 (Theoretical Analysis of Algorithm 1 and Algorithm 2 with Linear Function Approximations). Under the same conditions as in Theorem 3.4, it holds with probability at least $1 - \delta$ that the regret for joint optimality and for fair division property of Algorithm 1 satisfy, + +$$ +\mathrm {R e g r e t} _ {\mathrm {C E , S W M}} (K) \leq \widetilde {\mathcal {O}} (\sqrt {d ^ {2} H ^ {4} N ^ {4} K}), \qquad \mathrm {R e g r e t} _ {\mathrm {F D}} (K) \leq \widetilde {\mathcal {O}} (\sqrt {d ^ {2} H ^ {2} N ^ {2} K}). +$$ + +For Algorithm 2, on the same condition as Theorem 4.4, it holds with probability at least $1 - \delta$ , + +$$ +\mathrm {S u b O p t} (\widehat {\pi}, \widehat {\nu}) \leq \widetilde {\mathcal {O}} (\sqrt {H ^ {4} N ^ {2} d C _ {\rho} ^ {\star} / K}), \qquad \mathcal {L} _ {\mathrm {F D}} (\widehat {\nu}) \leq \widetilde {\mathcal {O}} (\sqrt {H ^ {2} N ^ {2} d / K}). +$$ + +Proof of Corollary D.2. It suffices to upper bound the covering number, bracketing number, and eluder dimension under Assumption D.1 respectively. For the upper bound of covering number and bracketing number, we introduce the following lemma. + +Lemma D.3 (Specification of Covering Number and Bracketing Number). Under Assumption D.1, it holds for all $\epsilon \in (0,1)$ that + +$$ +\log \mathcal {N} (\epsilon , \mathcal {U}, \| \cdot \| _ {\infty}) \leq d \log (3 h _ {\mathrm {U}} / \epsilon) = \tilde {\mathcal {O}} (d), +$$ + +$$ +\log \mathcal {N} (\epsilon , \mathcal {P}, \| \cdot \| _ {1, \infty}) \leq \log \mathcal {N} _ {\llbracket} (2 \epsilon , \mathcal {P}, \| \cdot \| _ {1, \infty}) \leq \log (4 h _ {\mathrm {U}} | \mathcal {S} | / \epsilon) = \widetilde {\mathcal {O}} (d). +$$ + +Proof of Lemma D.3. For the first inequality in Lemma D.3, we prove it by definition of covering number. By the second point in Assumption D.1, $\Theta$ is a ball with radius 1 in $d$ -dimension Euclidean space, which guarantees that (Lemma 5.2 of Vershynin (2010)) + +$$ +\log \mathcal {N} (\epsilon , \Theta , \| \cdot \| _ {\infty}) \leq d \log (3 / \epsilon). \tag {40} +$$ + +Taking the $\epsilon$ -covering of $\Theta$ as $\Theta_{\epsilon} = \{\theta_j\}_{j\in [M]}$ and arbitrarily fixing $i\in [N]$ , it implies for any $u_{\theta}(\cdot ,\cdot) = h(\psi_i(\cdot ,\cdot)^{\top}\theta)\in \mathcal{U}$ there exists $j\in [M]$ such that + +$$ +\left| u _ {\theta} \left(s, x ^ {(i)}\right) - u _ {\theta_ {j}} \left(s, x ^ {(i)}\right) \right| = \left| \psi_ {i} \left(s, x ^ {(i)}\right) ^ {\top} \left(\theta - \theta_ {j}\right) \right| \leq \left\| \psi_ {i} \left(s, x ^ {(i)}\right) \right\| _ {2} \| \theta - \theta_ {j} \| _ {2} \leq \| \theta - \theta_ {j} \| _ {2} \leq \epsilon , \tag {41} +$$ + +where the second last inequality relies on the first point in Assumption D.1 and the last inequality follows from the definition of covering number. Taking supreme on the both side of (41) over $(s,x^{(i)})\in S\times \mathcal{X}^{(i)}$ , we show that $\{u_{\theta_j} = \phi (\cdot ,\cdot)^{\top}\theta_j\}_{j\in [M]}$ is also a $\epsilon$ -covering of $\mathcal{U}$ under $\infty$ -norm, implying that + +$$ +\log \mathcal {N} (\epsilon^ {\prime}, \mathcal {U}. \| \cdot \| _ {\infty}) \leq d \log (3 / \epsilon^ {\prime}) = \widetilde {\mathcal {O}} (d). +$$ + +Hence we complete the proof of the first part of Lemma D.3. + +As for the second part, we introduce the following key lemma to connect bracketing number with covering number, which is proved in Sen (2018). + +Lemma D.4 (Theorem 2.14 in Sen (2018)). Let $\mathcal{F} = \{m_{\theta} : \theta \in \Theta\}$ be a class of functions satisfying the following condition + +$$ +\left| m _ {\theta_ {1}} (x) - m _ {\theta_ {2}} (x) \right| \leq d \left(\theta_ {1}, \theta_ {2}\right) F (x), \quad \forall x \in \mathcal {X}, \forall \theta_ {1}, \theta_ {2} \in \Theta , +$$ + +for some fixed function $F$ and metric $d$ . Then, for any norm $\| \cdot \|$ , it yields that + +$$ +\mathcal {N} _ {[ ]} (2 \epsilon \| F \|, \mathcal {F}, \| \cdot \|) \leq \mathcal {N} (\epsilon , \Theta , d). +$$ + +Under Assumption D.1, for any two kernels $P_{\theta_1}, P_{\theta_2} \in \mathcal{P}$ , it holds that + +$$ +\left| P _ {\theta_ {1}} (s ^ {\prime} | s, b) - P _ {\theta_ {2}} (s ^ {\prime} | s, b) \right| = \left| \phi (s ^ {\prime}, s, b) ^ {\top} (\theta_ {1} - \theta_ {2}) \right| \leq h _ {\mathrm {U}} \| \phi (s ^ {\prime}, s, b) \| _ {2} \| \theta_ {1} - \theta_ {2} \| _ {2} +$$ + +Applying Lemma D.4 with $F(s', s, b) = \| \phi(s', s, b) \|_2$ and noticing that $\| F \|_{1,\infty} \leq |\mathcal{S}|$ , we derive that + +$$ +\log \mathcal {N} _ {[ ]} (2 | \mathcal {S} | \epsilon , \mathcal {P}, \| \cdot \| _ {1, \infty}) \leq \log \mathcal {N} (\epsilon , \Theta , \| \cdot \| _ {2}) \leq d \log (1 / \epsilon) = \tilde {\mathcal {O}} (d), +$$ + +where the last inequality follows from (40). Taking $\epsilon' = 2|\mathcal{S}|\epsilon$ , we have that + +$$ +\log \mathcal {N} _ {\llbracket} \left(\epsilon^ {\prime}, \mathcal {P}, \| \cdot \| _ {1, \infty}\right) \leq d \log \left(2 | \mathcal {S} | / \epsilon^ {\prime}\right). +$$ + +Noting that for all normed space $(\mathcal{X},\| \cdot \|)$ , it holds that $\mathcal{N}(\epsilon ,\mathcal{X},\| \cdot \|)\leq \mathcal{N}_{\mathbb{I}}(2\epsilon ,\mathcal{X},\| \cdot \|)$ , which concludes the proof of Lemma D.3. + +As the second step in the proof of Corollary D.2, under Assumption D.1 we upper bound the eluder dimension defined in 3.3 by the following lemma. + +Lemma D.5 (Specification of Eluder Dimension). Under Assumption D.1, it holds for all $\epsilon \in (0,1)$ that + +$$ +\dim_ {\mathbb {E}} (\mathcal {U}, \epsilon) \leq \widetilde {\mathcal {O}} (d), \quad \dim_ {\mathbb {E}} (\mathcal {Z} _ {\mathcal {P}}, \epsilon) \leq \widetilde {\mathcal {O}} (d), +$$ + +where $\mathcal{Z}_{\mathcal{P}}$ is defined in Section 3.3. + +Proof of Lemma D.5. The proof is a special case of the following lemma proved in Russo & Van Roy (2013). + +Lemma D.6 (Proposition 12 of Russo & Van Roy (2013)). We define the function class on $\mathcal{X}$ as + +$$ +\mathcal {F} = \left\{h (\varphi (\cdot) ^ {\top} \theta): \theta \in \mathbb {R} ^ {d} \right\} \subset \left\{f: \mathcal {X} \mapsto \mathbb {R} \right\}, +$$ + +for a fixed differential function $h(\cdot)$ and a feature map $\varphi(\cdot)$ . If we assume that $0 < h_{\mathrm{L}} \leq h'(y) \leq h_{\mathrm{U}}$ for all $y \in \mathbb{R}$ , then it holds for all $\epsilon \in (0,1)$ that + +$$ +\dim_ {\mathbb {E}} (\mathcal {F}, \epsilon) \leq \mathcal {O} \left(d r ^ {2} \log \left(r ^ {2} + \frac {r ^ {2} h _ {\mathrm {U}} ^ {2} \cdot \sup _ {\theta \in \Theta} \| \theta \| _ {2} \cdot \sup _ {x \in \mathcal {X}} \| \varphi (x) \| _ {2}}{\epsilon^ {2}}\right)\right), +$$ + +where $r\coloneqq h_{\mathrm{U}} / h_{\mathrm{L}}$ and $\dim_{\mathbb{E}}(\mathcal{F},\epsilon)$ is defined in Definition 3.3. + +Now we are ready to specify $\dim_{\mathbb{E}}(\mathcal{U},\epsilon)$ and $\dim_{\mathbb{E}}(\mathcal{Z}_P,\epsilon)$ by taking $h(\cdot)$ as identity function. Under Assumption D.1, it holds that $\| \theta \| _2\leq 1$ for all $\theta \in \Theta$ and $\| \psi_i(\cdot ,\cdot)\| _2\leq 1$ , which implies that + +$$ +\dim_ {\mathbb {E}} (\mathcal {U}, \epsilon) \leq \mathcal {O} \left(d \log \left(1 + \frac {1}{\epsilon^ {2}}\right)\right) = \widetilde {\mathcal {O}} (d). \tag {42} +$$ + +The analysis for $\dim_{\mathbb{E}}(\epsilon, \mathcal{Z}_{\mathcal{P}})$ needs more elaborations. Recall that for each $z_P \in \mathcal{Z}_{\mathcal{P}}$ , it holds that + +$$ +z _ {P} ((s, b, f)) = \int_ {\mathcal {S}} f (s ^ {\prime}) P (\mathrm {d} s ^ {\prime} | s, b) = \int_ {\mathcal {S}} f (s ^ {\prime}) \phi (s ^ {\prime}, s, b) ^ {\top} \theta \mathrm {d} s ^ {\prime} = \theta^ {\top} \int_ {\mathcal {S}} f (s ^ {\prime}) \phi (s ^ {\prime}, s, b) \mathrm {d} s ^ {\prime}, +$$ + +where $f$ is a arbitrary function in $f: S \mapsto [0,HN]$ and $(s,b) \in S \times \mathcal{B}$ . If we take $\mathcal{X} = \mathcal{S} \times \mathcal{B} \times \{f: S \mapsto [0,HN]\}$ and $\varphi((s,b,f)) = \int_{\mathcal{S}} f(s') \phi(s',s,b) \mathrm{d}s'$ in Lemma D.6, we obtain that + +$$ +\dim_ {\mathbb {E}} (\mathcal {Z} _ {\mathcal {P}}, \epsilon) \leq \mathcal {O} \left(d \log \left(1 + H N \sup _ {(s, b) \in \mathcal {S} \times \mathcal {B}} \int_ {\mathcal {S}} \frac {| \phi (s ^ {\prime} , s , b) |}{\epsilon^ {2}} \mathrm {d} s ^ {\prime}\right)\right) \leq \mathcal {O} (d \log (1 + H N | \mathcal {S} |)) = \widetilde {\mathcal {O}} (d), +$$ + +where the last inequality relies on the first point of Assumption D.1. + +Then we are ready to prove corollary D.2. Based on Lemma D.3, we can upper bound the optimism parameters (36) in Algorithm 1 as + +$$ +\beta^ {(1)} = \widetilde {\mathcal {O}} (d), \quad \beta^ {(2)} = \widetilde {\mathcal {O}} \left(H ^ {2} N ^ {2} d\right). \tag {43} +$$ + +We also upper bound the pessimism parameters defined in Theorem 4.4 of Algorithm 2 as + +$$ +\xi_ {1} = \widetilde {\mathcal {O}} (d / K), \quad \xi_ {2} = \widetilde {\mathcal {O}} (d / K). \tag {44} +$$ + +Combining Lemma D.5 and plugging them into Theorem 3.4, Theorem 4.4 respectively, we prove Corollary D.2. + +Remark D.7 (Generalized Linear Kernel Case). We remark that based on Lemma D.6, our conclusion can also be extended to the setting when utility functions are generalized linear (Guo et al., 2021). + +Remark D.8 (Tabular Case). Let feature maps being the canonical basis on the factorized space, that is, $\phi(s', s, b) = \mathbf{e}_{(s', s, b)}$ , $\psi_i(s, x^{(i)}) = \mathbf{e}_{(s, x^{(i)})}$ , and $d = \max \{|S|^2 |B|, \max_i |S||\mathcal{X}^{(i)}|\}$ , then Assumption D.1 is satisfied. + +# D.2. Reproducing Kernel Hilbert Space + +We consider the case when utility functions $u_h^{(i)}$ and transition kernel $P_h$ are parameterized by a subset of a reproducing kernel Hilbert space (RKHS). Specifically, we consider two RKHS's $\mathcal{H}^u$ and $\mathcal{H}^P$ associated with two positive definite kernels $\mathcal{K}^u: (\mathcal{S} \times \mathcal{X}^{(i)}) \times (\mathcal{S} \times \mathcal{X}^{(i)}) \mapsto \mathbb{R}_+$ and $\mathcal{K}^P: (\mathcal{S} \times \mathcal{B} \times \mathcal{S}) \times (\mathcal{S} \times \mathcal{B} \times \mathcal{S}) \mapsto \mathbb{R}_+$ respectively. We denote the corresponding feature mappings by $\phi^u: \mathcal{S} \times \mathcal{A}^{(1)} \mapsto \mathcal{H}^u$ and $\phi^P: \mathcal{S} \times \mathcal{B} \times \mathcal{S} \mapsto \mathcal{H}$ . We assume that + +$$ +\mathcal {U} = \left\{\langle \phi^ {u} (\cdot , \cdot), f \rangle_ {\mathcal {H} ^ {u}}: f \in \mathcal {H} ^ {u}, \| f \| _ {\mathcal {H} ^ {u}} \leq R ^ {u} \right\} = \left\{\langle \phi^ {u} (\cdot , \cdot), f \rangle_ {\mathcal {H} ^ {u}}: f \in \mathcal {H} _ {R ^ {u}} ^ {u} \right\}, +$$ + +$$ +\mathcal {P} = \left\{\langle \phi^ {P} (\cdot , \cdot , \cdot), f \rangle_ {\mathcal {H} ^ {P}}: f \in \mathcal {H} ^ {P}, \| f \| _ {\mathcal {H} ^ {P}} \leq R ^ {P} \right\} = \left\{\langle \phi^ {P} (\cdot , \cdot , \cdot), f \rangle_ {\mathcal {H} ^ {P}}: f \in \mathcal {H} _ {R ^ {P}} ^ {P} \right\}. +$$ + +By Mercer's theorem (Steinwart & Christmann, 2008), we denote the decomposition of $\mathcal{K}^u$ and $\mathcal{K}^P$ as + +$$ +\mathcal {K} (x, y) = \sum_ {j = 1} ^ {+ \infty} \lambda_ {j} ^ {u} \phi_ {j} ^ {u} (x) \phi_ {j} ^ {u} (y), \quad \mathcal {K} (x, y) = \sum_ {j = 1} ^ {+ \infty} \lambda_ {j} ^ {P} \phi_ {j} ^ {P} (x) \phi_ {j} ^ {P} (y), +$$ + +where $x, y \in \mathcal{Y}$ with $\mathcal{Y} = \mathcal{S} \times \mathcal{X}^{(i)}$ for $\mathcal{U}$ and $\mathcal{Y} = \mathcal{S} \times \mathcal{B} \times \mathcal{S}$ for $\mathcal{P}$ . Following Cai et al. (2020b), we assume that both $\mathcal{H}^u$ and $\mathcal{H}^P$ satisfy the following regularity conditions. For simplicity, we omit the superscript $u$ or $P$ . + +Assumption D.9 (Regularity of RKHS). We assume $\mathcal{K}$ satisfies the following two regularity conditions. + +(1) It holds that $|\mathcal{K}(x,y)|\leq 1,|\phi_j(x)|\leq 1$ , and $\lambda_{j}\leq 1$ for any $x,y\in \mathcal{V}$ and $j\in \mathbb{N}$ +(2) There exist a threshold $\gamma \in (0,1 / 2)$ and constant $C_1,C_2 > 0$ such that $\lambda_{j}\leq C_{1}\cdot \exp (-C_{2}j^{\gamma})$ for any $j\in \mathbb{N}$ + +Corollary D.10 (Theoretical Analysis of Algorithm 1 and Algorithm 2 with Kernel Function Approximations). Under the same conditions as in Theorem 3.4, it holds with probability at least $1 - \delta$ that the regret for joint optimality and for fair division property of Algorithm 1 satisfy + +$$ +\operatorname {R e g r e t} _ {\mathrm {C E , S W M}} (K) \lesssim \mathcal {O} \big (H ^ {2} N K ^ {1 / 2} \log^ {2} (1 / \gamma) / \gamma \cdot \log^ {1 + 1 / \gamma} (2 | \mathcal {S} | R H N K / \delta) \big), +$$ + +$$ +\operatorname {R e g r e t} _ {\mathrm {F D}} (K) \lesssim \mathcal {O} \big (H N K ^ {1 / 2} \log^ {2} (1 / \gamma) / \gamma \cdot \log^ {1 + 1 / \gamma} (R H N K / \delta) \big). +$$ + +Besides, under the same conditions as in Theorem 4.4, it holds with probability at least $1 - \delta$ that the suboptimality and offline FD loss of Algorithm 2 satisfy + +$$ +\operatorname {S u b O p t} (\widehat {\pi}, \widehat {\nu}, s _ {1}) \lesssim \mathcal {O} \big ((C _ {\rho} ^ {\star}) ^ {1 / 2} H ^ {2} N \cdot K ^ {- 1 / 2} \log (1 / \gamma) / \gamma \cdot \log^ {1 / 2 + 1 / 2 \gamma} (2 | S | R H N K ^ {2} / \delta) \big), +$$ + +$$ +\mathcal {L} _ {F D} (\widehat {\nu}) \lesssim \mathcal {O} \big (H N \cdot K ^ {- 1 / 2} \log (1 / \gamma) / \gamma \cdot \log^ {1 / 2 + 1 / 2 \gamma} (R H N K ^ {2} / \delta) \big). +$$ + +Proof of Corollary D.10. When $\mathcal{U}$ and $\mathcal{P}$ are both parameterized by RKHS, the covering numbers and bracketing numbers of $\mathcal{U}$ and $\mathcal{P}$ , together with the eluder dimension $d$ , can be upper bounded explicitly, which are concluded in the following two lemmas. + +Lemma D.11 (Covering Number and Bracketing Number with RKHS). Under Assumption D.9, it holds for all $\epsilon \in (0,1)$ that + +$$ +\log \mathcal {N} (\epsilon , \mathcal {U}, \| \cdot \| _ {\infty}) \leq C _ {3} \cdot \log^ {2} (1 / \gamma) / \gamma \cdot \log^ {1 + 1 / \gamma} (R / \epsilon), +$$ + +$$ +\log \mathcal {N} (\epsilon , \mathcal {P}, \| \cdot \| _ {1, \infty}) \leq \log \mathcal {N} _ {\llbracket} (2 \epsilon , \mathcal {P}, \| \cdot \| _ {1, \infty}) \leq C _ {4} \cdot \log^ {2} (1 / \gamma) / \gamma \cdot \log^ {1 + 1 / \gamma} (2 | \mathcal {S} | R / \epsilon). +$$ + +where $C_3, C_4 > 0$ are absolute constants. + +Proof of Lemma D.11. For notational simplicity, we omit all the superscripts $u$ or $P$ without making confusion. For function class $\mathcal{U}$ , we invoke Lemma I.1 (Cai et al., 2020b) which shows that + +$$ +\log \mathcal {N} (\epsilon , \mathcal {U}, \| \cdot \| _ {\infty}) \leq C _ {3} \cdot \log^ {2} (1 / \gamma) / \gamma \cdot \log^ {1 + 1 / \gamma} (R / \epsilon), +$$ + +for some absolute constant $C_3 > 0$ . In the sequel, we deal with function class $\mathcal{P}$ and we start from bounding the bracketing number $\mathcal{N}_{\mathbb{I}}(2\epsilon ,\mathcal{P},\| \cdot \|_{1,\infty})$ since it upper bounds the covering number $\mathcal{N}(\epsilon ,\mathcal{P},\| \cdot \|_{1,\infty})$ . We first note that + +$\mathcal{N}_{\mathbb{I}}(2\epsilon, \mathcal{P}, \| \cdot \|_{1,\infty}) \leq \mathcal{N}_{\mathbb{I}}(2\epsilon / |\mathcal{S}|, \mathcal{P}, \| \cdot \|_{\infty})$ . Now we apply a truncation argument. Let $d_0$ be an integer which will be specified later. Denote $\widetilde{\mathcal{P}}$ as + +$$ +\widetilde {\mathcal {P}} = \left\{P = \sum_ {j = 1} ^ {d _ {0}} v _ {j} \sqrt {\lambda_ {j}} \phi_ {j}: \| v \| _ {2} \leq R \right\} \subseteq \mathcal {P}, +$$ + +which is in fact a linear function class over $\mathcal{Y} = \mathcal{S}\times \mathcal{B}\times \mathcal{S}$ with finite dimension $d_0 < \infty$ . Also, for any $P\in \mathcal{P}$ , we define the truncation of $P$ to finite dimensional space $\widetilde{\mathcal{P}}$ as + +$$ +\widetilde {P} = \sum_ {j = 1} ^ {d _ {0}} \langle P, \sqrt {\lambda_ {j}} \phi_ {j} \rangle_ {\mathcal {H}} \sqrt {\lambda_ {j}} \phi_ {j} \in \widetilde {\mathcal {P}}. +$$ + +The difference between $P$ and $\widetilde{P}$ under the $\| \cdot \|_{\infty}$ -norm can be bounded as + +$$ +\begin{array}{l} \| P - \widetilde {P} \| _ {\infty} = \sup _ {y \in \mathcal {Y}} \left| \sum_ {j = d _ {0} + 1} ^ {+ \infty} \langle P, \sqrt {\lambda_ {j}} \phi_ {j} \rangle_ {\mathcal {H}} \sqrt {\lambda_ {j}} \phi_ {j} (y) \right| \\ \leq \sum_ {j = d _ {0} + 1} ^ {+ \infty} \sqrt {\lambda_ {j}} \| P \| _ {\mathcal {H}} \| \sqrt {\lambda_ {j}} \phi_ {j} \| _ {\mathcal {H}} \sup _ {y \in \mathcal {Y}} | \phi_ {j} (y) | \leq R \cdot \sum_ {j = d _ {0} + 1} ^ {+ \infty} \sqrt {\lambda_ {j}}, \\ \end{array} +$$ + +from which we denote $\varepsilon_{d_0} = R\cdot \sum_{j = d_0 + 1}^{+\infty}\sqrt{\lambda_j}$ which is bounded later. Now let $\mathcal{S}_{d_0} = \{[\widetilde{g}_j^L,\widetilde{g}_j^U ]\}_{j\in [\mathcal{N}_{[i}(\epsilon /|S|,\widetilde{p},\| \cdot \|_{\infty})]}$ be a smallest $\epsilon /|\mathcal{S}|$ -bracket cover of $\widetilde{\mathcal{P}}$ under $\| \cdot \|_{\infty}$ norm. By the definition of bracketing in Section A, for any $P\in \mathcal{P}$ , there exists a bracket $[\widetilde{g}_j^L,\widetilde{g}_j^U]\in \mathcal{S}_{d_0}$ such that $\widetilde{l} (y)\leq \widetilde{P} (y)\leq \widetilde{u} (y)$ for any $y\in \mathcal{V}$ . As a result, + +$$ +\widetilde {g} _ {j} ^ {L} - \varepsilon_ {d _ {0}} \leq P (y) \leq \widetilde {g} _ {j} ^ {U} + \varepsilon_ {d _ {0}}, \quad \forall y \in \mathcal {Y}. +$$ + +Define functions $g_{j}^{L} = \widetilde{g}_{j}^{L} - \varepsilon_{d_{0}}$ and $g_{j}^{U} = \widetilde{g}_{j}^{U} + \varepsilon_{d_{0}}$ respectively, and let $S$ be the collect of the brackets $[g_{j}^{L}, g_{j}^{U}]$ . Then the set $S$ is an $(\epsilon / |\mathcal{S}| + 2\varepsilon_{d_{0}})$ -bracket cover of $\mathcal{P}$ with $|S| = |\mathcal{S}_{d_{0}}| = \mathcal{N}_{[]}(\epsilon / |\mathcal{S}|, \widetilde{\mathcal{P}}, \| \cdot \|_{\infty})$ . Thus we have that + +$$ +\mathcal {N} _ {\llbracket} (\epsilon / | \mathcal {S} | + 2 \varepsilon_ {d _ {0}}, \mathcal {P}, \| \cdot \| _ {1, \infty}) \leq | \mathcal {S} | = \mathcal {N} _ {\llbracket} (\epsilon / | \mathcal {S} |, \widetilde {\mathcal {P}}, \| \cdot \| _ {\infty}). +$$ + +By Lemma D.3, we know that $\log \mathcal{N}_{\mathbb{I}}(\epsilon /|\mathcal{S}|,\widehat{\mathcal{P}},\| \cdot \|_{\infty})\leq d_0\log (4d_0|\mathcal{S}| / \epsilon)$ . Consequently, it then suffices to choose a proper integral $d_0$ such that $2\varepsilon_{d_0}\leq \epsilon /|\mathcal{S}|$ . According to Lemma I.3 (Cai et al., 2020b), by choosing + +$$ +d _ {0} = \left\lceil \widetilde {C} \cdot \log (1 / \gamma) / \gamma \cdot \log^ {1 / \gamma} (2 | \mathcal {S} R / \epsilon) \right\rceil , +$$ + +where $\gamma$ is specified in Assumption D.9, it holds that $\varepsilon_{d_0} \leq \epsilon / 2|\mathcal{S}|$ . Therefore, we conclude that + +$$ +\begin{array}{l} \mathcal {N} _ {[ ]} (2 \epsilon / | \mathcal {S} |, \mathcal {P}, \| \cdot \| _ {1, \infty}) \leq d _ {0} \log (4 d _ {0} | \mathcal {S} | / \epsilon) \\ \leq C _ {4} \cdot \log^ {2} (1 / \gamma) / \gamma \cdot \log^ {1 + 1 / \gamma} (2 | S | R / \epsilon). \\ \end{array} +$$ + +Finally, due to the fact that $\mathcal{N}(\epsilon, \mathcal{P}, \| \cdot \|_{1,\infty}) \leq \mathcal{N}_{\mathbb{I}}(2\epsilon, \mathcal{P}, \| \cdot \|_{1,\infty})$ , we can finish the proof of Lemma D.11. + +Lemma D.12 (Eluder Dimension with RKHS). Under Assumption D.9, there exists an absolute constant $C_5 > 0$ such that + +$$ +d = \max \{\dim_ {\mathbb {E}} (\mathcal {U}, 1 / K), \dim_ {\mathbb {E}} (\mathcal {Z} _ {\mathcal {P}}, 1 / K) \} \leq C _ {5} \cdot \log^ {2} (1 / \gamma) / \gamma \cdot \log^ {1 + 1 / \gamma} (R H N K). +$$ + +Proof of Lemma D.12. See Lemma C.1 in Cai et al. (2020b) for a detailed proof. + +Combining Lemma D.11, D.12 with Theorem 3.4 and 4.4 finishes the proof of Corollary D.10. + +![](images/cd7b8c828d5efc943aa78e27b431da0246581118d9f0d082d64847106d3ab177.jpg) + +![](images/8196498cc7c7be2041c1e0e928c9c2bcc16549b30762a1fde0339c53d5dd21e0.jpg) + +![](images/82e2de6dd7b43c3e9f2eaabc9e1a83f28e98954c6d7bc16a9670653f736778e5.jpg) + +# E. Proofs for Competitive Equilibrium and Social Welfare Maximization + +# E.1. Proof for Theorem 2.4 + +Proof of Theorem 2.4. We first show the inequality by induction. For $h = H$ , it holds that for any $s_H \in S$ + +$$ +\begin{array}{l} V _ {H} ^ {(\pi , \nu^ {\star} (\nu)), (i)} (s _ {H}) = Q _ {H} ^ {(\pi , \nu^ {\star} (\nu)), (i)} (s _ {H}, \nu_ {H} ^ {\star , (i)} (\nu) (s _ {H}), \pi_ {H} (s _ {H})) \\ = \max _ {x _ {H} ^ {(i)} \in \mathcal {X} ^ {(i)}: \left(\nu_ {H} ^ {p} (s _ {H})\right) ^ {\top} x _ {H} ^ {(i)} \leq \left(\nu_ {H} ^ {p} (s _ {H})\right) ^ {\top} e _ {H}} u _ {H} ^ {(i)} \left(s _ {H}, x _ {H} ^ {(i)}\right) \tag {45} \\ \geq u _ {H} ^ {(i)} (s _ {H}, \nu_ {H} ^ {(i)} (s _ {H})) = V _ {H} ^ {(\pi , \nu), (i)} (s _ {H}). \\ \end{array} +$$ + +This shows step $H$ . Suppose that the inequality holds for step $h + 1$ , i.e., $V_{h + 1}^{(\pi, \nu^{\star}(\nu)),(i)}(s_{h + 1}) \geq V_{h + 1}^{(\pi, \nu),(i)}(s_{h + 1})$ for any $s_{h + 1} \in \mathcal{S}$ . Then for step $h$ , we first have that for any $(s_h, x_h^{(i)}, b_h) \in \mathcal{S} \times \mathcal{X}^{(i)} \times \mathcal{B}$ , + +$$ +\begin{array}{l} Q _ {h} ^ {(\pi , \nu^ {\star} (\nu)), (i)} (s _ {h}, x _ {h} ^ {(i)}, b _ {h}) = u _ {h} ^ {(i)} (s _ {h}, x _ {h} ^ {(i)}) + \int_ {\mathcal {S}} V _ {h + 1} ^ {(\pi , \nu^ {\star} (\nu)), (i)} (s ^ {\prime}) P _ {h} (\mathrm {d} s ^ {\prime} | s _ {h}, b _ {h}) \\ \geq u _ {h} ^ {(i)} \left(s _ {h}, x _ {h} ^ {(i)}\right) + \int_ {\mathcal {S}} V _ {h + 1} ^ {(\pi , \nu), (i)} \left(s ^ {\prime}\right) P _ {h} \left(\mathrm {d} s ^ {\prime} \mid s _ {h}, b _ {h}\right) \tag {46} \\ = Q ^ {(\pi , \nu), (i)} (s _ {h}, x _ {h} ^ {(i)}, b _ {h}), \\ \end{array} +$$ + +where the inequality follows by induction. Then we have that for any $s_h \in S$ , + +$$ +\begin{array}{l} V _ {h} ^ {(\pi , \nu^ {\star} (\nu)), (i)} (s _ {h}) = Q _ {h} ^ {(\pi , \nu^ {\star} (\nu)), (i)} \left(s _ {h}, \nu_ {h} ^ {\star , (i)} (\nu) (s _ {h}), \pi_ {h} (s _ {h})\right) \\ \geq Q ^ {(\pi , \nu), (i)} \left(s _ {h}, \nu_ {h} ^ {\star , (i)} (\nu) \left(s _ {h}\right), \pi_ {h} \left(s _ {h}\right)\right) \\ = u _ {h} ^ {(i)} (c _ {h}, \nu_ {h} ^ {\star , (i)} (\nu) (s _ {h})) + \int_ {\mathcal {S}} V _ {h + 1} ^ {(\pi , \nu), (i)} (s ^ {\prime}) P _ {h} (\mathrm {d} s ^ {\prime} | s _ {h}, \pi_ {h} (s _ {h})) \\ = \max _ {x _ {h} ^ {(i)} \in \mathcal {X} ^ {(i)}: \left(\nu_ {h} ^ {p} \left(s _ {h}\right)\right) ^ {\top} x _ {h} ^ {(i)} \leq \left(\nu_ {h} ^ {p} \left(s _ {h}\right)\right) ^ {\top} e _ {H}} u _ {h} ^ {(i)} \left(s _ {h}, x _ {h} ^ {(i)}\right) + \int_ {\mathcal {S}} V _ {h + 1} ^ {(\pi , \nu), (i)} \left(s ^ {\prime}\right) P _ {h} \left(\mathrm {d} s ^ {\prime} \mid s _ {h}, \pi_ {h} \left(s _ {h}\right)\right) \tag {47} \\ \geq u _ {h} ^ {(i)} \left(s _ {h}, \nu_ {h} ^ {(i)} \left(s _ {h}\right)\right) + \int_ {\mathcal {S}} V _ {h + 1} ^ {(\pi , \nu), (i)} \left(s ^ {\prime}\right) P _ {h} \left(\mathrm {d} s ^ {\prime} \mid s _ {h}, \pi_ {h} \left(s _ {h}\right)\right) \\ = V _ {h} ^ {(\pi , \nu), (i)} \left(s _ {h}\right), \\ \end{array} +$$ + +where the first inequality follows from (46) and the second inequality follows from the definition of $\nu_h^{\star,(i)}(\nu)$ and the fact that both $\nu$ and $\nu^\star(\nu)$ satisfy the resource constraints. This proves the first conclusion of Theorem 2.4. When the inequality holds for $h = 1$ , from the previous proofs we know that all the inequalities become equalities, which further implies that $\nu_h(s_h)$ is a competitive equilibrium with respect to $\{u_h^{(i)}(s_h,\cdot)\}_{i\in [N]}$ . + +# E.2. Proof for Theorem 2.6 + +Proof of Theorem 2.6. We show the inequality by induction. For $h = H$ , it holds that for any $s_h \in S$ + +$$ +\sum_ {i = 1} ^ {N} V _ {H} ^ {(\pi^ {\star} (\nu), \nu), (i)} (s _ {H}) = \sum_ {i = 1} ^ {N} u _ {H} ^ {(i)} \left(s _ {H}, \nu_ {H} ^ {(i)} \left(s _ {H}\right)\right) = \sum_ {i = 1} ^ {N} V _ {H} ^ {(\pi , \nu), (i)} \left(s _ {H}\right). \tag {48} +$$ + +Now we suppose that the inequality holds for step $h + 1$ , i.e., $\sum_{i = 1}^{N}V_{h}^{(\pi^{\star}(\nu),\nu),(i)}(s_{h + 1})\geq \sum_{i = 1}^{N}V_{h}^{(\pi ,\nu),(i)}(s_{h + 1})$ for any $s_{h + 1}\in S$ . Then for step $h$ we have that for any $s_h\in S$ , + +$$ +\begin{array}{l} \sum_ {i = 1} ^ {N} V _ {h} ^ {(\pi^ {\star} (\nu), \nu), (i)} (s _ {h}) = \sum_ {i = 1} ^ {N} Q _ {h} ^ {(\pi^ {\star} (\nu), \nu), (i)} (s _ {h}, \nu_ {h} ^ {(i)} (s _ {h}), \pi_ {h} ^ {\star} (\nu) (s _ {h})) \\ = \sum_ {i = 1} ^ {N} u _ {h} ^ {(i)} (s _ {h}, \nu_ {h} ^ {(i)} (s _ {h})) + \int_ {\mathcal {S}} \sum_ {i = 1} ^ {N} V _ {h + 1} ^ {(\pi^ {\star} (\nu), \nu), (i)} (s ^ {\prime}) P _ {h} (\mathrm {d} s ^ {\prime} | s _ {h}, \pi_ {h} ^ {\star} (\nu) (s _ {h})) \\ \geq \sum_ {i = 1} ^ {N} u _ {h} ^ {(i)} \left(s _ {h}, \nu_ {h} ^ {(i)} \left(s _ {h}\right)\right) + \int_ {\mathcal {S}} \sum_ {i = 1} ^ {N} V _ {h + 1} ^ {\left(\pi^ {\star} (\nu), \nu\right), (i)} \left(s ^ {\prime}\right) P _ {h} \left(\mathrm {d} s ^ {\prime} \mid s _ {h}, \pi_ {h} \left(s _ {h}\right)\right) \tag {49} \\ \geq \sum_ {i = 1} ^ {N} u _ {h} ^ {(i)} (s _ {h}, \nu_ {h} ^ {(i)} (s _ {h})) + \int_ {\mathcal {S}} \sum_ {i = 1} ^ {N} V _ {h + 1} ^ {(\pi , \nu), (i)} (s ^ {\prime}) P _ {h} (\mathrm {d} s ^ {\prime} | s _ {h}, \pi_ {h} (s _ {h})) \\ = \sum_ {i = 1} ^ {N} V _ {h} ^ {(\pi , \nu), (i)} (s _ {h}). \\ \end{array} +$$ + +where the first inequality follows from the choice of $\pi_h^\star$ in (7) and the second inequality follows from induction, proving the first part of Theorem 2.6. When the inequality holds for $h = 1$ , all the inequalities become equalities, which further implies that $\pi_h(s_h) \in \arg \max_{b_h \in \mathcal{B}} \sum_{i=1}^{N} V_{h+1}^{(\pi^\star(\nu), \nu), (i)}(s') P_h(\mathrm{d}s'| s_h, b_h)$ , finishing the proof. + +# F. Proofs for Online Learning Algorithm: Section 3 + +# F.1. Proof for Lemma C.1 + +Proof of Lemma C.1. See Lemma 4.9 in Cai et al. (2020b) for a detailed proof. + +# F.2. Proof for Lemma C.2 + +Proof of Lemma C.2. We decompose the left-hand side of (35) into two terms + +$$ +\begin{array}{l} \sum_ {i = 1} ^ {N} Q _ {h} ^ {k, (i)} (s _ {h}, \nu_ {h} ^ {\star , (i)} (\nu^ {k}) (s _ {h} ^ {k}), \pi_ {h} ^ {\dagger} (\nu^ {k}) (s _ {h} ^ {k})) - Q _ {h} ^ {k, (i)} (s _ {h} ^ {k}, \nu_ {h} ^ {k, (i)} (s _ {h} ^ {k}), \pi_ {h} ^ {k} (s _ {h} ^ {k})) \\ = \underbrace {\sum_ {i = 1} ^ {N} Q _ {h} ^ {k , (i)} \left(s _ {h} ^ {k} , \nu_ {h} ^ {\star , (i)} \left(\nu^ {k}\right) \left(s _ {h} ^ {k}\right) , \pi_ {h} ^ {\dagger} \left(\nu^ {k}\right) \left(s _ {h} ^ {k}\right)\right) - Q _ {h} ^ {k , (i)} \left(s _ {h} ^ {k} , \nu_ {h} ^ {k , (i)} \left(s _ {h} ^ {k}\right) , \pi_ {h} ^ {\dagger} \left(\nu^ {k}\right) \left(s _ {h} ^ {k}\right)\right)} _ {\text {(i)}} \tag {50} \\ + \underbrace {\sum_ {i = 1} ^ {N} Q _ {h} ^ {k , (i)} \left(s _ {h} ^ {k} , \nu_ {h} ^ {k , (i)} \left(s _ {h} ^ {k}\right) , \pi_ {h} ^ {\dagger} \left(\nu^ {k}\right) \left(s _ {h} ^ {k}\right)\right) - Q _ {h} ^ {k , (i)} \left(s _ {h} ^ {k} , \nu_ {h} ^ {k , (i)} \left(s _ {h} ^ {k}\right) , \pi_ {h} ^ {k} \left(s _ {h} ^ {k}\right)\right)} _ {\text {(i i)}}. \\ \end{array} +$$ + +For term (i), consider that for any agent $i \in [N]$ , it holds that + +$$ +\begin{array}{l} \left(\mathrm {i}\right) = Q _ {h} ^ {k, (i)} \left(s _ {h}, \nu_ {h} ^ {\star , (i)} \left(\nu^ {k}\right) \left(s _ {h}\right), \pi_ {h} ^ {\dagger} \left(\nu^ {k}\right) \left(s _ {h}\right)\right) - Q _ {h} ^ {k, (i)} \left(s _ {h}, \nu_ {h} ^ {k, (i)} \left(s _ {h}\right), \pi_ {h} ^ {\star} \left(\nu^ {k}\right) \left(s _ {h}\right)\right) \tag {51} \\ = \widehat {u} _ {h} ^ {k, (i)} \left(s _ {h}, v _ {h} ^ {\star , (i)} \left(v ^ {k}\right) \left(s _ {h}\right)\right) - \widehat {u} _ {h} ^ {k, (i)} \left(s _ {h}, v _ {h} ^ {k, (i)} \left(v ^ {k}\right) \left(s _ {h}\right)\right) \leq 0, \\ \end{array} +$$ + +where the inequality holds due to the fact that $\nu_h^k$ is a competitive equilibrium policy against $\{\widehat{u}_h^{k,(i)}\}_{i\in [N]}$ and the definition of the best response policy $\nu^{\star}(\nu^{k})$ for the agent $\nu^k$ . For term (ii), consider we have that + +$$ +\begin{array}{l} \mathrm {(i i)} = \sum_ {i = 1} ^ {N} Q _ {h} ^ {k, (i)} \left(s _ {h} ^ {k}, \nu_ {h} ^ {k, (i)} \left(s _ {h} ^ {k}\right), \pi_ {h} ^ {\dagger} \left(\nu^ {k}\right) \left(s _ {h} ^ {k}\right)\right) - Q _ {h} ^ {k, (i)} \left(s _ {h} ^ {k}, \nu_ {h} ^ {k, (i)} \left(s _ {h} ^ {k}\right), \pi_ {h} ^ {k} \left(s _ {h} ^ {k}\right)\right) \\ = \sum_ {i = 1} ^ {N} \int_ {\mathcal {S}} V _ {h + 1} ^ {k, (i)} \left(s ^ {\prime}\right) \widehat {P} _ {h} ^ {k} \left(\mathrm {d} s ^ {\prime} \mid s _ {h}, \pi_ {h} ^ {\dagger} \left(\nu^ {k}\right) \left(s _ {h}\right)\right) - \sum_ {i = 1} ^ {N} \int_ {\mathcal {S}} V _ {h + 1} ^ {k, (i)} \left(s ^ {\prime}\right) \widehat {P} _ {h} ^ {k} \left(\mathrm {d} s ^ {\prime} \mid s _ {h}, \pi_ {h} ^ {k} \left(s _ {h}\right)\right) \leq 0, \tag {52} \\ \end{array} +$$ + +where the inequality holds due to the greedy choice of $\pi_h^k$ in Line 4 of Algorithm 1. This finished the proof. + +# F.3. Proof for Lemma C.3 + +Proof of Lemma C.3. First we introduce the following definition of filtration for the later analysis. + +Definition F.1 (Filtration: Online Learning). We define the time index map $t(\cdot, \cdot)$ by $t(k, h) = H \cdot (j - 1) + h$ for any $(k, h) \in [K] \times [H]$ , which is a bijection from $[K] \times [H]$ to $[KH]$ . Then, for any $(k, h) \in [K] \times [H]$ , we define $\mathcal{F}_{t(k, h)}$ as the $\sigma$ -algebra generated by + +$$ +\left(s _ {1} ^ {1}, a _ {1} ^ {1}, b _ {1} ^ {1}, \{u _ {h} ^ {1, (i)} \} _ {i \in [ N ]}, \dots , s _ {H} ^ {1}, a _ {H} ^ {1}, b _ {H} ^ {1}, \{u _ {H} ^ {1, (i)} \} _ {i \in [ N ]}, s _ {1} ^ {2}, a _ {1} ^ {2}, b _ {1} ^ {2}, \{u _ {h} ^ {2, (i)} \} _ {i \in [ N ]}, \dots , s _ {h} ^ {k}, a _ {h} ^ {k}, b _ {h} ^ {k}, \{u _ {h} ^ {k, (i)} \} _ {i \in [ N ]}\right), +$$ + +which are the utility samples and state-action pairs determined before $s_{h + 1}^{k}$ . The sequence $\{\mathcal{F}_t\}_{t\geq 1}$ is a filtration. + +Also, we define $E$ as the event when the true model is contained in the confidence set of Algorithm 1. + +$$ +E := \left\{P _ {h} \in \mathcal {P} _ {h} ^ {k}, u _ {h} ^ {(i)} \in \mathcal {U} _ {h} ^ {k, (i)}, \quad \text {f o r a l l} (k, h, i) \in [ K ] \times [ H ] \times [ N ] \right\}. \tag {53} +$$ + +Then we introduce the following lemma to show that event $E$ happens with at least $1 - p$ probability. + +Lemma F.2. For any $\delta \in [0,1]$ , if we set + +$$ +\begin{array}{l} \beta^ {(1)} = 2 \log (\mathcal {N} (1 / K, \mathcal {U}, \| \cdot \| _ {\infty}) \cdot 4 H N / \delta) + 4 (1 + \sqrt {\log (1 6 K ^ {2} H N / \delta)}), \\ \beta^ {(2)} = 2 H ^ {2} N ^ {2} \log (\mathcal {N} (1 / (K H N), \mathcal {P}, \| \cdot \| _ {\infty}) \cdot 4 H / \delta) + 4 H N (1 + \sqrt {\log (1 6 K ^ {2} H / \delta)} / 2)) \\ \end{array} +$$ + +in Algorithm 1, then with probability at least $1 - \delta /2$ , event $E$ happens. + +Proof of Lemma F.2. Let $\{(X_{\tau},Y_{\tau})\}_{\tau \geq 1}$ be a sequence of random elements in $\mathcal{X} \times \mathbb{R}$ for some measurable set $\mathcal{X}$ . Let $\mathcal{Z}$ be a set of $[0,C]$ -valued measurable functions with domain $\mathcal{X}$ for some constant $C > 0$ . Let $\mathcal{F} = \{\mathcal{F}_{\tau}\}_{\tau \geq 1}$ be a filtration such that for all $\tau \geq 1$ , $(X_1,Y_1,\dots ,X_{\tau -1},Y_{\tau -1},X_{\tau})$ is $\mathcal{F}_{\tau -1}$ -measurable and there exists $z^{*} \in \mathcal{Z}$ such that $\mathbb{E}[Y_{\tau}|\mathcal{F}_{\tau -1}] = z^{*}(X_{\tau})$ holds. The least-squares predictor given $\{(X_{\tau},Y_{\tau})\}_{\tau = 1}^{t}$ is defined as + +$$ +\widehat {z} _ {t} = \underset {z \in \mathcal {Z}} {\operatorname {a r g m i n}} \sum_ {\tau = 1} ^ {t} \left(z \left(X _ {\tau}\right) - Y _ {\tau}\right) ^ {2}. +$$ + +We say that $\eta$ is conditionally $\sigma$ -sub-Gaussian given $\mathcal{F}_{\tau} \in \mathcal{F}$ for any $\tau \geq 1$ if for all $\lambda \in \mathbb{R}$ , + +$$ +\log \mathbb {E} \left[ \exp (\lambda \eta) | \mathcal {F} _ {\tau} \right] \leq \lambda^ {2} \sigma^ {2} / 2. +$$ + +For any $\varepsilon > 0$ , we denote by $\mathcal{N}(\varepsilon, \mathcal{Z}, \| \cdot \|_{\infty})$ the $\varepsilon$ -covering number of $\mathcal{Z}$ with respect to the supremum norm distance $\| z_1 - z_2 \|_{\infty} = \sup_{x \in \mathbb{R}} |z_1(x) - z_2(x)|$ . For any $\beta > 0$ , we define + +$$ +\mathcal {Z} _ {t} (\beta) = \Big \{z \in \mathcal {Z}: \sum_ {\tau = 1} ^ {t} \big (z \left(X _ {\tau}\right) - \widehat {z} _ {t} \left(X _ {\tau}\right) \big) ^ {2} \leq \beta \Big \}. +$$ + +To utilize the concept of Eluder dimension, we introduce the following lemma. + +Lemma F.3. Assume that for any $\tau \geq 1, Y_{\tau} - z^{*}(X_{\tau})$ is conditionally $\sigma$ -sub-Gaussian given $\mathcal{F}_{\tau-1}$ . Then, for any $\varepsilon > 0$ and $\delta \in [0,1]$ , with probability at least $1 - \delta$ , for all $t \geq 1, z^{*} \in \mathcal{Z}_t(\beta_t(\delta, \varepsilon))$ , where + +$$ +\beta_ {t} (\delta , \varepsilon) = 8 \sigma^ {2} \log \left(\mathcal {N} \left(\varepsilon , \mathcal {Z}, \| \cdot \| _ {\infty}\right) / \delta\right) + 4 t \varepsilon \left(C + \sqrt {\sigma^ {2} \log (4 t (t + 1) / \delta)}\right). +$$ + +Proof of Lemma F.3. See Proposition 6 of Russo & Van Roy (2013) for a detailed proof. + +![](images/f380af8e5df9efbae9a00788f230b7eb68f5a84386636e80928b053c0e438436.jpg) + +Then we are ready to prove Lemma F.2. It suffices to show $u_h^{(i)} \in \mathcal{U}_h^{k,(i)}$ and $P_h \in \mathcal{P}_h^k$ respectively. + +Utility Function Estimation. We denote by $\mathcal{U}$ as the set of all the functions $u: \mathcal{S} \times \mathcal{X}^{(i)} \mapsto [0,1]$ (note that $\mathcal{X}^{(i)} = [0,1]^m$ ). For any $(k,h,i) \in [K] \times [H] \times [N]$ , we set $Y_k^{(i)} = u_h^{k,(i)}$ , $X_k^{(i)} = (s_h^k, x_h^{k,(i)})$ , and $u^*(\cdot,\cdot) = u_h^{(i)}(\cdot,\cdot)$ . We have that $Y_\tau^{(i)} - u^*(X_\tau^{(i)})$ is conditionally 1/2-sub-Gaussian given $\mathcal{F}_{t(k,h)}$ defined in Definition F.1. By setting + +$$ +\beta^ {(1)} = 2 \log (\mathcal {N} (1 / K, \mathcal {U}, \| \cdot \| _ {\infty}) \cdot 4 H N / \delta) + 4 \left(1 + \sqrt {\log (1 6 K ^ {2} H N / \delta)}\right), +$$ + +in Algorithm 1, we can easily check that, using the notion in Lemma F.3, we have that + +$$ +\begin{array}{l} \beta^ {(1)} \geq 2 \log (\mathcal {N} (1 / K, \mathcal {U}, \| \cdot \| _ {\infty}) \cdot 4 H N / \delta) + 4 (k - 1) / K \cdot \left(1 + \sqrt {\log (1 6 k (k - 1) H N / \delta)}\right) \\ = \beta_ {k - 1} (\delta / (4 H N), 1 / K), \\ \end{array} +$$ + +for all $k \in [K]$ . Thus by Lemma F.3, with probability at least $1 - \delta / (4HN)$ , for any $k \in [K]$ we have that + +$$ +u _ {h} ^ {(i)} = u ^ {\star} \in \left\{u \in \mathcal {U}: \sum_ {\tau = 1} ^ {k} \left(u _ {h} ^ {k, (i)} (s _ {h} ^ {\tau}, x _ {h} ^ {\tau , (i)}) - u (s _ {h} ^ {\tau}, x _ {h} ^ {\tau , (i)})\right) ^ {2} \leq \beta_ {k - 1} \right\} \subseteq \mathcal {U} _ {h} ^ {k, (i)}, +$$ + +which gives $u_h^{(i)} \in \mathcal{U}_h^{k,(i)}$ for all $k \in [K]$ . Now using a union bound argument over $h \in [H]$ and $i \in [N]$ we conclude that with probability at least $1 - \delta / 4$ , for all $[K] \times [H] \times [N]$ , we have $u_h^{(i)} \in \mathcal{U}_h^{k,(i)}$ . + +Transition Kernel Estimation. Following Cai et al. (2020b), for any $P \in \mathcal{P}$ , we define $z_P: \mathcal{S} \times \mathcal{B} \times [0,HN]^{\mathcal{S}} \to [0,HN]$ by + +$$ +z _ {P} (s, b, f (\cdot)) = \int_ {\mathcal {S}} f (s ^ {\prime}) P (\mathrm {d} s ^ {\prime} | s, b), \quad \forall (s, b, f (\cdot)) \in \mathcal {S} \times \mathcal {B} \times [ 0, H N ] ^ {\mathcal {S}}, +$$ + +and $\mathcal{Z} = \{z_P : P \in \mathcal{P}\}$ . For any $(k, h) \in [K] \times [H]$ , we set $Y_k = \sum_{i=1}^{N} V_{h+1}^{k,(i)}(s_{h+1}^k)$ , $X_k = (s_h^k, b_h^k, \sum_{i=1}^{N} V_{h+1}^{k,(i)}(\cdot))$ , and $z^* = z_{P_h}$ . We have that $Y_\tau - z^*(X_\tau)$ is conditionally $HN/2$ -sub-Gaussian given $\mathcal{F}_{t(k,h)}$ defined in Definition F.1. Also, by the definition of $\mathcal{P}_h^k$ , we have that $\mathcal{Z}_k(\beta) = \{z_P : P \in \mathcal{P}_h^k\}$ . By setting + +$$ +\beta^ {(2)} = 2 H ^ {2} N ^ {2} \log (\mathcal {N} (1 / (K H N), \mathcal {P}, \| \cdot \| _ {\infty}) \cdot 4 H / \delta) + 4 H N \left(1 + \sqrt {\log (1 6 K ^ {2} H / \delta)} / 2\right), +$$ + +in Algorithm 1, we can check that, using the notion in Lemma F.3, we can show that + +$$ +\begin{array}{l} \beta^ {(2)} \geq 2 H ^ {2} N ^ {2} \log (\mathcal {N} (1 / K, \mathcal {Z}, \| \cdot \| _ {\infty}) \cdot 4 H / \delta) + 4 (k - 1) / K \cdot \left(H N + \sqrt {H ^ {2} N ^ {2} / 4 \cdot \log (1 6 k (k - 1) H / \delta)}\right) \\ = \beta_ {k - 1} (\delta / 4 H, 1 / K) \\ \end{array} +$$ + +for all $k \in [K]$ , where we leave the proof of $\mathcal{N}(\varepsilon, \mathcal{Z}, \| \cdot \|_{\infty}) \leq \mathcal{N}(\varepsilon / HN, \mathcal{P}, \| \cdot \|_{\infty,1})$ in the end. Applying Lemma F.3, with probability at least $1 - \delta / 4H$ , for all $k \in [K]$ , we have that + +$$ +z ^ {*} \in \mathcal {Z} _ {k} (\beta_ {k - 1} (\delta / 4 H, 1 / K)) \subset \mathcal {Z} _ {k} (\beta), +$$ + +which implies that $P_{h}\in \mathcal{P}_{h}^{k}$ . Now applying a union bound over all $h\in [H]$ , with probability at least $1 - \delta /4$ , for all $(k,H)\in [K]\times [H]$ , we have that $P_{h}\in \mathcal{P}_{h}^{k}$ . In the sequel, we show that $\mathcal{N}(\varepsilon ,\mathcal{Z},\| \cdot \|_{\infty})\leq \mathcal{N}(\varepsilon /HN,\mathcal{P},\| \cdot \|_{\infty ,1})$ for any $\varepsilon >0$ . Indeed, this is proved by using the fact that for any $z_P,z_{P'}\in \mathcal{Z}$ with $P,P'\in \mathcal{P}$ , we have that + +$$ +\begin{array}{l} \left\| z _ {P} - z _ {P ^ {\prime}} \right\| _ {\infty} = \sup _ {(s, b, f (\cdot)) \in \mathcal {S} \times \mathcal {B} \times [ 0, H N ] ^ {\mathcal {S}}} \left| \int_ {\mathcal {S}} f (s ^ {\prime}) P (\mathrm {d} s ^ {\prime} | s, b) \mathrm {d} s ^ {\prime} - \int_ {\mathcal {S}} V (s ^ {\prime}) P ^ {\prime} (s ^ {\prime} | s, b) \mathrm {d} s ^ {\prime} \right| \\ \leq \sup _ {(s, b, f (\cdot)) \in \mathcal {S} \times \mathcal {B} \times [ 0, H N ] ^ {\mathcal {S}}} H N \cdot \int_ {\mathcal {S}} | P (\mathrm {d} s ^ {\prime} | s, b) - P ^ {\prime} (\mathrm {d} s ^ {\prime} | s, b) | = H N \cdot \| P - P ^ {\prime} \| _ {\infty , 1}. \\ \end{array} +$$ + +Thus we have proved the results for both utility function and transition kernel. Now applying a union bound we can conclude that with the choice of $\beta^{(1)},\beta^{(2)}$ in Lemma F.2, with probability at least $1 - \delta /2$ , event $E$ holds. + +Now based on event $E$ , we present the proof of the two conclusions in Lemma C.3 respectively. + +Conclusion 1: Optimism. The optimism result directly holds under event $E$ . In fact, for any $(k,h) \in [K] \times [H]$ , when $P_h \in \mathcal{P}_h^k$ and $u_h^{(i)} \in \mathcal{U}_h^{k,(i)}$ , by the definition of $Q_h^{k,(i)}$ it holds that + +$$ +\begin{array}{l} - \iota_ {h} ^ {k} (s _ {h}, a _ {h}, b _ {h}) = \sum_ {i = 1} ^ {N} \max _ {u \in \mathcal {U} _ {h} ^ {k, (i)}} u (s _ {h}, x _ {h} ^ {(i)}) - u _ {h} (s _ {h}, x _ {h} ^ {(i)}) \\ + \sum_ {i = 1} ^ {N} Q _ {h} ^ {k, (i)} \left(s _ {h}, x _ {h} ^ {(i)}\right) - \widehat {u} _ {h} ^ {(i)} \left(c _ {h}, x _ {h} ^ {(i)}\right) - \int_ {S} P _ {h} \left(\mathrm {d} s ^ {\prime} \mid s _ {h}, b _ {h}\right) V _ {h + 1} ^ {k, (i)} \left(s ^ {\prime}\right) \tag {54} \\ \geq \sum_ {i = 1} ^ {N} Q _ {h} ^ {k, (i)} \left(s _ {h}, x _ {h} ^ {(i)}\right) - \widehat {u} _ {h} ^ {(i)} \left(c _ {h}, x _ {h} ^ {(i)}\right) - \int_ {\mathcal {S}} P _ {h} \left(\mathrm {d} s ^ {\prime} \mid s _ {h}, b _ {h}\right) V _ {h + 1} ^ {k, (i)} \left(s ^ {\prime}\right) \\ = \sum_ {i = 1} ^ {N} \mathsf {C l i p} _ {[ 0, H - h ]} \left(\int_ {S} \widehat {P} _ {h} ^ {k} (\mathrm {d} s ^ {\prime} | s _ {h}, b _ {h}) V _ {h + 1} ^ {k, (i)} (s ^ {\prime})\right) - \int_ {\mathcal {S}} P _ {h + 1} (\mathrm {d} s ^ {\prime} | s _ {h}, b _ {h}) V _ {h + 1} ^ {k, (i)} (s ^ {\prime}), \\ \end{array} +$$ + +where the inequality follows from event $E$ and the optimistic choice of $\widehat{u}_h^{k,(i)}$ . Also, for $h = H$ , the right-hand side of (54) is zero since $V_{H + 1}^{k,(i)}(\cdot) = 0$ . For $h < H$ , by the construction of $Q_{h + 1}^{k,(i)}$ and the fact that $\widehat{u}_{h + 1}^{k,(i)}(\cdot ,\cdot)\in [0,1]$ , + +$$ +Q _ {h + 1} ^ {k, (i)} (s _ {h + 1}, x _ {h + 1} ^ {(i)}, b _ {h + 1}) \in [ 0, H - h ], V _ {h + 1} ^ {k, (i)} (s _ {h + 1}) \in [ 0, H - h ], \int_ {\mathcal {S}} V _ {h + 1} ^ {k, (i)} (s ^ {\prime}) P _ {h} (\mathrm {d} s ^ {\prime} | s _ {h}, b _ {h}) \in [ 0, H - h ]. +$$ + +For any $s_h, s_{h+1} \in \mathcal{S}, a_{h+1} \in \mathcal{A}$ , and $b_h, b_{h+1} \in \mathcal{B}$ . Thus, it yields from (54) that + +$$ +\begin{array}{l} - \iota_ {h} ^ {k} \left(s _ {h}, a _ {h}, b _ {h}\right) = \sum_ {i = 1} ^ {N} \int_ {S} \widehat {P} _ {h} ^ {k} \left(\mathrm {d} s ^ {\prime} \mid s _ {h}, b _ {h}\right) V _ {h + 1} ^ {k, (i)} \left(s ^ {\prime}\right) - \int_ {S} P _ {h + 1} \left(\mathrm {d} s ^ {\prime} \mid s _ {h}, b _ {h}\right) V _ {h + 1} ^ {k, (i)} \left(s ^ {\prime}\right) \tag {55} \\ = \max _ {P \in \mathcal {P} _ {h} ^ {k}} \int_ {\mathcal {S}} \sum_ {i = 1} ^ {N} V _ {h + 1} ^ {k, (i)} (s ^ {\prime}) P (\mathrm {d} s ^ {\prime} | s _ {h}, b _ {h}) - \int_ {\mathcal {S}} \sum_ {i = 1} ^ {N} V _ {h + 1} ^ {k, (i)} (s ^ {\prime}) P _ {h} (\mathrm {d} s ^ {\prime} | s _ {h}, b _ {h}) \geq 0, \\ \end{array} +$$ + +where the last step follows from the definition of event $E$ and the optimistic choice of $\widehat{P}_h^k$ . Therefore, + +$$ +\iota_ {h} ^ {k} (s _ {h}, a _ {h}, b _ {h}) = \sum_ {i = 1} ^ {N} u _ {h} ^ {k, (i)} (s _ {h}, x _ {h} ^ {(i)}) + \int_ {\mathcal {S}} P _ {h} (\mathrm {d} s ^ {\prime} | s _ {h}, b _ {h}) V _ {h + 1} ^ {k, (i)} (s ^ {\prime}) - Q _ {h} ^ {k, (i)} (s _ {h}, x _ {h} ^ {(i)}, b _ {h}) \leq 0, +$$ + +for all $(s_h, x_h^{(i)}, b_h) \in S \times \mathcal{X}^{(i)} \times \mathcal{B}$ . This proves the first conclusion of Lemma C.3. + +Conclusion 2: Accuracy. First we introduce the following lemma to decompose the martingale. + +Lemma F.4 (Martingale Decomposition). For any $k \in [K]$ , we have the following decomposition, + +$$ +\sum_ {i = 1} ^ {N} V _ {1} ^ {k, (i)} \left(s _ {1} ^ {k}\right) - V _ {1} ^ {\left(\pi^ {k}, \nu^ {k}\right), (i)} \left(s _ {1} ^ {k}\right) = \sum_ {h = 1} ^ {H} D _ {h} ^ {k} + \sum_ {h = 1} ^ {H} - \iota_ {h} ^ {k} \left(s _ {h} ^ {k}, a _ {h} ^ {k}, b _ {h} ^ {k}\right), +$$ + +where $\iota_h^k$ is defined in (38) and the term $D_h^k$ takes the form + +$$ +D _ {h} ^ {k} = \int_ {\mathcal {S}} \sum_ {i = 1} ^ {N} \left(V _ {h + 1} ^ {k, (i)} (s ^ {\prime}) - V _ {h + 1} ^ {(\pi^ {k}, \nu^ {k}), (i)} (s ^ {\prime})\right) P _ {h} (\mathrm {d} s ^ {\prime} | s _ {h} ^ {k}, a _ {h} ^ {k}) - \sum_ {i = 1} ^ {N} V _ {h + 1} ^ {k, (i)} (s _ {h + 1} ^ {k}) - V _ {h + 1} ^ {(\pi^ {k}, \nu^ {k}), (i)} (s _ {h + 1} ^ {k}) +$$ + +Moreover, we have $D_H^k = 0$ for all $k \in [K]$ , and $D_1^1, D_2^1, D_3^1, \dots, D_{H-1}^1, D_1^2, D_2^2, \dots$ , is a martingale difference sequence with respect to the filtration $\{\mathcal{F}_t\}_{t \geq 1}$ defined in Definition F.1, where each term is bounded by $2HN$ . + +Proof of Lemma F.4. See Lemma F.1 of Cai et al. (2020b) for a detailed proof. + +Upon applying Lemma F.4, we have the following decomposition: + +$$ +\begin{array}{l} \sum_ {k = 1} ^ {K} \sum_ {i = 1} ^ {N} V _ {1} ^ {k, (i)} \left(s _ {1} ^ {k}\right) - V _ {1} ^ {\left(\pi^ {k}, \nu^ {k}\right), (i)} \left(s _ {1} ^ {k}\right) = \underbrace {\sum_ {k = 1} ^ {K} \sum_ {h = 1} ^ {H} D _ {h} ^ {k}} _ {\text {(i)}} + \underbrace {\sum_ {k = 1} ^ {K} \sum_ {h = 1} ^ {H} \sum_ {i = 1} ^ {N} \left(- u _ {h} ^ {(i)} \left(s _ {h} ^ {k} , x _ {h} ^ {k , (i)}\right) + \widehat {u} _ {h} ^ {k , (i)} \left(s _ {h} ^ {k} , x _ {h} ^ {k , (i)}\right)\right)} _ {\text {(i i)}} \\ + \underbrace {\sum_ {k = 1} ^ {K} \sum_ {h = 1} ^ {H} \sum_ {i = 1} ^ {N} \left(Q _ {h} ^ {k , (i)} \left(s _ {h} ^ {k} , x _ {h} ^ {k , (i)} , b _ {h} ^ {k}\right) - \widehat {u} _ {h} ^ {k , (i)} \left(s _ {h} ^ {k} , x _ {h} ^ {k , (i)}\right) - \int_ {\mathcal {S}} P _ {h} \left(\mathrm {d} s ^ {\prime} \mid s _ {h} ^ {k} , b _ {h} ^ {k}\right) V _ {h + 1} ^ {k , (i)} \left(s ^ {\prime}\right)\right)} _ {\text {(i i i)}}. \end{array} \tag {56} +$$ + +For term (i) in (56), note that $|D_h^k |\leq 2NH,D_H^k = 0$ for all $(k,h)\in [K]\times [H]$ , and + +$$ +D _ {1} ^ {1}, D _ {2} ^ {1}, D _ {3} ^ {1}, \dots , D _ {H - 1} ^ {1}, D _ {1} ^ {2}, D _ {2} ^ {2}, \dots +$$ + +is a martingale difference sequence. Using the Azuma-Hoeffding inequality, we obtain that, with probability at least $1 - \delta /2$ it holds that + +$$ +\left(\mathrm {i}\right) \leq \sqrt {8 K H ^ {3} N ^ {2} \log (2 / \delta)}. \tag {57} +$$ + +To deal with the remaining two terms, we introduce the following lemma. + +Lemma F.5 (Telescoping Sum). For any $\alpha > 0$ , and $\beta > 0$ , we have + +$$ +\sum_ {k = 1} ^ {K} \sup _ {z, z ^ {\prime} \in \mathcal {Z} _ {k} (\beta)} | z (x _ {k}) - z ^ {\prime} (x _ {k}) | \leq 1 + C \cdot d + 4 \cdot \sqrt {d \beta K}. +$$ + +where $d = \dim_{\mathrm{E}}(\mathcal{Z},1 / K)$ + +Proof of Lemma F.5. See Lemma 5 of Russo & Van Roy (2013) for a detailed proof. + +For term (ii) in (56), under event $E$ and applying Lemma F.5, it holds that, with $d_{1} \coloneqq \dim_{\mathbb{E}}(\mathcal{U}, 1 / K)$ , + +$$ +\leq H N \sum_ {k = 1} ^ {K} \max _ {u \in \mathcal {U} _ {h} ^ {k, (i)}} u \left(s _ {h} ^ {k}, x _ {h} ^ {k, (i)}\right) - \min _ {u \in \mathcal {U} _ {h} ^ {k, (i)}} u \left(s _ {h} ^ {k}, x _ {h} ^ {k, (i)}\right) \leq H N \left(1 + d _ {1} + 4 \sqrt {d _ {1} \beta^ {(1)} K}\right), \tag {58} +$$ + +For term (iii) in (56), under event $E$ and applying Lemma F.5, it holds that, with $d_2 \coloneqq \dim_{\mathbb{E}}(\mathcal{Z}_P, 1 / K)$ , + +$$ +\begin{array}{l} (i i i) \leq H \sum_ {k = 1} ^ {K} \max _ {P \in \mathcal {P} _ {h} ^ {k}} \int_ {\mathcal {S}} \sum_ {i = 1} ^ {N} V _ {h + 1} ^ {k, (i)} \left(s ^ {\prime}\right) P \left(\mathrm {d} s ^ {\prime} \mid s _ {h} ^ {k}, b _ {h} ^ {k}\right) - \int_ {\mathcal {S}} \sum_ {i = 1} ^ {N} V _ {h + 1} ^ {k, (i)} \left(s ^ {\prime}\right) P _ {h} \left(\mathrm {d} s ^ {\prime} \mid s _ {h} ^ {k}, b _ {h} ^ {k}\right) \\ \leq H \sum_ {k = 1} ^ {K} \max _ {P \in \mathcal {P} _ {h} ^ {k}} \int_ {\mathcal {S}} \sum_ {i = 1} ^ {N} V _ {h + 1} ^ {k, (i)} \left(s ^ {\prime}\right) P \left(\mathrm {d} s ^ {\prime} \mid s _ {h} ^ {k}, b _ {h} ^ {k}\right) - \min _ {P \in \mathcal {P} _ {h} ^ {k}} \int_ {\mathcal {S}} \sum_ {i = 1} ^ {N} V _ {h + 1} ^ {k, (i)} \left(s ^ {\prime}\right) P \left( \right.\mathrm {d} s ^ {\prime} \mid s _ {h} ^ {k}, b _ {h} ^ {k}\) \tag {59} \\ \leq H (1 + d _ {1} H N + 4 \sqrt {d _ {2} \beta^ {(2)} K}), \\ \end{array} +$$ + +Finally, combining bounds (57), (58), and (59), we conclude that with probability at least $1 - \delta$ , + +$$ +\begin{array}{l} \sum_ {k = 1} ^ {K} \sum_ {i = 1} ^ {N} V _ {1} ^ {k, (i)} (s _ {1} ^ {k}) - V _ {1} ^ {(\pi^ {k}, \nu^ {k}), (i)} (s _ {1} ^ {k}) \\ \leq \sqrt {8 K H ^ {3} N ^ {2} \log (2 / \delta)} + H N \left(1 + d _ {1} + 4 \sqrt {d _ {1} \beta^ {(1)} K}\right) + H \left(1 + d _ {1} H N + 4 \sqrt {d _ {2} \beta^ {(2)} K}\right) \tag {60} \\ \leq \sqrt {8 K H ^ {3} N ^ {2} \log (2 / \delta)} + (1 + d) H (H + N) + 4 H N \sqrt {d \beta^ {(1)} K} + 4 \sqrt {d \beta^ {(2)} K} \\ \leq \sqrt {8 K H ^ {3} N ^ {2} \log (2 / \delta)} + (1 + d) H (H + N) + 4 H \sqrt {2 d (N ^ {2} \beta^ {(1)} + \beta^ {(2)}) K}, \\ \end{array} +$$ + +where $d = \max \{d_1, d_2\}$ and the last inequality follows from the fact that the inequality $\sqrt{x} + \sqrt{y} \leq \sqrt{2(x + y)}$ . This proves the second conclusion in Lemma C.3 and finishes the proof of Lemma C.3. + +# F.4. Proof for Theorem 3.4: Regret for Fair Division Property + +Proof. Recalling the definition of FD loss in (14), note that + +$$ +\begin{array}{l} \ell_ {h} ^ {\mathrm {P E}} (\nu^ {k}, s _ {h}) = \inf _ {x \in \mathrm {S I} (s _ {h}, h)} \sum_ {i = 1} ^ {N} (u _ {h} ^ {(i)} (s _ {h}, x ^ {(i)}) - u _ {h} ^ {(i)} (s _ {h}, \nu_ {h} ^ {k, (i)} (s _ {h}))) \\ \leq \sum_ {i = 1} ^ {N} (u _ {h} ^ {(i)} (s _ {h}, \nu_ {h} ^ {\star , (i)} (\nu^ {k}) (s _ {h})) - u _ {h} ^ {(i)} (s _ {h}, \nu_ {h} ^ {k, (i)} (s _ {h}))). \\ \end{array} +$$ + +Also, observe that + +$$ +\begin{array}{l} \ell_ {h} ^ {\mathrm {S I}} \left(\nu^ {k}, s _ {h}\right) = \sum_ {i = 1} ^ {N} \left(u _ {h} ^ {(i)} \left(s _ {h}, e ^ {(i)}\right) - u _ {h} ^ {(i)} \left(s _ {h}, \nu_ {h} ^ {k, (i)} \left(s _ {h}\right)\right)\right) \\ \leq \sum_ {i = 1} ^ {N} \left(u _ {h} ^ {(i)} \left(s _ {h}, v _ {h} ^ {\star , (i)} \left(v ^ {k}\right) \left(s _ {h}\right)\right) - u _ {h} ^ {(i)} \left(s _ {h}, v _ {h} ^ {k, (i)} \left(s _ {h}\right)\right)\right), \\ \end{array} +$$ + +where the inequality originates from the definition of $\nu_h^\star$ in Definition 2.2. Under the event $E$ defined in (53), following the same procedure as in dealing with term (ii) in (56), it holds for all $h\in [H]$ that, + +$$ +\begin{array}{l} \sum_ {k = 1} ^ {K} \mathbb {E} _ {\pi^ {k}} \ell_ {h} ^ {\mathrm {F D}} \left(\nu^ {k}, s _ {h}\right) \leq \sum_ {i = 1} ^ {N} \sum_ {k = 1} ^ {K} \mathbb {E} _ {\pi^ {k}} \left[ e \left(u _ {h} ^ {(i)} \left(s _ {h}, \nu_ {h} ^ {\star , (i)} \left(\nu^ {k}\right) \left(s _ {h}\right) - \widehat {u} _ {h} ^ {(i)} \left(s _ {h}, \nu_ {h} ^ {\star , (i)} \left(\nu^ {k}\right) \left(s _ {h}\right)\right)\right)\right) \right. \\ \left. \right.\left. + \left(\widehat {u} _ {h} ^ {(i)} (s _ {h}, \nu_ {h} ^ {\star , (i)} (\nu^ {k}) (s _ {h})) - \widehat {u} _ {h} ^ {(i)} (s _ {h}, \nu_ {h} ^ {k, (i)} (s _ {h}))\right)\right] \\ + \left(\widehat {u} _ {h} ^ {(i)} \left(s _ {h}, \nu_ {h} ^ {k, (i)} \left(s _ {h}\right)\right) - u _ {h} ^ {(i)} \left(s _ {h}, \nu_ {h} ^ {k, (i)} \left(s _ {h}\right)\right)\right) \\ \leq \sum_ {i = 1} ^ {N} \sum_ {k = 1} ^ {K} \mathbb {E} _ {\pi^ {k}} \left[ \max _ {u \in \mathcal {U} _ {h} ^ {k, (i)}} u \left(s _ {h}, x _ {h} ^ {(i)}\right) - \min _ {u \in \mathcal {U} _ {h} ^ {k, (i)}} u \left(s _ {h}, x _ {h} ^ {(i)}\right) \right] \\ \leq N ((1 + d _ {1}) N + N \sqrt {d \beta^ {(1)} K}), \\ \end{array} +$$ + +where we remark that the first two terms in the first line are non-positive because of the definition of event $E$ and $\nu^k$ . Applying the definition of regret for fair division property $\mathrm{Regret}_{\mathrm{FD}}(K)$ , we have that + +$$ +\operatorname {R e g r e t} _ {\mathrm {F D}} (K) \leq \sum_ {h = 1} ^ {H} \sum_ {k = 1} ^ {K} \mathbb {E} _ {\pi^ {k}} \ell_ {h} ^ {F D} (\nu^ {k}, s _ {h} ^ {k}) \leq H ((1 + d _ {1}) N + N \sqrt {d \beta^ {(1)} K}) \leq \mathcal {O} (\sqrt {d H ^ {2} N ^ {2} \beta^ {(1)} K}). +$$ + +This finishes the proof of Theorem 3.4 on the regret for fair division. + +# G. Proofs of Offline Learning Algorithm: Section 4 + +# G.1. Proof of Lemma C.4 + +Proof of Lemma C.4. By the definition of suboptimality in (11) and Lemma C.2, it holds that + +$$ +\begin{array}{l} \operatorname {S u b O p t} (\widehat {\pi}, \widehat {\nu}) = \sum_ {i = 1} ^ {N} \left[ V _ {1, \widehat {u}, \widehat {P}} ^ {(\pi^ {\dagger} (\widehat {\nu}), \nu^ {\star} (\widehat {\nu}))}, (i) - \widehat {V} _ {1, \widehat {u}, \widehat {P}} ^ {(\pi^ {\dagger} (\widehat {\nu}), \nu^ {\star} (\widehat {\nu}))}, (i) + \widehat {V} _ {1, \widehat {u}, \widehat {P}} ^ {(\pi^ {\dagger} (\widehat {\nu}), \nu^ {\star} (\widehat {\nu}))}, (i) - V _ {1} ^ {(\widehat {\pi}, \widehat {\nu}), (i)} \right] \left(s _ {1}\right) \tag {61} \\ \leq \sum_ {i = 1} ^ {N} \left[ V _ {1, \widehat {u}, \widehat {P}} ^ {(\pi^ {\dagger} (\widehat {\nu}), \nu^ {\star} (\widehat {\nu})), (i)} - \widehat {V} _ {1, \widehat {u}, \widehat {P}} ^ {(\pi^ {\dagger} (\widehat {\nu}), \nu^ {\star} (\widehat {\nu})), (i)} + \widehat {V} _ {1, \widehat {u}, \widehat {P}} ^ {(\widehat {\pi}, \widehat {\nu}), (i)} - V _ {1} ^ {(\widehat {\pi}, \widehat {\nu}), (i)} \right] (s _ {1}). \\ \end{array} +$$ + +For notational simplicity, we define $\Delta_h(s) \coloneqq \sum_{i=1}^{N} \left[ V_1^{(\pi^\dagger (\widehat{\nu}), \nu^\star (\widehat{\nu})), (i)} - \widehat{V}_{1,\widehat{u},\widehat{P}}^{(\pi^\dagger (\widehat{\nu}), \nu^\star (\widehat{\nu})), (i)} \right](s)$ and abbreviate $d_h^{(\pi^\dagger (\widehat{\nu}), \nu^\star (\widehat{\nu}))}$ as $d_h$ (Recall the definition of $d_h^{(\pi^\dagger (\widehat{\nu}), \nu^\star (\widehat{\nu}))}$ in (28)). To proceed further, we define that + +$$ +\mu_ {h} ^ {\widehat {u}} := \mathbb {E} _ {d _ {h}} \sum_ {i = 1} ^ {N} \left| \widehat {u} _ {h} ^ {(i)} (s, x ^ {(i)}) - u _ {h} (s, x ^ {(i)}) \right| \text {a n d} \mu_ {h} ^ {\widehat {P}} := \mathbb {E} _ {d _ {h}} \| \widehat {P} _ {h} (\cdot | s, b) - P _ {h} (\cdot | s, b) \| _ {1}. \tag {62} +$$ + +By the definition of $\widehat{V}_{h,\widehat{u},\widehat{P}}^{(\pi ,\nu),(i)}$ $\mu_h^{\widehat{u}}$ and $\mu_h^{\widehat{P}}$ , it yields that + +$$ +\begin{array}{l} \mathbb {E} _ {d _ {h}} \Delta_ {h} (s _ {h}) = \mathbb {E} _ {d _ {h}} \sum_ {i = 1} ^ {N} \big [ (P _ {h} V _ {h + 1} ^ {(\pi^ {\dagger} (\widehat {\nu}), \nu^ {\star} (\widehat {\nu}))} - P _ {h} \widehat {V} _ {h + 1} ^ {(\pi^ {\dagger} (\widehat {\nu}), \nu^ {\star} (\widehat {\nu}))} + P _ {h} \widehat {V} _ {h + 1} ^ {(\pi^ {\dagger} (\widehat {\nu}), \nu^ {\star} (\widehat {\nu}))} - \widehat {P} _ {h} \widehat {V} _ {h + 1, (\widehat {u}, \widehat {P})} ^ {(\pi^ {\dagger} (\widehat {\nu}), \nu^ {\star} (\widehat {\nu}))}) (s _ {h}, b _ {h}) \\ \left. + \left(u _ {h} ^ {(i)} - \widehat {u} _ {h} ^ {(i)}\right) \left(s _ {h}, x _ {h} ^ {(i)}\right) \right] \tag {63} \\ \leq \mathbb {E} _ {d _ {h}} \sum_ {i = 1} ^ {N} \big [ \int_ {\mathcal {S}} (V _ {h + 1} ^ {(\pi^ {\dagger} (\widehat {\nu}), \nu^ {\star} (\widehat {\nu}))} - \widehat {V} _ {h + 1, (\widehat {u}, \widehat {P})} ^ {(\pi^ {\dagger} (\widehat {\nu}), \nu^ {\star} (\widehat {\nu}))}) P _ {h} (\mathrm {d} s _ {h + 1} | s _ {h}, b _ {h}) \big ] + H N \mu_ {h} ^ {\widehat {P}} + \mu_ {h} ^ {\widehat {u}} \\ = \mathbb {E} _ {d _ {h + 1}} \Delta_ {h + 1} (s _ {h + 1}) + H N \mu_ {h} ^ {\widehat {P}} + \mu_ {h} ^ {\widehat {u}} \\ \end{array} +$$ + +where the inequality is based on the fact that both the true and estimated value functions are bounded by $[0, H]$ . Hence, by telescoping index $h$ over $[H]$ , it holds that + +$$ +\begin{array}{l} \Delta_ {1} (s _ {1}) = \sum_ {h = 1} ^ {H} H N \mu_ {h} ^ {\widehat {P}} + \mu_ {h} ^ {\widehat {u}} \leq \sum_ {h = 1} ^ {H} \sqrt {\mathbb {E} _ {\rho_ {h}} \left(\frac {d _ {h}}{\rho_ {h}}\right) ^ {2}} \left(H N \sqrt {\epsilon_ {h} ^ {\widehat {P}}} + \sqrt {\epsilon_ {h} ^ {\widehat {u}}}\right) \\ \leq \sqrt {C _ {\rho} ^ {\star}} \big (\sum_ {h = 1} ^ {H} H N \sqrt {\epsilon_ {h} ^ {\widehat {P}}} + \sqrt {\epsilon_ {h} ^ {\widehat {u}}} \big), \\ \end{array} +$$ + +where the first inequality relies on Cauchy-Schwarz inequality and the definition of $\epsilon_h^{\widehat{P}}$ and $\epsilon_h^{\widehat{u}}$ in Lemma C.4, and the second inequality relies on the definition of $C_\rho^\star$ in (30). Plugging $\Delta_1(s_1)$ into (61), we conclude the proof of Lemma C.4. + +# G.2. Proof of Lemma C.5 + +Proof of Lemma C.5. According to the choice of $\widehat{P}$ in Algorithm 1, we first have that + +$$ +\sum_ {i = 1} ^ {N} \widehat {V} _ {1, (\widehat {P}, \widehat {u})} ^ {(\widehat {\pi}, \widehat {\nu}), (i)} (s _ {1}) - V _ {1} ^ {(\widehat {\pi}, \widehat {\nu}), (i)} (s _ {1}) \leq \sum_ {i = 1} ^ {N} \widehat {V} _ {1, (P, \widehat {u})} ^ {(\widehat {\pi}, \widehat {\nu}), (i)} (s _ {1}) - \sum_ {i = 1} ^ {N} V _ {1} ^ {(\widehat {\pi}, \widehat {\nu}), (i)} (s _ {1}), \tag {64} +$$ + +since $\widehat{P} = \{\widehat{P}_h\}_{h\in [H]}$ is the global pessimistic estimator in $\mathcal{P}_{h,\xi_2}$ and $P_{h}\in \mathcal{P}_{h,\xi_{2}}$ . Next, we show by induction that the right-hand side of (64) is non-positive. For step $h = H$ , we have that + +$$ +\sum_ {i = 1} ^ {N} \widehat {V} _ {H, (P, \widehat {u})} ^ {(\widehat {\pi}, \widehat {\nu}), (i)} (s _ {H}) - \sum_ {i = 1} ^ {N} V _ {H} ^ {(\widehat {\pi}, \widehat {\nu}), (i)} (s _ {H}) = \sum_ {i = 1} ^ {N} \widehat {u} _ {H} ^ {(i)} (s _ {H}, \widehat {\nu} _ {H} ^ {(i)} (s _ {H})) - \sum_ {i = 1} ^ {N} u _ {H} ^ {(i)} (s _ {H}, \widehat {\nu} _ {H} ^ {(i)} (s _ {H})) \leq 0, \forall s _ {H} \in \mathcal {S}, +$$ + +since $u_{H}^{(i)} \in \mathcal{U}_{H,\xi_1}^{(i)}$ and $\widehat{u}_H^{(i)}$ is pessimistic estimator for each $i \in [N]$ . Now suppose that inequality + +$$ +\sum_ {i = 1} ^ {N} \widehat {V} _ {h + 1, (P, \widehat {u})} ^ {(\widehat {\pi}, \widehat {\nu}), (i)} (s _ {h + 1}) - \sum_ {i = 1} ^ {N} V _ {h + 1} ^ {(\widehat {\pi}, \widehat {\nu}), (i)} (s _ {h + 1}) \leq 0, \forall s _ {h + 1} \in \mathcal {S}, +$$ + +holds for step $h + 1$ . Then for step $h$ , we have that + +$$ +\begin{array}{l} \sum_ {i = 1} ^ {N} \widehat {V} _ {h, (P, \widehat {u})} ^ {(\widehat {\pi}, \widehat {\nu}), (i)} (s _ {h}) - \sum_ {i = 1} ^ {N} V _ {h} ^ {(\widehat {\pi}, \widehat {\nu}), (i)} (s _ {h}) = \underbrace {\sum_ {i = 1} ^ {N} \widehat {u} _ {h} ^ {(i)} (s _ {h} , \widehat {\nu} _ {h} ^ {(i)} (s _ {h})) - \sum_ {i = 1} ^ {N} u _ {h} ^ {(i)} (s _ {h} , \widehat {\nu} _ {h} ^ {(i)} (s _ {h}))} _ {\mathrm {(i)}} \\ + \underbrace {\int_ {\mathcal {S}} \left(\sum_ {i = 1} ^ {N} \widehat {V} _ {h + 1 , (P , \widehat {u})} ^ {(\widehat {\pi} , \widehat {\nu}) , (i)} (s ^ {\prime}) - \sum_ {i = 1} ^ {N} V _ {h + 1} ^ {(\widehat {\pi} , \widehat {\nu}) , (i)} (s ^ {\prime})\right) P _ {h} (\mathrm {d} s ^ {\prime} | s _ {h} , \widehat {\pi} _ {h} (s _ {h}))} _ {\mathrm {(i i)}}, \forall s _ {h} \in \mathcal {S}, \\ \end{array} +$$ + +where $(\mathrm{i})\leq 0$ relies on the fact that $u_{h}^{(i)}\in \mathcal{U}_{h,\xi_1}^{(i)}$ and $\widehat{u}_h^{(i)}$ is pessimistic estimator for each $i\in [N]$ . By induction, we prove that $(\mathrm{ii})\leq 0$ . Thus we conclude that the right-hand side of (64) is non-positive. + +# G.3. Missing Proofs of Theorem C.6 + +Before we start the proof of Theorem C.6, we introduce the following lemma, which plays the key role in sharpening the convergence rate in the analysis for both estimated kernels and utility functions. + +Lemma G.1 (Uniform Bernstein Inequality with Covering Number). For any given functional class $\mathcal{F} \subset \{f : \mathcal{X} \mapsto \mathbb{R}\}$ , where $\mathcal{X}$ is a probability space. If we assume that the $\epsilon$ -covering number of $\mathcal{F}$ under infinity-norm is finite, that is, $M := \mathcal{N}(\epsilon, \mathcal{F}, \| \cdot \|_{\infty}) < \infty$ and we also assume that there exists an absolute constant such that $|f(X)| \leq R$ a.s., then the following inequality holds for all $f \in \mathcal{F}$ with probability at least $1 - \delta$ , + +$$ +\left| \frac {1}{n} \sum_ {i = 1} ^ {n} f (X _ {i}) - \mathbb {E} [ f (X) ] \right| \leq 2 \epsilon + \sqrt {\frac {2 \mathbb {V} [ f (X) ] \log (M / \delta)}{n}} + 4 \sqrt {\frac {R \epsilon \log (M / \delta)}{n}} + \frac {2 R \log (M / \delta)}{3 n}, +$$ + +where $X, X_1, \ldots, X_n$ are all i.i.d. samples on the probability space $\mathcal{X}$ . + +Proof of Lemma G.1. To obtain this lemma, we adapted Bernstein inequality with the technique dealing with covering number. See Appendix H.1 for detailed proof. + +Proof of Theorem C.6. We prove the theorem by the following lemmas, which are adapted from Xie et al. (2021) are based on Lemma G.1. For notational simplicity, we define $\| f\|_{2,\rho}$ as $\sqrt{\mathbb{E}_{\rho}[|f|^2]}$ . + +Lemma G.2. For any $(i,h)\in [N]\times [H]$ , it holds with probability at least $1 - \delta /NH$ that any $\widehat{u}\in \mathcal{U}_{h,\xi_1}^{(i)}$ satisfies + +$$ +\left| \left\| u (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right\| _ {2, \rho_ {h}} - \left\| u (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right\| _ {2, \mathcal {D} _ {h}} \right| \leq \sqrt {\frac {8 2 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) N H / \delta)}{K}}. +$$ + +Proof of Lemma G.2. See Appendix H.2 for a detailed proof. + +Lemma G.3. For any $(i,h)\in [N]\times [H]$ , it holds with probability at least $1 - \delta /NH$ that any $\widehat{u},\widetilde{u}\in \mathcal{U}_{h,\xi_1}^{(i)}$ satisfy + +$$ +\begin{array}{l} \left| \left\| \widehat {u} (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right\| _ {2, \rho_ {h}} ^ {2} - \left\| \widetilde {u} (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right\| _ {2, \rho_ {h}} ^ {2} \right. \\ - \left\| \widehat {u} (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right\| _ {2, \mathcal {D} _ {h}} ^ {2} + \left\| \widetilde {u} (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right\| _ {2, \mathcal {D} _ {h}} ^ {2} \\ \leq \left\| \widehat {u} (s, x ^ {(i)}) - \widetilde {u} (s, x ^ {(i)}) \right\| _ {2, \rho_ {h}} \cdot \sqrt {\frac {6 4 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) N H / \delta)}{K}} + \frac {2 6 2 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) N H / \delta)}{3 K}. \\ \end{array} +$$ + +Proof of Lemma G.3. See Appendix H.3 for a detailed proof. + +Lemma G.4 (Concentration). By setting + +$$ +\xi_ {1} = \frac {\log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) \cdot N H / \delta)}{K}, +$$ + +it holds with probability at least $1 - \delta / 4$ that for any $(i, h) \in [N] \times [H]$ , $u_h^{(i)} \in \mathcal{U}_{h,\xi_1}^{(i)}$ . + +Proof of Lemma G.4. This is a trivial conclusion since we note that $u_h^{(i)}(s_h^\tau, x_h^{\tau,(i)}) = u_h^{\tau,(i)}$ . + +Lemma G.5 (Accuracy). It holds with probability at least $1 - \delta / 4$ that, for any $(i, h) \in [N] \times [H]$ and $u \in \mathcal{U}_{h,\xi_1}^{(i)}$ , + +$$ +\left\| u (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right\| _ {2, \rho_ {h}} ^ {2} \leq \frac {2 2 5 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) \cdot N H / \delta)}{K}. +$$ + +Proof of Lemma G.5. By Lemma G.3 with $\widehat{u} = u$ and $\widetilde{u} = u_h^{(i)}$ , it holds that with probability at least $1 - \delta / 4NH$ , for any $u \in \mathcal{U}$ + +$$ +\begin{array}{l} \left\| u (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right\| _ {2, \rho_ {h}} ^ {2} \\ \leq \frac {1}{K} \sum_ {\tau = 1} ^ {K} \left(u (s _ {h} ^ {\tau}, x _ {h} ^ {\tau , (i)}) - u _ {h} ^ {(i)} (s _ {h} ^ {\tau}, x _ {h} ^ {\tau , (i)})\right) ^ {2} + \frac {2 6 2 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) 4 N H / \delta)}{3 K} \\ + \left\| \widehat {u} (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right\| _ {2, \rho_ {h}} \cdot \sqrt {\frac {6 4 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) 4 N H / \delta)}{K}}. \\ \end{array} +$$ + +Now for any $(i,h)\in [N]\times [H]$ , we restrict $u\in \mathcal{U}_{h,\xi_1}^{(i)}$ to obtain that + +$$ +\begin{array}{l} \left| \left| u (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right| \right| _ {2, \rho_ {h}} ^ {2} \\ \leq \xi_ {1} + \left\| \widehat {u} (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right\| _ {2, \rho_ {h}} \cdot \sqrt {\frac {6 4 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) 4 N H / \delta)}{K}} \\ + \frac {2 6 2 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) 4 N H / \delta)}{3 K} \tag {65} \\ \leq \left\| \widehat {u} (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right\| _ {2, \rho_ {h}} \cdot \sqrt {\frac {6 4 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) 4 N H / \delta)}{K}} \\ + \frac {9 0 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) 4 N H / \delta)}{K}. \\ \end{array} +$$ + +Solving the quadratic inequality in (65), we have that + +$$ +\left\| u (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right\| _ {2, \rho_ {h}} \leq \sqrt {\frac {2 2 5 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) 4 N H / \delta)}{K}}. +$$ + +Finally, applying a union bound argument over $(i,h)\in [N]\times [H]$ , we finish the proof of Lemma G.5. + +This proves that with probability at least $1 - \delta /4$ , we have $\epsilon_h^{\widehat{u}}\leq 225\log (\mathcal{N}(1 / K,\mathcal{U},\| \cdot \|_{\infty})\cdot 4NH / \delta) / K$ . Combining this result with Lemma G.4, we finishes the proof of Theorem C.6. + +# G.4. Missing Proofs of Theorem C.7 + +Proof of Theorem C.7. As the first part of Theorem C.7, we introduce the following key lemma to show that the event + +$$ +E _ {1} := \left\{\mathbb {E} _ {\mathcal {D} _ {h}} \| \widehat {P} _ {h} ^ {\mathrm {M L E}} (\cdot | s, b) - P _ {h} (\cdot | s, b) \| _ {1} ^ {2} \leq C ^ {\prime} \log (\mathcal {N} _ {\mathbb {I}} (1 / K, \mathcal {P}, \| \cdot \| _ {1, \infty}) H / \delta) / K, \text {f o r a l l} h \in [ H ] \right\} +$$ + +happens with probability at least $1 - \delta /4$ , where $C^\prime$ is an absolute constant. + +Lemma G.6. According to Algorithm 2, then event $E_{1}$ happens with probability at least $1 - \delta / 4$ . + +Proof of Lemma G.6. For the simplicity of notation, we denote by $g_{h}(\widehat{P})(s,b) \coloneqq \| \widehat{P} (\cdot |s,b) - P_{h}(\cdot |s,b)\|_{1}^{2}$ . By the following lemma, we show that MLE estimation in Algorithm 2) can converge at a negative square root rate. + +Lemma G.7 (MLE Estimation Guarantee). According to Algorithm 2, then event + +$$ +E _ {2} := \left\{\mathbb {E} _ {\rho_ {h}} g _ {h} (\widehat {P} _ {h} ^ {\mathrm {M L E}}) \leq c ^ {\prime} \log (\mathcal {N} _ {\mathbb {I}} (1 / K, \mathcal {P}, \| \cdot \| _ {1, \infty}) H / \delta) / K, f o r a l l h \in [ H ] \right\} +$$ + +happens with probability at least $1 - \delta /8$ , where $c^{\prime}$ is an absolute constant. + +Proof of Lemma G.7. See Appendix H.3 for detailed proof. + +Notice that the gap between Lemma G.6 and Lemma G.7 can be bridged by concentration analysis which relies on the adapted Bernstein inequality in Lemma G.1. We introduce the following lemma. + +Lemma G.8 (Bernstein Inequality with Union Bound I). According to Algorithm 2, if we define the event + +$$ +E _ {3} := \left\{\left| \left[ \mathbb {E} _ {\mathcal {D} _ {h}} - \mathbb {E} _ {\rho_ {h}} \right] g _ {h} \left(\widehat {P} _ {h} ^ {\mathrm {M L E}}\right) \right| \leq c ^ {\prime \prime} \log \left(\mathcal {N} _ {[ ]} (1 / K, \mathcal {P}, \| \cdot \| _ {1, \infty}) H / \delta\right) / K, f o r a l l h \in [ H ] \right\}, +$$ + +then $E_2 \cap E_3$ happens with probability at least $1 - \delta / 8$ , where $c''$ is an absolute constant. + +Proof of Lemma G.8. See Appendix H.3 for detailed proof. + +Since it holds that + +$$ +\mathbb {E} _ {\rho_ {h}} g _ {h} (\widehat {P} _ {h} ^ {\mathrm {M L E}}) \leq \mathbb {E} _ {\mathcal {D} _ {h}} g _ {h} (\widehat {P} _ {h} ^ {\mathrm {M L E}}) + [ \mathbb {E} _ {\mathcal {D} _ {h}} - \mathbb {E} _ {\rho_ {h}} ] g _ {h} (\widehat {P} _ {h} ^ {\mathrm {M L E}}), +$$ + +Lemma G.6 is the direct consequence of Lemma G.7 and Lemma G.8. + +With Lemma G.6, the last part of the proof of Theorem C.7 is to upper bound $\sup_{\in [H]}\epsilon_h^{\widehat{P}}$ . Recall that we denote by $g_{h}(\widehat{P})(s,b)\coloneqq \| \widehat{P} (\cdot |s,b) - P_{h}(\cdot |s,b)\|_{1}^{2}$ . On the event $E_{1}$ , we decompose $\epsilon_h^{\widehat{P}}$ as follows. + +$$ +\begin{array}{l} \epsilon_ {h} ^ {\widehat {P}} = \mathbb {E} _ {\mathcal {D} _ {h}} g _ {h} \left(\widehat {P} _ {h} ^ {\mathrm {M L E}}\right) + \left[ \mathbb {E} _ {\rho_ {h}} - \mathbb {E} _ {\mathcal {D} _ {h}} \right] g _ {h} \left(\widehat {P} _ {h}\right) + \mathbb {E} _ {\mathcal {D} _ {h}} \left(g _ {h} (\widehat {P}) - g _ {h} \left(\widehat {P} _ {h} ^ {\mathrm {M L E}}\right)\right) \\ \leq 2 \mathbb {E} _ {\mathcal {D} _ {h}} g _ {h} \left(\widehat {P} _ {h} ^ {\mathrm {M L E}}\right) + \left[ \mathbb {E} _ {\rho_ {h}} - \mathbb {E} _ {\mathcal {D} _ {h}} \right] g _ {h} \left(\widehat {P} _ {h}\right) + 2 \mathbb {E} _ {\mathcal {D} _ {h}} \| \widehat {P} _ {h} (\cdot | s, b) - \widehat {P} _ {h} ^ {\mathrm {M L E}} (\cdot |, s, b) \| _ {1} ^ {2} \tag {66} \\ \leq 2 \mathbb {E} _ {\mathcal {D} _ {h}} g _ {h} \left(\widehat {P} _ {h} ^ {\mathrm {M L E}}\right) + \left[ \mathbb {E} _ {\rho_ {h}} - \mathbb {E} _ {\mathcal {D} _ {h}} \right] g _ {h} \left(\widehat {P} _ {h}\right) + 2 \xi_ {2} \\ \leq 4 \xi_ {2} + \left[ \mathbb {E} _ {\rho_ {h}} - \mathbb {E} _ {\mathcal {D} _ {h}} \right] g _ {h} \left(\widehat {P} _ {h}\right), \\ \end{array} +$$ + +where the first inequality relies on the fact that $(a + b)^2 \leq 2(a^2 + b^2)$ and the last inequality relies on the definition of $E_1$ . Hence it suffices to upper bound the second term in (66). Motivated by Uehara & Sun (2021) and the proof of Lemma G.2, we prove the following lemma based on the adapted Bernstein inequality in Lemma G.1. + +Lemma G.9 (Bernstein Inequality with Union Bound II). According to Algorithm 2 and selecting + +$\xi_{2} = C^{\prime}\log (\mathcal{N}_{\mathbb{I}}(1 / K,\mathcal{P},\| \cdot \|_{1,\infty}) / \delta) / K$ , if we define the event + +$$ +E _ {4} := \left\{\left| [ \mathbb {E} _ {\mathcal {D} _ {h}} - \mathbb {E} _ {\rho_ {h}} ] g _ {h} (\widehat {P} _ {h}) \right| \leq C ^ {\prime \prime} \log (\mathcal {N} _ {[ 1} (1 / K, \mathcal {P}, \| \cdot \| _ {1, \infty}) H / \delta) / K, f o r a l l h \in [ H ] \right\}, +$$ + +then $E_1 \cap E_4$ happens with probability at least $1 - \delta / 8$ , where $C''$ is an absolute constant. + +Proof. See Appendix H.3 for detailed proof. + +Apply Lemma H.3 and Lemma G.6. Based on $E_1 \cap E_2 \cap E_3$ and the selection of $\xi_2$ , then + +$$ +\sup _ {h \in [ H ]} \epsilon_ {h} ^ {\widehat {P}} \leq (c ^ {\prime} + c ^ {\prime \prime} + C ^ {\prime \prime}) \log (\mathcal {N} _ {[ ]} (1 / K, \mathcal {P}, \| \cdot \| _ {1, \infty}) H / \delta) / K, +$$ + +which concludes the proof for Theorem C.7. + +# G.5. Proof for Theorem 4.4: Offline Fair Division Loss + +Proof. Similar to the proof for Theorem 3.4, the following two inequalities originate from the definition of $\nu_h^\star$ in (4). + +$$ +\begin{array}{l} \ell_ {h} ^ {\mathrm {P E}} (\widehat {\nu}, s _ {h}) = \inf _ {x \in \mathcal {P E} (s _ {h}, h)} \sum_ {i = 1} ^ {N} \left(u _ {h} ^ {(i)} (s _ {h}, x ^ {(i)}) - u _ {h} ^ {(i)} (s _ {h}, \widehat {\nu} _ {h} ^ {(i)} (s _ {h}))\right) \\ \leq \sum_ {i = 1} ^ {N} \left(u _ {h} ^ {(i)} (s _ {h}, \nu_ {h} ^ {\star , (i)} (\widehat {\nu}) (s _ {h})) - u _ {h} ^ {(i)} (s _ {h}, \widehat {\nu} _ {h} ^ {(i)} (s _ {h}))\right). \\ \end{array} +$$ + +Also, observe that + +$$ +\begin{array}{l} \ell_ {h} ^ {\mathrm {S I}} (\widehat {\nu}, s _ {h}) = \sum_ {i = 1} ^ {N} \left(u _ {h} ^ {(i)} \left(s _ {h}, e ^ {(i)}\right) - u _ {h} ^ {(i)} \left(s _ {h}, \widehat {\nu} _ {h} ^ {(i)} \left(s _ {h}\right)\right)\right) \\ \leq \sum_ {i = 1} ^ {N} \left(u _ {h} ^ {(i)} (s _ {h}, \nu_ {h} ^ {\star , (i)} (\widehat {\nu}) (s _ {h})) - u _ {h} ^ {(i)} (s _ {h}, \widehat {\nu} _ {h} ^ {(i)} (s _ {h}))\right), \\ \end{array} +$$ + +By the definition of offline FD loss defined in (24), it holds that + +$$ +\begin{array}{l} \mathcal {L} _ {\mathrm {F D}} \leq \sum_ {i = 1} ^ {N} \sum_ {h = 1} ^ {H} \mathbb {E} _ {\rho_ {h}} \left(u _ {h} ^ {(i)} (s _ {h}, \nu_ {h} ^ {\star , (i)} (\widehat {\nu}) (s _ {h})) - \widehat {u} _ {h} ^ {(i)} (s _ {h}, \nu_ {h} ^ {\star , (i)} (\widehat {\nu}) (s _ {h}))\right) \\ + \left(\widehat {u} _ {h} ^ {(i)} (s _ {h}, \nu_ {h} ^ {\star , (i)} (\widehat {\nu}) (s _ {h})) - \widehat {u} _ {h} ^ {(i)} (s _ {h}, \widehat {\nu} _ {h} ^ {(i)} (s _ {h}))\right) \\ \left. + \left(\widehat {u} _ {h} ^ {(i)} \left(s _ {h}, \widehat {\nu} _ {h} ^ {(i)} \left(s _ {h}\right)\right) - u _ {h} ^ {(i)} \left(s _ {h}, \widehat {\nu} _ {h} ^ {(i)} \left(s _ {h}\right)\right)\right)\right) \\ \end{array} +$$ + +By the definition of $\widehat{\nu}$ and the event $E_0$ defined in and (C.6) defined in Theorem C.6, it further holds with at probability at least $1 - \delta$ that + +$$ +\begin{array}{l} \mathcal {L} _ {\mathrm {F D}} \leq \sum_ {i = 1} ^ {N} \sum_ {h = 1} ^ {H} \mathbb {E} _ {\rho_ {h}} | \widehat {u} _ {h} ^ {(i)} (s _ {h}, \widehat {\nu} _ {h} ^ {(i)} (s _ {h})) - u _ {h} ^ {(i)} (s _ {h}, \widehat {\nu} ^ {(i)} (s _ {h})) | \\ \leq \sum_ {i = 1} ^ {N} \sum_ {h = 1} ^ {H} \mathbb {E} _ {\rho_ {h}} \sqrt {| \widehat {u} _ {h} ^ {(i)} (s _ {h} , \widehat {\nu} _ {h} ^ {(i)} (s _ {h})) - u _ {h} ^ {(i)} (s _ {h} , \widehat {\nu} ^ {(i)} (s _ {h})) | ^ {2}} \\ \leq \mathcal {O} (H N \sqrt {\log (\mathcal {N} (1 / K ^ {2} , \mathcal {U} , \| \cdot \| _ {\infty}) \cdot N H / \delta) / K}), \\ \end{array} +$$ + +where the second inequality relies on the Cauchy-Schwarz inequality and the last inequality originates from Theorem C.6. Hence we conclude the proof for Theorem 4.4. + +# H. Missing Proofs of Auxiliary Lemmas + +# H.1. Proofs for Lemma G.1 + +Proof of Lemma G.1. Denote one of the $\epsilon$ -covering of $\mathcal{F}$ as $\mathcal{F}_{\epsilon} = \{f_i\}_{i\in [M]}\subset \mathcal{F}$ , where $M = \mathcal{N}(\epsilon ,\mathcal{F},\| \cdot \|_{\infty})$ . Then applying Bernstein inequality with union bound on the $\mathcal{F}_{\epsilon}$ , it holds with probability at least $1 - \delta$ + +$$ +\left| \frac {1}{n} \sum_ {i = 1} ^ {n} g \left(X _ {i}\right) - \mathbb {E} [ g (X) ] \right| \leq \sqrt {\frac {2 \mathbb {V} [ g (X) ] \log (M / \delta)}{n}} + \frac {2 R \log (M / \delta)}{3 n}, \tag {67} +$$ + +for all $g \in \mathcal{F}_{\epsilon}$ . By the definition of covering number, for any $f \in \mathcal{F}$ , there exists $g \in \mathcal{F}_{\epsilon}$ such that $\| f - g \|_{\infty} \leq \epsilon$ . It then yields that + +$$ +\begin{array}{l} \left| \frac {1}{n} \sum_ {i = 1} ^ {n} f \left(X _ {i}\right) - \mathbb {E} [ f (X) ] \right| \leq \left| \frac {1}{n} \sum_ {i = 1} ^ {n} \left(f \left(X _ {i}\right) - g \left(X _ {i}\right)\right) \right| + \left| \frac {1}{n} \sum_ {i = 1} ^ {n} g \left(X _ {i}\right) - \mathbb {E} [ g (X) ] \right| + | \mathbb {E} [ g (X) ] - \mathbb {E} [ f (X) ] | \tag {68} \\ \leq 2 \epsilon + \sqrt {\frac {2 \mathbb {V} [ g (X) ] \log (M / \delta)}{n}} + \frac {2 R \log (M / \delta)}{3 n}. \\ \end{array} +$$ + +Notice that + +$$ +\begin{array}{l} \left| \sqrt {\frac {2 \mathbb {V} [ f (X) ] \log (M / \delta)}{n}} - \sqrt {\frac {2 \mathbb {V} [ g (X) ] \log (M / \delta)}{n}} \right| \leq \sqrt {\left| \frac {2 \mathbb {V} [ f (X) ] \log (M / \delta)}{n} - \frac {2 \mathbb {V} [ g (X) ] \log (M / \delta)}{n} \right|} \tag {69} \\ = \sqrt {\frac {2 \log (M / \delta)}{n}} \cdot \sqrt {| \mathbb {V} [ f (X) ] - \mathbb {V} [ g (X) ] |}, \\ \end{array} +$$ + +where the first inequality is based on the basic inequality $|\sqrt{x} - \sqrt{y}| \leq \sqrt{|x - y|}$ for two absolute variables $x, y$ . What remains is to upper bound the difference of variance in (69). + +$$ +\begin{array}{l} \left. \left| \mathbb {V} [ f (X) ] - \mathbb {V} [ g (X) ] \right| = \left| \left(\mathbb {E} [ (f (X)) ^ {2} ] - (\mathbb {E} [ f (X) ]) ^ {2}\right) - \left(\mathbb {E} [ (g (X)) ^ {2} ] - (\mathbb {E} [ g (X) ]) ^ {2}\right) \right| \right. \\ = \left| \mathbb {E} \left[ (f (X) - \mathbb {E} [ g (X) ]) ^ {2} - (g (X) - \mathbb {E} [ f (X) ]) ^ {2} \right] \right| \tag {70} \\ \leq \mathbb {E} [ | f (X) - \mathbb {E} [ g (X) ] - g (X) + \mathbb {E} [ f (X) ] | \cdot | f (X) - \mathbb {E} [ g (X) ] + g (X) - \mathbb {E} [ f (X) ] | ] \\ \leq 2 \epsilon \cdot 4 R = 8 R \epsilon . \\ \end{array} +$$ + +Plugging (69) and (69) into (68), it holds that for all $f \in \mathcal{F}$ with probability at least $1 - \delta$ , + +$$ +\begin{array}{l} \left| \frac {1}{n} \sum_ {i = 1} ^ {n} f (X _ {i}) - \mathbb {E} [ f (X) ] \right| \leq 2 \epsilon + \sqrt {\frac {2 \mathbb {V} [ f (X) ] \log (M / \delta)}{n}} + \sqrt {\frac {2 \log (M / \delta)}{n}} \cdot \sqrt {8 R \epsilon} + \frac {2 R \log (M / \delta)}{3 n} \\ = 2 \epsilon + \sqrt {\frac {2 \mathbb {V} [ f (X) ] \log (M / \delta)}{n}} + 4 \sqrt {\frac {R \epsilon \log (M / \delta)}{n}} + \frac {2 R \log (M / \delta)}{3 n}, \\ \end{array} +$$ + +which concludes the proof of Lemma G.1. + +# H.2. Proofs for Lemma G.2 + +Proof of Lemma G.2. The proof is adapted from Lemma A.3 in Xie et al. (2021). We first apply Lemma G.1 with $\epsilon = 1 / K$ over function class $\mathcal{U}_h^{(i)} = \{(u - u_h^{(i)})^2 : u \in \mathcal{U}\}$ to obtain that + +$$ +\begin{array}{l} \left| \left\| u (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right\| _ {2, \rho_ {h}} ^ {2} - \left\| u (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right\| _ {2, \mathcal {D} _ {h}} ^ {2} \right| \\ = \left| \mathbb {E} _ {\rho_ {h}} | u (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) | ^ {2} - \frac {1}{K} \sum_ {\tau = 1} ^ {K} (u (s _ {h} ^ {\tau}, x _ {h} ^ {\tau , (i)}) - u _ {h} ^ {(i)} (s _ {h} ^ {\tau}, x _ {h} ^ {\tau , (i)})) ^ {2} \right| \\ \leq \sqrt {\frac {4 \mathbb {V} _ {\rho_ {h}} \left[ \left(u (s , x ^ {(i)}) - u _ {h} ^ {(i)} (s , x ^ {(i)})\right) ^ {2} \right] \log (\mathcal {N} (1 / K , \mathcal {U} _ {h} ^ {(i)} , \| \cdot \| _ {\infty}) N H / \delta)}{K}} + \frac {8 \log (\mathcal {N} (1 / K , \mathcal {U} _ {h} ^ {(i)} , \| \cdot \| _ {\infty}) N H / \delta)}{3 K} \\ + \frac {8 \log (\mathcal {N} (1 / K , \mathcal {U} _ {h} ^ {(i)} , \| \cdot \| _ {\infty}) N H / \delta)}{K} + \frac {2}{K} \\ \leq \left\| u (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right\| _ {2, \rho_ {h}} \cdot \sqrt {\frac {1 6 \log (\mathcal {N} (1 / K , \mathcal {U} _ {h} ^ {(i)} , \| \cdot \| _ {\infty}) N H / \delta)}{K}} + \frac {3 8 \log (\mathcal {N} (1 / K , \mathcal {U} _ {h} ^ {(i)} , \| \cdot \| _ {\infty}) N H / \delta)}{3 K} \\ \leq \left\| u (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right\| _ {2, \rho_ {h}} \sqrt {\frac {3 2 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) N H / \delta)}{K}} + \frac {7 6 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) N H / \delta)}{3 K}, \tag {71} \\ \end{array} +$$ + +where in the first and second inequality we use the fact that $u \leq 1$ for all $u \in \mathcal{U}$ and in the last inequality we use the fact that $\mathcal{N}(1 / K, \mathcal{U}_h^{(i)}, \| \cdot \|_{\infty}) \leq [\mathcal{N}(1 / K, \mathcal{U}, \| \cdot \|_{\infty})]^2$ . Here we mark $\mathcal{U}_h^{(i)}$ and $\mathcal{U}$ in red to highlight their difference. Now on the one hand, by basic inequality $|a - b|^2 \leq |a^2 - b^2|$ , we know from inequality (71) that + +$$ +\begin{array}{l} \left| \left\| u (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right\| _ {2, \rho_ {h}} - \left\| u (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right\| _ {2, \mathcal {D} _ {h}} \right| \\ \leq \sqrt {\left\| u (c , x ^ {(i)}) - u _ {h} ^ {(i)} (c , x ^ {(i)}) \right\| _ {2 , \rho_ {h}}} \cdot \sqrt [ 4 ]{\frac {3 2 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) N H / \delta)}{K}} + \sqrt {\frac {7 6 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) N H / \delta)}{3 K}}. \tag {72} \\ \end{array} +$$ + +On the other hand, by another basic inequality $|a - b| \leq |a - b^2 / a|$ , we know from inequality (71) that + +$$ +\begin{array}{l} \left| \left\| u (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right\| _ {2, \rho_ {h}} - \left\| u (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right\| _ {2, \mathcal {D} _ {h}} \right| \\ \leq \sqrt {\frac {3 2 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) N H / \delta)}{K}} + \frac {7 6 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) N H / \delta)}{3 K \cdot \left\| u (c , x ^ {(i)}) - u _ {h} ^ {(i)} (c , x ^ {(i)}) \right\| _ {2 , \rho_ {h}}}. \tag {73} \\ \end{array} +$$ + +Thus combining (72) and (73) we obtain that + +$$ +\left| \left\| u (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right\| _ {2, \rho_ {h}} - \left\| u (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right\| _ {2, \mathcal {D} _ {h}} \right| +$$ + +$$ +\begin{array}{l} \leq \min \left\{\sqrt {\left\| u (s , x ^ {(i)}) - u _ {h} ^ {(i)} (s , x ^ {(i)}) \right\| _ {2 , \rho_ {h}}} \cdot \sqrt [ 4 ]{\frac {3 2 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) N H / \delta)}{K}} + \sqrt {\frac {7 6 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) N H / \delta)}{3 K}}, \right. \\ \left. \sqrt {\frac {3 2 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) N H / \delta)}{K}} + \frac {7 6 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) N H / \delta)}{3 K \cdot \left\| u (s , x ^ {(i)}) - u _ {h} ^ {(i)} (s , x ^ {(i)}) \right\| _ {2 , \rho_ {h}}} \right\}. \tag {74} \\ \end{array} +$$ + +Denote $\eta = \| u(s,x^{(i)}) - u_h^{(i)}(s,x^{(i)})\|_{2,\rho_h}$ and optimize over $\eta >0$ in (74), we obtain that + +$$ +\begin{array}{l} \left| \left\| u (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right\| _ {2, \rho_ {h}} - \left\| u (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right\| _ {2, \mathcal {D} _ {h}} \right| \\ \leq \max _ {\eta > 0} \min \left\{\sqrt {\eta} \cdot \sqrt [ 4 ]{\frac {3 2 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) N H / \delta)}{K}} + \sqrt {\frac {7 6 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) N H / \delta)}{3 K}}, \right. \\ \left. \sqrt {\frac {3 2 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) N H / \delta)}{K}} + \frac {7 6 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) N H / \delta)}{3 K \cdot \eta} \right\} \\ \leq \min _ {\eta > 0} \max \left\{\sqrt {\eta} \cdot \sqrt [ 4 ]{\frac {3 2 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) N H / \delta)}{K}} + \sqrt {\frac {7 6 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) N H / \delta)}{3 K}}, \right. \\ \left. \sqrt {\frac {3 2 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) N H / \delta)}{K}} + \frac {7 6 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) N H / \delta)}{3 K \cdot \eta} \right\} \\ \leq \sqrt {\frac {8 2 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) N H / \delta)}{K}}, \\ \end{array} +$$ + +where we choose $\eta = \sqrt{\log(\mathcal{N}(1 / K,\mathcal{U},\| \cdot \|_{\infty})NH / \delta) / K}$ . Here we mark $\max_{\eta >0}\min$ and $\leq \min_{\eta >0}\max$ in red to highlight their difference. This finishes the proof of Lemma G.2. + +# H.3. Proofs for Lemma G.3 + +Proof of Lemma G.3. The proof is adapted from Lemma A.4 in Xie et al. (2021). We first note that we can rewrite + +$$ +\begin{array}{l} \left\| \widehat {u} (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right\| _ {2, \mathcal {D} _ {h}} ^ {2} - \left\| \widetilde {u} (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right\| _ {2, \mathcal {D} _ {h}} ^ {2} \\ = \frac {1}{K} \sum_ {\tau = 1} ^ {K} \left(\widehat {u} \left(s _ {h} ^ {\tau}, x _ {h} ^ {\tau , (i)}\right) - \widetilde {u} \left(s _ {h} ^ {\tau}, x _ {h} ^ {\tau , (i)}\right)\right) \left(\widehat {u} \left(s _ {h} ^ {\tau}, x _ {h} ^ {\tau , (i)}\right) + \widetilde {u} \left(s _ {h} ^ {\tau}, x _ {h} ^ {\tau , (i)}\right) - 2 u _ {h} ^ {(i)} \left(s _ {h} ^ {\tau}, x _ {h} ^ {\tau , (i)}\right)\right). \tag {75} \\ \end{array} +$$ + +By (75), we apply Lemma G.1 with $\epsilon = 1 / K$ and function class $\mathcal{U}_h^{\dagger,(i)} = \{(\widehat{u} - \widetilde{u})(\widehat{u} + \widetilde{u} - 2u_h^{(i)}): \widehat{u}, \widetilde{u} \in \mathcal{U}\}$ to obtain that + +$$ +\begin{array}{l} \left| \left\| \widehat {u} (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right\| _ {2, \rho_ {h}} ^ {2} - \left\| \widetilde {u} (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right\| _ {2, \rho_ {h}} ^ {2} \right. \\ - \left\| \widehat {u} (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right\| _ {2, \mathcal {D} _ {h}} ^ {2} + \left\| \widetilde {u} (s, x ^ {(i)}) - u _ {h} ^ {(i)} (s, x ^ {(i)}) \right\| _ {2, \mathcal {D} _ {h}} ^ {2} \\ \leq \sqrt {\frac {4 \mathbb {V} _ {\rho_ {h}} \left[ \left(\widehat {u} (s , x ^ {(i)}) - \widetilde {u} (s , x ^ {(i)})\right) \left(\widehat {u} (s , x ^ {(i)}) + \widetilde {u} (s , x ^ {(i)}) - 2 u _ {h} ^ {(i)} (s , x ^ {(i)})\right) \right] \log (\mathcal {N} (1 / K , \mathcal {U} _ {h} ^ {\dagger , (i)} , \| \cdot \| _ {\infty}) N H / \delta)}{K}} \\ + \frac {1 6 \log (\mathcal {N} (1 / K , \mathcal {U} _ {h} ^ {\dagger , (i)} , \| \cdot \| _ {\infty}) N H / \delta)}{3 K} + \frac {1 6 \log (\mathcal {N} (1 / K , \mathcal {U} _ {h} ^ {\dagger , (i)} , \| \cdot \| _ {\infty}) N H / \delta)}{K} + \frac {2}{K}, \\ \leq \sqrt {\frac {1 6 \mathbb {V} _ {\rho_ {h}} \left[ \left(\widehat {u} (s , x ^ {(i)}) - \widetilde {u} (s , x ^ {(i)})\right) \left(\widehat {u} (s , x ^ {(i)}) + \widetilde {u} (s , x ^ {(i)}) - 2 u _ {h} ^ {(i)} (s , x ^ {(i)})\right) \right] \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) N H / \delta)}{K}} \\ + \frac {6 4 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) N H / \delta)}{3 K} + \frac {6 4 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) N H / \delta)}{K} + \frac {2}{K}, \\ \leq \left\| \widehat {u} (s, x ^ {(i)}) - \widetilde {u} (s, x ^ {(i)}) \right\| _ {2, \rho_ {h}} \cdot \sqrt {\frac {6 4 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) N H / \delta)}{K}} + \frac {2 6 2 \log (\mathcal {N} (1 / K , \mathcal {U} , \| \cdot \| _ {\infty}) N H / \delta)}{3 K}, \\ \end{array} +$$ + +where in the first and second inequality we use the fact that $u \leq 1$ for all $u \in \mathcal{U}$ and the fact that $\mathcal{N}(1 / K, \mathcal{U}_h^{\dagger, (i)}, \| \cdot \|_{\infty}) \leq [\mathcal{N}(1 / K, \mathcal{U}, \| \cdot \|_{\infty})]^4$ . Here we mark $\mathcal{U}_h^{\dagger, (i)}$ and $\mathcal{U}$ in red to highlight their difference. This finishes the proof of Lemma G.3. + +Proof of Lemma G.7. Before we proceed, we need introduce some concepts to help characterize the convergence rate of MLE estimator, which follows from Geer et al. (2000); Uehara & Sun (2021). + +We define the modified function class of $\mathcal{P}_h$ : + +$$ +\overline {{\mathcal {P}}} _ {h} = \left\{\sqrt {\frac {\widehat {P} + P _ {h}}{2}} \Big | \widehat {P} \in \mathcal {P} \right\}. +$$ + +Given a function class $\mathcal{F}$ , let $\mathcal{N}_{\bigcup}(\delta, \mathcal{F}, \| \cdot \|_{2,\rho_h})$ be the bracketing number of $\mathcal{F}$ w.r.t the norm $\| \cdot \|_{2,\rho_h}$ given by + +$$ +\| f \| _ {2, \rho_ {h}} = \mathbb {E} _ {\rho_ {h}} \left[ \int \left(f \left(s ^ {\prime} \mid s, b\right)\right) ^ {2} \mathrm {d} s ^ {\prime} \right] ^ {1 / 2}. +$$ + +Then, the entropy integral of $\mathcal{F}$ is given by + +$$ +J _ {B} (\delta , \mathcal {F}, \| \cdot \| _ {2, \rho_ {h}}) = \max \left\{\int_ {\delta^ {2} / 2} ^ {\delta} \left(\sqrt {\log \mathcal {N} _ {[ ]} (u , \mathcal {F} , \| \cdot \| _ {2 , \rho_ {h}})}\right) \mathrm {d} u, \delta \right\}. +$$ + +We also define the localized class of $\overline{\mathcal{P}}_h$ : + +$$ +\overline {{\mathcal {P}}} _ {h} (\delta) = \left\{\widehat {P} \in \overline {{\mathcal {P}}} _ {h}: \mathbb {E} _ {\rho_ {h}} \left[ h ^ {2} \left(\widehat {P} (\cdot | s, b) \| P _ {h} (\cdot | s, b)\right) \right] \leq \delta^ {2} \right\}, +$$ + +where $h\left(\widehat{P} (\cdot \mid s,b)\| P_h(\cdot \mid s,b)\right)$ denotes Hellinger distance defined by + +$$ +\sqrt {0 . 5 \int \left(\sqrt {\hat {P} (s ^ {\prime} | s , b)} - \sqrt {P _ {h} (s ^ {\prime} | s , b)}\right) ^ {2} \mathrm {d} s ^ {\prime}}. +$$ + +Then we introduce the following lemma (Theorem 4 in Uehara & Sun (2021)) to characterize the property of MLE estimator. + +Lemma H.1 (MLE guarantee with general function approximation). We take a function $G_{h}(\epsilon):[0,1]\to \mathbb{R}$ s.t. $G_{h}(\epsilon)\geq J_{B}[\epsilon ,\overline{\mathcal{P}}_{h}(\epsilon),\| \cdot \|_{2,\rho_{h}}]$ and $G_{h}(\epsilon) / \epsilon^{2}$ is a non-increasing function w.r.t $\epsilon$ . Then, letting $\zeta_h$ be a solution to $\sqrt{K}\epsilon^2\geq c_0G_h(\epsilon)$ w.r.t $\epsilon$ , where $c_{0}$ is an absolute constant. With probability at least $1 - \delta$ , we have + +$$ +\mathbb {E} _ {\rho_ {h}} \left[ \left\| \widehat {P} _ {h} ^ {\mathrm {M L E}} (\cdot | s, b) - P _ {h} (\cdot | s, b) \right\| _ {1} ^ {2} \right] \leq c _ {1} \left\{\zeta_ {h} + \sqrt {\log (c _ {2} / \delta) / K} \right\} ^ {2}. +$$ + +Proof. Please refer to Theorem 4 in Uehara & Sun (2021). + +Our next step is to show that selecting $\zeta_h = c_2\sqrt{\log\mathcal{N}_{\mathbb{I}}(1 / K,\mathcal{P},\| \cdot \|_{1,\infty}) / K}$ in Lemma H.1 suffices to prove Lemma G.7. First we show the following facts to discuss the relationship of bracketing numbers of different function classes. + +Lemma H.2. It holds that for all $\epsilon \geq 0$ , $\mathcal{N}_{\llbracket}(\epsilon, \overline{\mathcal{P}}_h(\epsilon), \| \cdot \|_{2,\rho_h}) \leq \mathcal{N}_{\llbracket}(2\epsilon^2, \mathcal{P}, \| \cdot \|_{1,\infty})$ . + +Proof. Noticing $\mathcal{N}_{\mathbb{I}}(\epsilon, \overline{\mathcal{P}}_h(\epsilon), \| \cdot \|_{2,\rho_h}) \leq \mathcal{N}_{\mathbb{I}}(\epsilon, \overline{\mathcal{P}}_h, \| \cdot \|_{2,\rho_h})$ , it suffices to prove that + +$$ +\mathcal {N} _ {[ ]} \left(\epsilon , \overline {{\mathcal {P}}} _ {h}, \| \cdot \| _ {2, \rho_ {h}}\right) \leq \mathcal {N} _ {[ ]} \left(2 \epsilon^ {2}, \mathcal {P}, \| \cdot \| _ {1, \infty}\right). +$$ + +Take the $4\epsilon^2$ -brackets of $\mathcal{P}$ as $\mathcal{B}_{\mathcal{P}} = \{(P_j^{\mathrm{U}}, P_j^{\mathrm{L}})\}_{j \in [M]}$ , where $M = \mathcal{N}_{\mathbb{I}}(4\epsilon^2, \mathcal{P}, \| \cdot \|_{1,\infty})$ . Then for any $\widetilde{P}_0 \in \overline{\mathcal{P}} = \sqrt{\frac{P_0 + P_h}{2}}$ , there exists $j \in [M]$ , s.t. $P_j^{\mathrm{L}} \leq P_0 \leq P_j^{\mathrm{U}}$ and $\| P_j^{\mathrm{L}} - P_j^{\mathrm{U}} \|_{1,\infty} \leq 4\epsilon^2$ . Hence, $\sqrt{\frac{P_j^{\mathrm{L}} + P_h}{2}} \leq \widetilde{P}_0 \leq \sqrt{\frac{P_j^{\mathrm{U}} + P_h}{2}}$ . It also holds that, + +$$ +\begin{array}{l} \left\| \sqrt {\frac {P _ {j} ^ {\mathrm {L}} + P _ {h}}{2}} - \sqrt {\frac {P _ {j} ^ {\mathrm {U}} + P _ {h}}{2}} \right\| _ {2, \rho_ {h}} = \mathbb {E} _ {\rho_ {h}} \left[ \int_ {\mathcal {S}} \left(\sqrt {\frac {P _ {j} ^ {\mathrm {L}} + P _ {h}}{2}} - \sqrt {\frac {P _ {j} ^ {\mathrm {U}} + P _ {h}}{2}}\right) ^ {2} \mathrm {d} s ^ {\prime} \right] ^ {1 / 2} \\ \leq \mathbb {E} _ {\rho_ {h}} \left[ \int_ {\mathcal {S}} \left| \frac {P _ {j} ^ {\mathrm {L}} + P _ {h}}{2} - \frac {P _ {j} ^ {\mathrm {U}} + P _ {h}}{2} \right| \mathrm {d} s ^ {\prime} \right] ^ {1 / 2} \\ \leq \sqrt {\frac {1}{2} \left\| P _ {j} ^ {\mathbf {U}} - P _ {j} ^ {\mathbf {L}} \right\| _ {1 , \infty}} \leq \epsilon , \\ \end{array} +$$ + +where the first inequality relies on the basic inequality $|\sqrt{a} - \sqrt{b}| \leq \sqrt{|a - b|}$ . + +Hence, $\left\{\left(\sqrt{\frac{P_j^{\mathrm{L}} + P_h}{2}},\sqrt{\frac{P_j^{\mathrm{U}} + P_h}{2}}\right)\right\}_{j\in [M]}$ are also the $\epsilon$ -brackets of $\overline{\mathcal{P}}_h$ , which concludes the proof of Lemma H.2. + +In Lemma H.2, we choose $G_{h}(\epsilon) = (\epsilon -\epsilon^{2} / 2)\sqrt{\log\mathcal{N}_{\mathbb{I}}(\epsilon^{4} / 2,\mathcal{P},\| \cdot \|_{1,\infty})}$ , which satisfies that (because of Lemma H.2) + +$$ +\begin{array}{l} G _ {h} (\epsilon) \geq \left(\epsilon - \epsilon^ {2} / 2\right) \sqrt {\log \mathcal {N} _ {[ ]} \left(\epsilon^ {2} / 2 , \overline {{\mathcal {P}}} _ {h} (\epsilon) , \| \cdot \| _ {2 , \rho_ {h}}\right)} \tag {76} \\ \geq J _ {B} (\epsilon , \overline {{\mathcal {P}}} _ {h} (\epsilon), \| \cdot \| _ {2, \rho_ {h}}), \\ \end{array} +$$ + +when we assume that $\log \mathcal{N}_{\llbracket}(\epsilon^2 / 2, \overline{\mathcal{P}}_h(\epsilon), d) \geq 2$ . + +It is easy to find that $G(\epsilon) / \epsilon^2$ is non-increasing function. Assuming that $K \geq \log \mathcal{N}_{\llbracket}(\epsilon^2 / 16, \mathcal{P}, \| \cdot \|_{1,\infty})$ and solving $\sqrt{K}\epsilon^2 \geq c_0G_h(\epsilon)$ , we derive the feasible solution region + +$$ +\left\{\epsilon \in [ 0, 1 ]: \epsilon \geq \frac {c _ {0}}{\sqrt {K} - c _ {0} / 2 \sqrt {\log \mathcal {N} _ {[ ]} \left(\epsilon^ {4} / 2 , \mathcal {P} , \| \cdot \| _ {1 , \infty}\right)}} \right\}. +$$ + +Then there exists an absolute constant $c_{2}$ , s.t. $\zeta_{h} = c_{2}\sqrt{\log\mathcal{N}_{\mathbb{I}}(1 / K^{2},\mathcal{P},\|\cdot\|_{1,\infty}) / K}$ falls into such a feasible region. Hence, by Lemma H.1, there exists a constant $c^{\prime}$ , s.t. + +$$ +\mathbb {E} _ {\rho_ {h}} \left[ \left\| \widehat {P} _ {h} ^ {\mathrm {M L E}} (\cdot | s, b) - P _ {h} (\cdot | s, b) \right\| _ {1} ^ {2} \right] \leq c ^ {\prime} \log (\mathcal {N} _ {\mathbb {I}} (1 / K ^ {2}, \mathcal {P}, \| \cdot \| _ {1, \infty}) / \delta) / K. +$$ + +Taking a union bound for $h \in [H]$ and rescaling $\delta$ , we obtain that + +$$ +\sup _ {h \in [ H ]} \mathbb {E} _ {\rho_ {h}} \left[ \left\| \widehat {P} _ {h} ^ {\mathrm {M L E}} (\cdot | s, b) - P _ {h} (\cdot | s, b) \right\| _ {1} ^ {2} \right] \leq c ^ {\prime} \log (\mathcal {N} _ {[ ]} (1 / K ^ {2}, \mathcal {P}, \| \cdot \| _ {1, \infty}) H / \delta) / K, +$$ + +which concludes the proof of Lemma H.3. + +![](images/4d5d53b82e5ba623f5c1447c450fff4a1bd1f3970f34ead018b3bb14816f1f3a.jpg) + +Proof of Lemma G.8. Motivated by Uehara & Sun (2021), we need to consider the localized class and apply Bernstein inequality to sharpen the convergence rate. We define the estimator localized class as + +$$ +\mathcal {P} _ {h} ^ {\text {L o c} 1} := \left\{\widehat {P} \in \mathcal {P}: \mathbb {E} _ {\rho_ {h}} g _ {h} (\widehat {P}) \leq c ^ {\prime} \log \left(\mathcal {N} _ {[ ]} \left(1 / K ^ {2}, \mathcal {P}, \| \cdot \| _ {1, \infty}\right) H / \delta\right) / K \right\}. \tag {77} +$$ + +Then we define the corresponding function class + +$$ +\mathcal {F} _ {h} ^ {1} := \left\{\| \widehat {P} (\cdot | s, b) - P _ {h} (\cdot | s, b) \| _ {1} ^ {2}: \widehat {P} \in \mathcal {P} _ {h} ^ {\text {L o c 1}} \right\}. \tag {78} +$$ + +We denote by $M_{1}(\epsilon) \coloneqq \mathcal{N}(\epsilon, \mathcal{F}_{h}^{1}, \| \cdot \|_{1,\infty})$ and notice that $\widehat{P}_h^{\mathrm{MLE}} \in \mathcal{P}_h^{\mathrm{Loc} 1}$ for all $h \in [H]$ on the event $E_2$ defined in Lemma G.7. Applying Lemma G.1 on the function class $\mathcal{F}_h^1$ with the union bound over $h \in [H]$ , it holds for all $h \in [H]$ and $\widehat{P} \in \mathcal{P}_h^{\mathrm{Loc} 1}$ with probability at least $1 - \delta / 16$ that + +$$ +\begin{array}{l} \big | (\mathbb {E} _ {\mathcal {D} _ {h}} - \mathbb {E} _ {\rho_ {h}}) [ g _ {h} (\widehat {P}) ] \big | \leq 2 \epsilon + \sqrt {\frac {2 \mathbb {V} _ {\rho_ {h}} [ g _ {h} (\widehat {P}) ] \log (M _ {1} (\epsilon) H / \delta)}{K}} + 8 \sqrt {\frac {\epsilon \log (M _ {1} (\epsilon) / \delta)}{n}} + \frac {8 \log (M _ {1} (\epsilon) / \delta)}{3 K} \\ \leq 2 \epsilon + \sqrt {\frac {8 \mathbb {E} _ {\rho_ {h}} [ g _ {h} (\hat {P}) ] \log (M _ {1} (\epsilon) H / \delta)}{K}} + 8 \sqrt {\frac {\epsilon \log (M _ {1} (\epsilon) H / \delta)}{K}} + \frac {8 \log (M _ {1} (\epsilon) H / \delta)}{3 K} \tag {79} \\ \leq 2 \epsilon + \frac {\sqrt {8 c ^ {\prime} \log (\mathcal {N} _ {\mathbb {I}} (1 / K , \mathcal {P} , \| \cdot \| _ {1 , \infty}) H / \delta) \cdot \log (M _ {1} (\epsilon) H / \delta)}}{K} \\ + 8 \sqrt {\frac {\epsilon \log (M _ {1} (\epsilon) H / \delta)}{K}} + \frac {8 \log (M _ {1} (\epsilon) H / \delta)}{3 K}, \\ \end{array} +$$ + +where the first inequality also relies on the fact that $\sup_{\widehat{P} \in \mathcal{P}} \| g_h(P) \|_\infty \leq \sup_{\widehat{P} \in \mathcal{P}} (\| \widehat{P} \|_{1,\infty} + \| P_h \|_{1,\infty})^2 \leq 4$ . To select a proper $\epsilon$ , we define a larger function class $\mathcal{F}_h^0$ as follows, + +$$ +\mathcal {F} _ {h} ^ {0} := \left\{\| \widehat {P} (\cdot | s, b) - P _ {h} (\cdot | s, b) \| _ {1} ^ {2}: \widehat {P} \in \mathcal {P} \right\}. \tag {80} +$$ + +By the following lemma, we characterize the relationship of $\mathcal{F}_h^0$ and $\mathcal{F}_h^1$ . + +Lemma H.3. It holds for all $h\in [H]$ that $\mathcal{N}(\epsilon ,\mathcal{F}_h^0,\| \cdot \|_\infty)\leq \mathcal{N}_{[]}(\epsilon ,\mathcal{P},\| \cdot \|_{1,\infty})$ + +Proof. For any $\widehat{P} \in \mathcal{P}$ , there exists $P_i^{\mathrm{Cover}} \in \{P_j^{\mathrm{Cover}}\}_{j \in [M]} \subset \mathcal{P}$ , where $M = \mathcal{N}(\epsilon, \mathcal{P}, \| \cdot \|_{1,\infty})$ , s.t. $\| P_i^{\mathrm{Cover}} - \widehat{P} \|_{1,\infty} \leq \epsilon$ . Notice that + +$$ +\begin{array}{l} \left| \left[ \| P _ {i} ^ {\mathrm {C o v e r}} - P _ {h} \| _ {1} ^ {2} - \| \widehat {P} - P _ {h} \| _ {1} ^ {2} \right] (s, b) \right| \leq 2 \left| \left[ \| P _ {i} ^ {\mathrm {C o v e r}} - P _ {h} \| _ {1} - \| \widehat {P} - P _ {h} \| _ {1} \right] (s, b) \right| \\ \leq 2 \left| \left[ \| P _ {i} ^ {\text {C o v e r}} - \widehat {P} \| _ {1} \right] (s, b) \right| \tag {81} \\ \leq 2 \| P _ {i} ^ {\text {C o v e r}} - \widehat {P} \| _ {1, \infty} \\ \leq 2 \| P _ {i} ^ {\text {C o v e r}} - \widehat {P} \| _ {1, \infty} \leq 2 \epsilon . \\ \end{array} +$$ + +Taking suprema over $S \times \mathcal{B}$ , we obtain that $\left\| \left[ \| P_i^{\mathrm{Cover}} - P_h \|_1^2 - \| \widehat{P} - P_h \|_1^2 \right] \right\|_{\infty} \leq 2\epsilon$ , which implies that + +$$ +\mathcal {N} (2 \epsilon , \mathcal {F} _ {h} ^ {0}, \| \cdot \| _ {\infty}) \leq \mathcal {N} (\epsilon , \mathcal {P}, \| \cdot \| _ {1, \infty}). +$$ + +Notice that covering number can be upper bounded by bracketing number, that is, + +$$ +\mathcal {N} (2 \epsilon , \mathcal {F} _ {h} ^ {0}, \| \cdot \| _ {\infty}) \leq \mathcal {N} (\epsilon , \mathcal {P}, \| \cdot \| _ {1, \infty}) \leq \mathcal {N} _ {[ ]} (2 \epsilon , \mathcal {P}, \| \cdot \| _ {1, \infty}), +$$ + +which concludes the result of Lemma H.3. + +![](images/5341b1ca08b5fae80fa662039bd40b90f0aeeeb571998061dff6f60db6621af0.jpg) + +Since $M_1(\epsilon) \leq \mathcal{N}(\epsilon, \mathcal{F}_h^0, \| \cdot \|_\infty) \leq \mathcal{N}_{\mathbb{I}}(\epsilon, \mathcal{P}, \| \cdot \|_{1,\infty})$ , selecting a proper $\epsilon = 1 / K^2$ , we have with probability at least $1 - \delta / 16$ that + +$$ +\sup _ {h \in [ H ]} \sup _ {\widehat {P} \in \mathcal {P} _ {h} ^ {\text {L o c} 1}} | [ \mathbb {E} _ {\mathcal {D} _ {h}} - \mathbb {E} _ {\rho_ {h}} ] g _ {h} (\widehat {P}) | \leq c ^ {\prime \prime} \log (\mathcal {N} _ {[} (1 / K ^ {2}, \mathcal {P}, \| \cdot \| _ {1, \infty}) H / \delta) / K, +$$ + +where $c''$ is an absolute constant. Hence we finish the proof of Lemma G.8. + +Proof of Lemma G.9. This proof is more complicated than the proof of Lemma G.8. On the event $E_{1}$ defined in Lemma G.6, we define the estimator localized class as + +$$ +\mathcal {P} _ {h} ^ {\text {L o c} 2} := \left\{\widehat {P} \in \mathcal {P} _ {h, \xi_ {2}}: \mathbb {E} _ {\mathcal {D}} g _ {h} (\widehat {P}) \leq \xi_ {2} \right\}. \tag {82} +$$ + +We also define the function class + +$$ +\mathcal {F} _ {h} ^ {2} := \left\{\| \widehat {P} (\cdot | s, b) - P _ {h} (\cdot | s, b) \| _ {1} ^ {2}: \widehat {P} \in \mathcal {P} _ {h} ^ {\text {L o c} 2}, \text {f o r a l l} h \in [ H ] \right\}. \tag {83} +$$ + +We denote by $M_2(\epsilon) \coloneqq \mathcal{N}(\epsilon, \mathcal{F}_h^2, \| \cdot \|_{1,\infty})$ and notice that $\widehat{P}_h \in \mathcal{P}_h^{\mathrm{Loc}^2}$ on the event $E_1$ defined in Lemma G.6. Applying Lemma G.1 on $\mathcal{F}_h^2$ with union bound over $h \in [H]$ , we have for all $h \in [H]$ and $\widehat{P} \in \mathcal{P}_h^{\mathrm{Loc}^2}$ with probability at least $1 - \delta / 16$ that + +$$ +\begin{array}{l} \big | (\mathbb {E} _ {\mathcal {D} _ {h}} - \mathbb {E} _ {\rho_ {h}}) [ g _ {h} (\widehat {P}) ] \big | \leq 2 \epsilon + \sqrt {\frac {2 \mathbb {V} _ {\rho_ {h}} [ g _ {h} (\widehat {P}) ] \log (M _ {2} (\epsilon) H / \delta)}{K}} + 8 \sqrt {\frac {\epsilon \log (M _ {2} (\epsilon) / \delta)}{n}} + \frac {8 \log (M _ {2} (\epsilon) / \delta)}{3 K} \\ \leq 2 \epsilon + \sqrt {\frac {8 \mathbb {E} _ {\rho_ {h}} [ g _ {h} (\widehat {P}) ] \log (M _ {2} (\epsilon) H / \delta)}{K}} + 8 \sqrt {\frac {\epsilon \log (M _ {2} (\epsilon) H / \delta)}{K}} + \frac {8 \log (M _ {2} (\epsilon) H / \delta)}{3 K} \tag {84} \\ \leq 2 \epsilon + \sqrt {\frac {8 (| [ \mathbb {E} _ {\mathcal {D} _ {h}} - \mathbb {E} _ {\rho_ {h}} ] g _ {h} (\widehat {P}) | + \xi_ {2})}{K} \log (M _ {2} (\epsilon) H / \delta)} \\ + 8 \sqrt {\frac {\epsilon \log (M _ {2} (\epsilon) H / \delta)}{K}} + \frac {8 \log (M _ {2} (\epsilon) H / \delta)}{3 K}. \\ \end{array} +$$ + +By Lemma H.3, it holds that $M_2(\epsilon) \leq \mathcal{N}(\epsilon, \mathcal{F}_h^1, \| \cdot \|_\infty) \leq \mathcal{N}_{\mathbb{I}}(\epsilon, \mathcal{P}, \| \cdot \|_{1,\infty})$ . Selecting a proper $\epsilon = 1 / K^2$ , we solve the quadratic inequality (84) with respect to $|\left[\mathbb{E}_{\mathcal{D}_h} - \mathbb{E}_{\rho_h}\right]g_h(\hat{P})|$ . We obtain that (Uehara & Sun, 2021; Xie et al., 2021) + +$$ +\sup _ {h \in [ H ]} \sup _ {\widehat {P} \in \mathcal {P} _ {h} ^ {\text {L o c} 2}} | \left[ \mathbb {E} _ {\mathcal {D} _ {h}} - \mathbb {E} _ {\rho_ {h}} \right] g _ {h} (\widehat {P}) | \leq C ^ {\prime \prime} \log \left(\mathcal {N} _ {[ ]} \left(1 / K ^ {2}, \mathcal {P}, \| \cdot \| _ {1, \infty}\right) H / \delta\right) / K +$$ + +with probability at least $1 - \delta / 16$ , where $C''$ is an absolute constant. Hence we conclude the proof of Lemma G.9. + +# I. Useful Lemmas for Reproducing Kernel Hilbert Space + +Lemma I.1 (Covering Number of RKHS Ball under $\| \cdot \|_{\infty}$ -Norm). Under Assumption D.9, the covering number of RKHS ball $\mathcal{H}_R = \{f\in \mathcal{H}: \| f\|_{\mathcal{H}}\leq R\}$ with radius $R$ under $\| \cdot \|_{\infty}$ -norm is bounded by + +$$ +\log \mathcal {N} (\epsilon , \mathcal {H} _ {R}, \| \cdot \| _ {\infty}) \leq C \cdot \log^ {2} (1 / \gamma) / \gamma \cdot \log^ {1 + 1 / \gamma} (R / \epsilon). +$$ + +where $C > 0$ is an absolute constant. + +Proof of Lemma I.1. See Lemma C.2. in Cai et al. (2020b) for a detailed proof. + +Lemma 1.2 (Eluder Dimension: RKHS). Under Assumption D.9, the eluder dimension of function class $\mathcal{F}$ with functions upper bounded by $M$ parameterized by RKHS ball $\mathcal{H}_R$ with radius $R$ can be bounded by + +$$ +\dim_ {\mathbb {E}} (\mathcal {F}, \epsilon) \leq C \cdot \log^ {2} (1 / \gamma) / \gamma \cdot \log^ {1 + 1 / \gamma} (R M / \epsilon). +$$ + +Proof of Lemma I.2. See Lemma C.1. in Cai et al. (2020b) for a detailed proof. + +![](images/09d1c4b26aa4d2f2f45b678f8a153859cfc1ad75734822d58659406ca73aa4eb.jpg) + +Lemma 1.3 (RKHS Trancation Error with Assumption D.9). Let $C_1$ and $C_2$ be the absolute constants in Assumption D.9. There exists an absolute constant $\widetilde{C}$ such that for any $\gamma \in (0,1/2), t \geq 1$ , and $R \geq 2$ , if we set + +$$ +d _ {0} = \left\lceil \widetilde {C} \cdot \log (1 / \gamma) / \gamma \cdot \log^ {1 / \gamma} (t R) \right\rceil , +$$ + +then it holds that $d_0^\gamma \geq 4(1 - \gamma) (\gamma C_2)^{-1}$ and + +$$ +\varepsilon_ {d _ {0}} := \sum_ {j > d _ {0}} \sqrt {\lambda_ {j}} \cdot R \leq C _ {1} ^ {1 / 2} d _ {0} ^ {1 - \gamma} R (\gamma C _ {2}) ^ {- 1} \cdot \exp (- C _ {2} d _ {0} ^ {\gamma} / 2) \leq 1 / t. +$$ + +Proof of Lemma I.3. See Lemma F.7. in Cai et al. (2020b) for a detailed proof. \ No newline at end of file diff --git a/welfaremaximizationincompetitiveequilibriumreinforcementlearningformarkovexchangeeconomy/images.zip b/welfaremaximizationincompetitiveequilibriumreinforcementlearningformarkovexchangeeconomy/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..5e61bf3e2de414ae339140aba9ebf37775f8408d --- /dev/null +++ b/welfaremaximizationincompetitiveequilibriumreinforcementlearningformarkovexchangeeconomy/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:47c38870ddc08b1e6b4e1d491b8e6fabe654cc13ec132c126a1afa99d3d36500 +size 2899273 diff --git a/welfaremaximizationincompetitiveequilibriumreinforcementlearningformarkovexchangeeconomy/layout.json b/welfaremaximizationincompetitiveequilibriumreinforcementlearningformarkovexchangeeconomy/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..328b77590c0e0dee3012e9657884e9e2eceb4fa0 --- /dev/null +++ b/welfaremaximizationincompetitiveequilibriumreinforcementlearningformarkovexchangeeconomy/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a43462d695530a9e96e712724f44a687823574ee455f6d402c3c8f627c808fa5 +size 2130894 diff --git a/whatcanlinearinterpolationofneuralnetworklosslandscapestellus/72f9fd26-152c-44c3-bab7-94a70917bd3e_content_list.json b/whatcanlinearinterpolationofneuralnetworklosslandscapestellus/72f9fd26-152c-44c3-bab7-94a70917bd3e_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..69dcb2ae0c81f17bd99e42804f12eb0d92bf4203 --- /dev/null +++ b/whatcanlinearinterpolationofneuralnetworklosslandscapestellus/72f9fd26-152c-44c3-bab7-94a70917bd3e_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:019426c6f9f7b2cbb852a1b0951e92c6ab860f2f278505403f92cf8808b5278c +size 106559 diff --git a/whatcanlinearinterpolationofneuralnetworklosslandscapestellus/72f9fd26-152c-44c3-bab7-94a70917bd3e_model.json b/whatcanlinearinterpolationofneuralnetworklosslandscapestellus/72f9fd26-152c-44c3-bab7-94a70917bd3e_model.json new file mode 100644 index 0000000000000000000000000000000000000000..e9b33de8729fb58272a50c13bfe4ca50c0100bc3 --- /dev/null +++ b/whatcanlinearinterpolationofneuralnetworklosslandscapestellus/72f9fd26-152c-44c3-bab7-94a70917bd3e_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f4a6c468e0f14065d5c0038039d201c93de1fc3dbb4a45a249aeee6cffbe15a7 +size 122434 diff --git a/whatcanlinearinterpolationofneuralnetworklosslandscapestellus/72f9fd26-152c-44c3-bab7-94a70917bd3e_origin.pdf b/whatcanlinearinterpolationofneuralnetworklosslandscapestellus/72f9fd26-152c-44c3-bab7-94a70917bd3e_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..79aeec8381c7cf620738fb5ce9c37314a134e2a9 --- /dev/null +++ b/whatcanlinearinterpolationofneuralnetworklosslandscapestellus/72f9fd26-152c-44c3-bab7-94a70917bd3e_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb9c655ffd75ed3b3f8343895061a62928e837d004218fd33b2e447dd3971a17 +size 1835116 diff --git a/whatcanlinearinterpolationofneuralnetworklosslandscapestellus/full.md b/whatcanlinearinterpolationofneuralnetworklosslandscapestellus/full.md new file mode 100644 index 0000000000000000000000000000000000000000..96b4d94d1327acb7e34e71ab9ce26cf9e11efe4e --- /dev/null +++ b/whatcanlinearinterpolationofneuralnetworklosslandscapestellus/full.md @@ -0,0 +1,399 @@ +# What Can Linear Interpolation of Neural Network Loss Landscapes Tell Us? + +Tiffany Vlaar1 Jonathan Frankle2 + +# Abstract + +Studying neural network loss landscapes provides insights into the nature of the underlying optimization problems. Unfortunately, loss landscapes are notoriously difficult to visualize in a human-comprehensible fashion. One common way to address this problem is to plot linear slices of the landscape, for example from the initial state of the network to the final state after optimization. On the basis of this analysis, prior work has drawn broader conclusions about the difficulty of the optimization problem. In this paper, we put inferences of this kind to the test, systematically evaluating how linear interpolation and final performance vary when altering the data, choice of initialization, and other optimizer and architecture design choices. Further, we use linear interpolation to study the role played by individual layers and substructures of the network. We find that certain layers are more sensitive to the choice of initialization, but that the shape of the linear path is not indicative of the changes in test accuracy of the model. Our results cast doubt on the broader intuition that the presence or absence of barriers when interpolating necessarily relates to the success of optimization. + +# 1. Introduction + +Neural network loss landscapes are difficult to visualize due to their high-dimensionality and the complicated nature of the actual optimization path. This motivated the use of the loss along the linear path between the initial and final parameters of a neural network as a crude yet simple measure of the loss landscape (Goodfellow et al., 2015). In this work we revisit this 1D linear interpolation technique and address whether the shape of the path reflects the test + +$^{1}$ Department of Mathematics, University of Edinburgh, Edinburgh, United Kingdom $^{2}$ MosaicML. Correspondence to: Tiffany Vlaar , Jonathan Frankle . + +Proceedings of the $39^{th}$ International Conference on Machine Learning, Baltimore, Maryland, USA, PMLR 162, 2022. Copyright 2022 by the author(s). + +accuracy of the model and can inform training. + +Linear interpolation from beginning to end. Goodfellow et al. (2015) observed that for fully-connected and convolutional networks with maxout (Goodfellow et al., 2013) trained on MNIST data the loss decays monotonically along the linear path between their initial and final state. The absence of obstacles along the linear path led them to conclude that "these tasks are relatively easy to optimize." This result has been cited widely as an indication of the ease of training (e.g., Li et al. (2018a); McCandlish et al. (2018); Fort et al. (2019)) and the linear interpolation technique itself was used in many papers (Huang et al., 2017; Keskar et al., 2017; Izmailov et al., 2018; Jastrzejbski et al., 2018; Hao et al., 2019). In this paper we address empirically how meaningful the use of this linear path actually is. The exact definition of training tasks being "easy to optimize" is an open question and optimization choices directly influence which linear path we observe. It is also arguable whether we actually want tasks to be easier to optimize; lowering the amount of training data or reducing regularization simplifies training but lowers test accuracy. + +The work by Goodfellow et al. (2015) was recently revisited and extended by Frankle (2020) and Lucas et al. (2021) for a range of modern neural network models, such as ResNet and VGG architectures, on image data sets. Frankle (2020) observed for default parameter settings that the loss often remained at the level of random chance until close to the optimum for these models, different than the behavior observed by Goodfellow et al. (2015). In addition to concurrently confirming this result, Lucas et al. (2021) found that the monotonic decay property observed by Goodfellow et al. (2015) was often maintained when BatchNorm was removed and non-adaptive optimizers were used. On this basis, they hypothesized that "large distances moved in weight space encourage non-monotonic interpolation." + +In our work, we interrogate conjectures stated in prior work that the shape of loss along the linear path relates to the "success" of optimization (which we measure in terms of test accuracy) or other aspects of optimization (e.g., distance travelled). We systematically study the influence of various optimizer and architecture design choices on the shape of the linear path and the test accuracy of the final model, and examine interpolation for individual layers in addition to + +the entire network. An overview of our results is shown in Table 1. Our main finding is that there are situations that both support and violate the aforementioned intuitions on the shape of the linear path. As such, we recommend caution when using this analysis to infer other information about the nature of the optimization problem. + +# Our findings: + +- Pre-training on ImageNet consistently removes the presence of barriers for ResNet architectures trained on CIFAR-10 data, whereas adversarial initialization on random labels increases barriers. The former typically increases the final test accuracy, whereas (in the absence of weight decay) the adversarial initialization lowers it. +- Layers have different levels of sensitivity to the choice of initialization. We introduce the concept of partial pre-training, where we set some layers to a trained (on CIFAR-10) or pre-trained (on ImageNet) state, while using random initialization for others. We use this setting as initialization and train on CIFAR-10. We find that partial pre-training generally leads to worsened test accuracy and (uncorrelated) affects the shape of the linear path. +- The amount of weight decay used during training directly influences both the shape of the linear interpolation path and the final test accuracy, but there is no correlation between them. +- The distance between the initial and final parameter state is not a reliable indicator of non-monotonic behaviour along the linear path. +- The shape of the linear path from initial to final parameter state is not a reliable indicator of test accuracy. + +# 2. Related Work + +Interpolation on the loss landscape. Interpolation between networks in various forms has been a valuable tool for gaining insight into the structure of the optimization landscape. Frankle (2020) found that although the loss did not increase from initial to final state, barriers did appear along the linear path from later iterations to the final state. Other work focused on interpolations between different optima: Draxler et al. (2018) and Garipov et al. (2018) showed that there exist non-linear paths with (nearly) constant low-loss that connect a pair of minima trained from different random initializations. Fort & Jastrzebski (2019) generalized this to show that there exist $m$ low-loss connectors between $(m + 1)$ -tuples of optima, again using non-linear paths. Neyshabur et al. (2020) used linear interpolation to study transfer learning. They did not observe barriers along + +the linear path between the final states of two ResNet-50 models both trained from pre-trained, while barriers did occur between two models trained from scratch (even when trained with the same random initialization). They interpreted this as "pre-trained weights guide the optimization to a flat basin of the loss landscape." We comment on the role of pre-training in Section 4. + +Loss landscape visualization. To improve upon linear interpolation, 2D or 3D visualizations of the loss landscape were made by Goodfellow et al. (2015); Im et al. (2016); Li et al. (2018b); Hao et al. (2019). The reduction of the high-dimensional loss landscape into 2D or 3D slices requires a choice of directions. The chosen directions strongly affect the resulting observed behaviour. Although the linear interpolation method also sacrifices information by taking a 1D slice, it does so with perfect fidelity by considering the path between initial and final state. Linear interpolation is seen as "a simple and lightweight method to probe neural network loss landscapes" (Lucas et al., 2021) and therefore remains frequently used, e.g. by Keskar et al. (2017); Jastrzejbski et al. (2018); Lucas et al. (2020); Neyshabur et al. (2020). + +Role of layers. Zhang et al. (2019) studied the role of different layers by training a neural network and then resetting specific layers to their initial value or a random value, while keeping the other layers fixed at their final state. They observed that certain critical layers are much more sensitive to this perturbation. Chatterji et al. (2020) extended this analysis by studying linear interpolation for specific modules. They relate their concept of "module criticality" with high robustness to noise and valley width. Neyshabur et al. (2020) studied both the direct and optimization path from initial to final state for modules of pre-trained models and found that later layers have tighter valleys. + +Our novel contributions. Previous work studied the shape of the linear path (Frankle, 2020; Lucas et al., 2021), but did not interrogate the connection with the success of optimization. Dating back to Goodfellow et al. (2015) intimating that an absence of barriers along the linear path means that "tasks are relatively easy to optimize", numerous works have implicitly relied on the presence of such a connection to make other claims (McCandlish et al., 2018; Li et al., 2018b; Fort et al., 2019; Hao et al., 2019; Lucas et al., 2020; Neyshabur et al., 2020). In our work, we study exhaustively if such a connection exists by systematically altering initialization, data, and other optimizer and architecture design choices. We also study the hypothesis by Lucas et al. (2021) that "large distances moved in weight space encourage nonmonotonic interpolation". Further, we introduce several novel modes of analysis, such as initializing from the height of the barrier and using linear interpolation to study the role played by individual layers and substructures of the network. In particular, we illustrate the sensitivity of different + +Table 1. The effect of various interventions in training (compared to the baseline provided in Section 3) on (1) the shape of loss over the linear path between the initial and final state of the network and (2) the final test accuracy of the network. Different shapes of loss over the linear path are: no barrier $(NB)$ , barrier $(B)$ , and plateau $(P)$ . If the height of layer-wise barriers changes, we denote this as $H-LB$ (higher) and $L-LB$ (lower layer-wise barriers). The term "often worse/better" [test accuracy] is used for cases where final accuracy depends on which layers/convolutional blocks the intervention is performed. + +
CategoryInterventionShape of the linear pathTest accuracy
Initialization (Sec. 4)Pre-train full model (Fig. 2A)NBBetter
Pre-train on random labels (Fig. 2B, no weight decay)H-LBWorse
Height of the barrier initialization (Fig. 3)NBBetter
Partial (pre-)training (Fig. 4)B/NB/POften worse
Partial random label pre-training (Fig. 5)B/NBOften Worse
Data (Sec. 5)Less data (Fig. 6)NB / L-LBWorse
No data augmentation (Fig. 6)L-LBWorse
Optimizer (Sec. 6)Less weight decay (Fig. 7)NB / BWorse
More weight decay (Fig. 7)PWorse
Fixed learning rate h = 0.01 (Fig. 8)PBetter
Fixed learning rate h ≠ 0.01 (Fig. 8)NBWorse
Smaller initial h for conv blocks with barriers (Fig. 9)NBWorse
Model (Sec. 7)Depth (Fig. 10)H-LBBetter
No batch normalization (Appx. F)NBWorse
MLPs: overparameterize (Appx. F)NBOften better
+ +layers to the choice of initialization and demonstrate the adversarial effect of partial pre-training (Section 4). + +# 3. Linear Interpolation from Start to Finish + +We use the 1D linear interpolation technique (Goodfellow et al., 2015) to study the linear path between the initial and final state of the model. We introduce this technique and how we study the linear path layer-wise in Section 3.1. In Section 3.2 we discuss which different shapes of this linear path we observe and compare our results with the literature (Goodfellow et al., 2015; Frankle, 2020; Lucas et al., 2021). + +# 3.1. Methodology + +Training. We focus on a ResNet-18 (He et al., 2016) architecture with batch normalization trained for 100 epochs on CIFAR-10 data (Krizhevsky & Hinton, 2009) using SGD with momentum (0.9) and weight decay (5e-4) using PyTorch (Paszke et al., 2017). We use initial learning rate $h = 0.1$ that drops by 10x at epochs 33 and 66. For pretrained settings, we use initial learning rate $h = 0.001$ that drops by 10x after 30 epochs. Results are averaged over 10 runs unless indicated otherwise. By modifying different aspects of this training problem, we will study the role of the initialization, data, optimizer, and model throughout this paper. We also consider other architectures in the main body and supplement, including other ResNet architectures, VGG architectures, and multi-layer perceptrons (MLPs). + +Linear interpolation measure for the full model. Consider a $L$ -layer neural network with parameters $\theta = (\theta^{(0)}, \ldots, \theta^{(L)})$ . We use $\theta_{i}$ to refer to the initial state of these parameters and $\theta_{f}$ to refer to the parameters after training using algorithm $\mathcal{T}_t(\theta_i, \mathcal{D})$ on dataset $\mathcal{D}$ for $t$ steps. Following Goodfellow et al. (2015), a linear interpolation path between $\theta_{i}$ and $\theta_{f}$ is created as follows: + +$$ +\theta_ {\alpha} = (1 - \alpha) \theta_ {i} + \alpha \theta_ {f} \text {f o r} \alpha \in [ 0, 1 ]. \tag {1} +$$ + +To examine the loss landscape along this path, we plot the loss for a discrete set of values of $\alpha$ from 0 (initial state) to 1 (final state). One can extend this technique to evaluate the linear path between the state of the model at different steps in training, where $\theta_{i}$ and $\theta_{f}$ are replaced by the model states at the considered steps. One can also study the path between $\theta_{f}$ and a different random initialization $\theta_{i}^{\prime}$ , which is separately sampled from the initialization distribution. + +Layer-wise linear interpolation. We also study linear interpolation in a layer-wise fashion: we vary a single layer (or convolutional block) from initial to final state while keeping all other parameters fixed at their final state. Concretely, for an $L$ -layer network where we vary layer $\ell$ : + +$$ +\theta_ {\alpha} ^ {(\ell)} = (1 - \alpha) \theta_ {0} ^ {(\ell)} + \alpha \theta_ {f} ^ {(\ell)}, \quad \theta_ {\alpha} ^ {(k)} = \theta_ {f} ^ {(k)}, k \neq \ell . \tag {2} +$$ + +This technique was first proposed by Chatterji et al. (2020), who found that certain ResNet layers were more robust to parameter perturbations. In this work, we use the layer-wise linear path to study the role played by substructures of the network. We will vary convolutional blocks as a whole. + +![](images/7452a752092f8739d77985ddb807b0f1b8c4c93f32b8867278d991a2a766ef57.jpg) +Figure 1. (A) Left: MNIST data. Right: spiral data. Test loss over 10 runs for a two hidden layer multi-layer perceptron (MLP) along the linear path between: $\theta_{i}$ and $\theta_{f}$ (blue), $\theta_{f}$ and $\theta_{i}^{\prime}$ (green), $\theta_{i}$ and $\theta_{i}^{\prime}$ (black). (B) Test loss (left) and test accuracy (right) when interpolating for convolutional blocks (denoted as B), fully connected layer (fc), or the entire network (blue dashed line) for a ResNet-18 architecture on CIFAR-10 data, averaged over 10 runs. + +![](images/1afdc021105d4161d3034aab3925cd25fe21d49036ecb460798754ca27b768a1.jpg) + +![](images/bf1ad2640139ebf5a68019211ab60d4a72ddaaed32264853be88f0712e55b2ff.jpg) + +# 3.2. Appearance of Barriers in the Loss Landscape + +Defining barriers. We consider the linear path to contain a barrier if it exhibits a monotonic increase in loss. Goodfellow et al. (2015) observed that, for fully-connected networks on MNIST data, loss decays monotonically along the linear path between initial and trained model, i.e., there are no barriers. Figure 1A (left) reproduces this behaviour for an MLP with two hidden layers trained on MNIST (blue) (full details in Appendix A); moreover, the same monotonic decrease occurs when interpolating between these final weights and any random initialization (green). However, this barrier-free linear interpolation is not a universal phenomenon. As a counterexample, when using the exact same architecture and optimizer but a different dataset (the spiral dataset), barriers do appear along the linear path (Figure 1A, right), in fact rising above the level of loss at initialization; barriers rise even higher when interpolating to other initializations. + +Barriers in modern neural network architectures. Frankle (2020) and Lucas et al. (2021) updated the results of Goodfellow et al. (2015) by studying linear interpolation in modern vision settings. Both observed that, in many cases, "loss plateaus and error remains at the level of random chance...until near the optimum" (Frankle, 2020); that is, loss remains flat, neither monotonically decreasing or encountering barriers. Our results for a ResNet-18 on CIFAR-10 agree with these findings when interpolating for the entire network as the dashed blue line in Figure 1B (left) illustrates. + +Block-wise interpolation. Individual convolutional blocks behave differently from the full network. As the solid lines in Figure 1B (left) show, different blocks take on a variety of behaviors including barriers and monotonic decay. This suggests that it may be valuable to study the connection between linear interpolation and other properties of the network at the finer granularity of individual structural components rather than at the coarse granularity of the entire network. + +# 4. The Role of Initialization + +The choice of initialization affects the path that the model follows and the optimum it finds. It is therefore natural to believe that it also affects the nature of the loss when linearly interpolating from start to finish, a relationship we study in this section. We observe an intuitive relationship between initialization and barriers: actions that make the task easier (e.g., pre-training the model or initializing at the barrier) remove barriers, while those that make the task harder (e.g., initializing adversially) increase the size of barriers. Pretraining only certain layers can both create barriers and worsen test accuracy, although not in a correlated fashion. + +Pre-training. Training a model from a pre-trained state (on ImageNet) causes the loss along the linear path to monotonically decay and improves test accuracy (Figure 2A). This is distinct from the behavior when interpolating to a new random initialization, which exhibits a plateau. This result aligns with the intuition that pre-training simplifies optimization (Hao et al., 2019; Neyshabur et al., 2020). + +Adversarial initialization. We perform adversarial initialization by training on $100\%$ random labels until $100\%$ training accuracy is reached and use this state as initialization for training. In the absence of weight decay, pre-training a ResNet-18 on random labels lowers the final test accuracy (Liu et al., 2020) and increases the barrier height between initial and final state (Figure 2B). This directly opposes the effect of pre-training (Figure 2A), suggesting adversarial initialization complicates optimization. + +Height of the barrier initialization. The linear path of a ResNet-18 trained without weight decay on CIFAR-10 exhibits barriers for some random seeds. For the runs that exhibit barriers, we save the model state at the height of the barrier and use this as initialization for training to study if there exists a barrier between this state and the new optimum. Although it was initialized at a higher loss than occurs at random initialization, the resulting network obtains a higher test accuracy than the network trained from scratch and its + +![](images/cbc267b9e5e91310a4f506a01919d1b4861e8ce6379dff7b7f937866e99910c2.jpg) + +![](images/c9efa6394efcd64cb9c866ba8ee8357f05cbda20fca9ab7a429045f765271564.jpg) + +![](images/6ce9b5c64f0f186ab321eaa452ad494ecc284d24e787d8df793815d55caaea93.jpg) + +![](images/ae6e8d0bf2f16984e75b499827d010b485c2aa012853e655b59567c264ebcbc7.jpg) +Figure 2. (A) Test loss between $\theta_{i}$ and $\theta_{f}$ of a ResNet-18 architecture for CIFAR-10 data (left) and a ResNet-50 architecture for CIFAR-100 data (middle), when trained from scratch (blue) or pre-trained on ImageNet (orange) over 10 runs. Orange-red lines represent the linear path between $\theta_{f}$ (trained from pre-trained) to $\theta_{i}^{\prime}$ . (B) Test loss between $\theta_{i}$ and $\theta_{f}$ of a ResNet-18 architecture trained with SGD without weight decay (WD) on CIFAR-10 data either from scratch (blue) or from a network pre-trained on $100\%$ random labels (orange). + +![](images/8b99b75e4eec1ad581bd859b55af8aeedebe5ec9d0aa8097dc8466d864a292e3.jpg) +Figure 3. ResNet-18 on CIFAR-10 without weight decay. Results are presented over 5 runs. Left: test loss between $\theta_{i}$ and $\theta_{f}$ , when trained either from scratch (blue) or from a initialization corresponding to the height of the barrier along each blue line (orange). Initialization at the height of the barrier removes the presence of a barrier (left), speeds up training (middle), and improves the test accuracy (right). + +![](images/e4add92f222dfc7c3f3133fdd27aeaeb8f72d2b9077d0c21ac99b05442657c80.jpg) + +linear path is barrier free (Figure 3). This mirrors the pretraining results (Figure 2A), suggesting initialization at the height of the barrier aids optimization. + +Partial pre-training. Zhang et al. (2019) measured the change in test accuracy when re-setting specific layers of a trained neural network to their initial state and found large differences across layers. To extend this work, one can study the loss from the initial state of a specific layer to its final state, while keeping all other layers fixed at their final state (Chatterji et al., 2020). We found that the shape of this path greatly varies per convolutional block of a ResNet-18 (Figure 1B). But what these studies do not address is the effect of different layer-wise (or block-wise) initialization on training itself. We thus introduce the concept of "partial (pre-)training": we first train on CIFAR-10 (or pre-train on ImageNet) and then re-set a specific convolutional block to its initial (random) state, while keeping the other parameters at their (pre-)trained state. We then use this state of the model as initialization and train as usual on CIFAR-10 data. + +We find that while pre-training a ResNet-18 leads to higher test accuracy (Figure 2A), partial pre-training often leads to a lower accuracy of the final trained network (Figure 4, left) compared to training the net from scratch. Further, while pre-training the full net leads to monotonic decay along the linear path between initial and final state (Figure 2A), + +partial pre-training often generates barriers (Figure 4). The sensitivity of the network to partial pre-training varies per convolutional block and also between the trained and pretrained setting (e.g., when re-setting convolutional block 4 (RI-4), using a trained state for the rest of the net (T-All) strongly affects test accuracy, but using a pre-trained state (P-All) does not). We conclude that the choice of initialization for different convolutional blocks strongly affects test accuracy after training and changes the nature of optimization. It is remarkable that using a random initialization for the full net leads to higher test accuracy than using a partially pre-trained or partially trained net as initialization. + +Block-wise adversarial initialization. To further explore the effect of using different initializations for individual convolutional blocks on the linear path and test accuracy, we set one convolutional block to a random label adversarial initialization while using a standard random initialization for the rest of the net. We then re-train using this initialization. We find that while adversarial initialization for the first convolutional blocks lowers the test accuracy, using adversarial initialization for convolutional block 4 slightly increases the final test accuracy compared to training from scratch (Figure 5). This is also reflected by the shape of the linear path: when using an adversarial initialization for convolutional block 4 the linear path exhibits monotonic decay while others settings exhibit barriers. $^3$ + +
MethodTest acc (%)
T-All but RI-191.79 ±0.23
T-All but RI-291.83 ±0.21
T-All but RI-392.35 ±0.20
T-All but RI-490.97 ±0.31
P-All but RI-189.97 ±0.13
P-All but RI-289.91 ±0.21
P-All but RI-391.78 ±0.22
P-All but RI-492.78 ±0.22
+ +![](images/379303d2d476ebe9dbd1efbaf8b6aaf64590ceb61bad2732a80f6f4bb3e33e39.jpg) +Figure 4. We set a ResNet-18 to a pre-trained $(P)$ (middle) or trained $(T)$ (right) state, but re-set a specific convolutional block $(B)$ to a random initialization $(RI)$ . Then we train as usual on CIFAR-10. This often affects the test accuracy of the final model (left). Sometimes barriers appear along the linear path for the full net between $\theta_{i}$ and $\theta_{f}$ (middle/right), averaged over 10 runs. + +![](images/d07f2f0729cddd04f3f0986683935495c979b5955aa48645ba1baaec781bcd5a.jpg) + +![](images/78041cfe812668dbf75b9c1b34095f3e1b1d7c81d7abf8dc0aee4b49956f0876.jpg) +Figure 5. ResNet-18 on CIFAR-10 without weight decay. Test loss between $\theta_{i}$ and $\theta_{f}$ when one conv block (B) was adversarially initialized using random labels, averaged over 10 runs. + +Summary. Whereas the use of pre-training removes the presence of barriers and increases test accuracy, the use of adversarial initialization increases barriers and lowers test accuracy. Initializing neural networks at the height of the barrier along their initial to converged state leads to monotonic decay along the linear path, speeds up training, and improves test accuracy. Further, we find that certain convolutional blocks are more sensitive to partial pre-training than others, but the change in test accuracy is not correlated with the shape of the linear path. Whereas pre-training of the full net increases test accuracy and leads to monotonic decay, partial pre-training typically worsens the test accuracy of the resulting net and can generate barriers. + +# 5. The Role of the Dataset + +As illustrated in Figure 1A, where we used the same architecture, initialization, and optimizer to train on two different datasets, the data has a direct influence on the behaviour when linearly interpolating. In this section, we further investigate the effect of data on interpolation. + +Number of examples. When only a subset of the training data set is used throughout training, we expect optimization to be easier and faster, yet the test accuracy of the final model is typically lowered. We find that using a smaller amount of CIFAR-10 training data induces monotonic decay when interpolating and lowers test accuracy (Figure 6, left). + +Role of data augmentation. Throughout this work we use + +a horizontal flip and random crop as data augmentation for CIFAR-10. Removing data augmentation lowers the layer-wise barriers along the linear path (Figure 6, center right). In Appendix D, we show that increasing data augmentation increases the height of layer-wise barriers, while removing data augmentation when using only a subset of the training data further reduces the presence of layer-wise barriers. + +Summary. The shape of the layer-wise linear path is affected by changes to the data, but the shape of the full model linear path is less representative (blue dashed lines, Figure 6). Reducing the complexity of the task (e.g., reducing the amount of data or removing augmentation) lowers or removes layer-wise barriers. The setting with the highest layer-wise barriers reaches the highest test accuracy, and the setting without barriers reaches the lowest test accuracy. + +# 6. The Role of the Optimizer + +Optimizer hyperparameter settings, such as the learning rate and weight decay values, strongly affect which optimum is found and the test accuracy. Further, Lucas et al. (2021) found that training modern vision networks with Adam (as opposed to the more typical SGD with momentum) more frequently leads to non-monotonic decay of the loss when linearly interpolating. Adam also increases the distance that the network travels from initialization, leading Lucas et al. (2021) to posit "large distances moved in weight space encourage non-monotonic interpolation". Inspired by this, we study how using different levels of weight decay or different fixed learning rates —both of which affect the distance travelled and final accuracy— affect the shape of loss when linearly interpolating. We find that the hypothesis of Lucas et al. (2021) does not hold in general and that the level of weight decay directly controls the behaviour along the linear path. + +The effect of weight decay on linear interpolation. In Figure 7, we vary the amount of weight decay (WD) that is used to train ResNet-18 on CIFAR-10 data. When using little or no weight decay, the behaviour of the loss varies over different runs; it sometimes exhibits barriers and sometimes monotonic decay. When using more weight decay, the + +![](images/5f983e7fa7592bd443220e6cc337866b68967b25d69860f61ae30ee452810f6b.jpg) +Figure 6. Test loss between $\theta_{i}$ and $\theta_{f}$ for ResNet-18 on CIFAR-10 when varying the amount of training data and whether data augmentation (horizontal flips, random crops) is used. Averaged over 10 runs. + +![](images/d2c015fe01a384cab6b89d2383e7d155c2fdd4e5e7fb1df4bdc9c502df95815e.jpg) + +![](images/8ee54c470c86b5c3363799ededabd7216c0ba4480dbcb9c62238d0f4eedea844.jpg) + +![](images/cc3d12b0dd8c03d804e84bf2ab6dbb0e546c57270916b7799759bef891389870.jpg) + +![](images/2368a113044b422cacdd9c9c6f6a077f63dfbb539aa5338daac3640d8139a296.jpg) +Figure 7. Effect of the amount of weight decay (WD) used for training a ResNet-18 architecture on CIFAR-10 on the linear path and test accuracy. The highest test accuracy is reached using WD = 5e-4 (blue). + +behaviour changes. At 1e-4 (purple), the loss consistently monotonically decays. The highest test accuracy is reached when training with 5e-4 (blue), for which loss consists of a plateau with a sudden drop close to the final state. When increasing beyond that, test accuracy decreases, but the loss still exhibits a plateau. The shape of the linear path is thus not a reliable indicator of test accuracy of the final model. + +How do barriers connect to the distance travelled? Non-monotonic behaviour occurs when training a model both with zero and large weight decay values (Figure 7), while we would expect models without weight decay to travel farther. To further study this relationship, we trained a ResNet-18 at different fixed learning rates $h$ (Figure 8). The linear paths for models trained using higher and lower learning rates $(h = 0.1$ and 0.001) exhibit monotonic decay, while training with an intermediate learning rate $(h = 0.01)$ does not. This contradicts the hypothesis of Lucas et al. (2021), under which we would expect the model with the highest learning rate (which travels the furthest) to have a barrier, not a + +model with a lower learning rate. $^{4}$ In addition, these results also cast doubt on a connection between monotonically decreasing loss and better accuracy; the middle learning rate (the one that induces a barrier) reaches higher test accuracy than either of the other learning rates (which do not). + +Layer-wise sensitivity to learning rate. We have observed that linear interpolation behaviour varies by layer (Figure 1B) and that layers/individual conv blocks have different levels of sensitivity to the choice of initialization (Figure 4 and Figure 5). This raises the question of how the use of different optimizer hyperparameter choices for different layers affects the shape of the linear path and the final test accuracy of the model. Figure 9 shows the effect of training layers that exhibit barriers with a different learning rate than those that do not. Lowering the initial learning rate used for layers that exhibit barriers removes those barriers, but also substantially lowers the test accuracy of the final model.[5] + +4The measure of distance is detailed in Appendix E. +5The same holds for a VGG-11 model (Figure A16, Appx. E). + +![](images/e20e1eb510feb49f2d4a9f3bf09a0432a2734b8f879bad92174a4b6fdb23a1fa.jpg) +Figure 8. ResNet-18 trained on CIFAR-10 with fixed learning rate $h$ . Averaged over 10 runs. + +![](images/f30381e0d6994bc0ef60149bc00513ae02976772a14c1dddbbec44786a00ba54.jpg) +Figure 9. Block-wise linear interpolation for ResNet-18 trained on CIFAR-10 using different initial learning rates $h_0$ . Left: $h_0 = 0.1$ for all, right: $h_0 = 0.01$ for layers/conv. blocks that exhibit barriers and $h_0 = 0.1$ for the rest. + +![](images/ed6d91e24728da97a2492dba2d7e30572b60eacad0dd359340987b01d64e7f8b.jpg) + +This raises the question whether we can optimize different layers differently depending on the absence or presence of barriers. Concretely, Table 2 shows the result of training layers/conv blocks that exhibit barriers with a different learning rate or amount of weight decay than those that do not. Lowering the initial learning rate used for layers without barriers or eliminating weight decay has a smaller (ResNet-18) or no (VGG-11) effect on the test accuracy of the trained model, whereas doing so for layers with barriers or for all layers lowers accuracy substantially. + +Table 2. We train layers/conv blocks that exhibit barriers $(B)$ with a different learning rate or amount of weight decay (WD) than those that do not $(NB)$ . Test accuracy on CIFAR-10 over 10 runs is maintained much better when training only the layers with barriers at the higher learning rate or with weight decay. + +
Initial learning rate h0Test accuracy
ResNet-18VGG-11
0.1 (all)92.2 ±0.2%91.9 ±0.2%
0.1 (B), 0.01 (NB)91.8 ±0.2%92.0 ±0.1%
0.01 (B), 0.1 (NB)90.1 ±0.2%90.4 ±0.1%
0.01 (all)90.3 ±0.3%90.9 ±0.1%
Weight decay (all)92.2 ±0.2%91.9 ±0.2%
WD (B), No WD (NB)91.5 ±0.2%91.8 ±0.1%
No WD (B), WD (NB)90.1 ±0.3%90.2 ±0.1%
No WD (all)90.1 ±0.4%90.4 ±0.3%
+ +Summary. The distance between initial and final state is not a reliable indicator of non-monotonic behaviour. The shape of the linear path is directly influenced by the amount of weight decay and is not indicative of test accuracy. Training layers that exhibit barriers with a smaller initial learning rate removes the barriers, but also lowers test accuracy. + +# 7. The Role of the Model + +Throughout this work we focused on a ResNet-18 architecture with batch normalization. We now discuss the role of the model architecture on the shape of the linear path. + +Architecture depth. Generally, the use of deeper ResNet architectures on CIFAR-10 data generates or increases the height of convolutional block-wise barriers (Figure 10). + +Role of batch normalization. Similar to Lucas et al. (2021), we find that the use of batch normalization (BN) leads to non-monotonic behaviour along the linear path for ResNet and VGG architectures (see Appendix F). However, we find that for various datasets, MLPs do exhibit barriers in the absence of BN (see e.g., Figure 1A). We also study the linear interpolation parameter group-wise and show that the running mean and variance BN parameters play an important role in the shape of the linear interpolation path observed for the full convolutional block (see Appendix F). + +Summary of other architectures. In Appendix F, we show that the behaviour for VGG-11 is similar to that of a ResNet-18. For MLPs, we find that increasing the number of nodes in layers with barriers removes the overall presence of barriers. This effect does not transfer to ResNet architectures. For MLPs, early layers contain barriers, whereas later layers do not exhibit barriers. Similarly, Zhang et al. (2019) found that the first layer is most sensitive to re-initialization. + +Summary. Batch normalization encourages non-monotonic behaviour. Meanwhile, in Table 2 we showed that using a large initial learning rate for layers/conv blocks that contain barriers is necessary to achieve good test accuracy. These effects together corroborate the observation by Jastrzebski et al. (2020) that using a large learning rate in the initial phase of training is necessary for networks with batch normalization. We also find that the behaviour for MLPs is distinct from ResNet or VGG architectures. + +# 8. Discussion and Future Work + +Throughout this work, we explored the relationship between the shape of the linear path between the initial and final model states and the outcome of optimization. We also studied the linear path in a layer-wise fashion to illustrate that individual convolutional blocks have different sensitivities to initialization and optimizer hyperparameter settings. + +What influences the shape of loss when linearly interpolating? This one-dimensional slice of the landscape is heavily influenced by both initialization and optimization choices. We found that the data also directly influences the linear path (Figure 1A and Section 5). In addition, the nat- + +![](images/f6426a8fea30f7b115e093a716febaf84c8fa9a54206226a22b72981bfe7765b.jpg) +Figure 10. Test loss when interpolating for convolutional blocks (denoted as B) and the entire network (blue dashed line) for different ResNet architectures trained from scratch on CIFAR-10 data. Results are averaged over 10 runs. + +![](images/a082520fe2e37418e39d4d2259c942c5aac1e85c83b66776819c7bffd0ba6e2b.jpg) + +![](images/d6a73f292e299b14ea41eb21c197bbfd6c93a9244b958a76802aa516a4df11d0.jpg) + +ural language processing literature suggests that attention-based models need adaptive optimizers (e.g. Adam) to train properly (Devlin et al., 2018; Liu et al., 2019; Zhang et al., 2020), unlike convolutional models for vision data, which can be trained well with SGD with momentum (Szegedy et al., 2014; He et al., 2016; Zagoruyko & Komodakis, 2016). While we focused on the latter, we think that revisiting this study for attention-based models is an interesting direction for future work. + +Does the shape of loss when interpolating provide insight into other aspects of optimization? Linear interpolation is a one-dimensional view of the high-dimensional optimization landscape. The network follows a different, nonlinear path from initialization to its final weights. As such, linear interpolation inherently sacrifices information about the optimization problem; prior work and this paper consider whether the information it gleans still provides useful insights into optimization. + +Despite the intuition provided by Goodfellow et al. (2015) that the absence or presence of obstacles reflects difficulty of optimization, we found many cases where higher layer-wise barriers or the creation of barriers along the linear path of the full model appear alongside increased test accuracy. This evidence implies that either a more difficult optimization trajectory can lead to improved generalization, or Goodfellow et al.'s intuition about the relationship between interpolation and optimization difficulty does not apply to the networks we studied. Moreover, we found cases where monotonically decreasing loss was accompanied by higher test accuracy (e.g., pre-training). We also found others where the linear path exhibited both barriers and monotonic decay over different runs (e.g., weight decay) and where the presence or absence of barriers was not correlated with increased or decreased test accuracy. In short, for the settings we considered, the shape of the linear path between initial and final state was not a reliable indicator of test accuracy of the trained model. Our results show that caution is needed when using linear interpolation to make broader claims on the shape of the landscape and success of optimization. + +Layer-wise interpolation. Interpolating layer-wise makes it possible to study changes in behaviour that are difficult or + +impossible to discern when interpolating using the full network, for example changes in the data (Figure 6) or model (Figure 10). Further, independent of the shape of the linear path, we found that partial pre-training of convolutional blocks can counterintuitively lower test accuracy of the final model. Although neural networks learn hierarchically (Yosinski et al., 2014; Hao et al., 2019; Neyshabur et al., 2020), the sensitivity to partial pre-training varies per convolutional block and does not follow an obvious pattern. This result implicates the increasingly popular direction of training individual layers in different ways (You et al., 2017; Leimkuhler et al., 2019; You et al., 2020; Murfet et al., 2020; Vlaar, 2022) and raises questions about the basis upon which we should make such decisions. + +# 9. Conclusion + +We conclude that the shape of the linear path from initial to final state is not a reliable indicator of test accuracy. Although focusing on one line of analysis, e.g. on the role of initialization, seems to suggest that there does exist a connection, the full picture (Table 1, Figure A11) illustrates that this is misleading. We believe publishing this negative result is important due to the widespread use of the linear interpolation method. Further, we introduce a new line of inquiry by studying the role played by individual layers and substructures of the network. We find that certain layers require larger initial learning rates to maintain the same test accuracy. We also show the surprising adversarial effect of partial pre-training. Further exploration of the layer-wise sensitivity to choice of initialization offers an exciting direction for future work. + +# Acknowledgements + +We thank the reviewers for their time and comments. During the creation of this paper Tiffany Vlaar was supported by The Maxwell Institute Graduate School in Analysis and its Applications, a Centre for Doctoral Training funded by the UK Engineering and Physical Sciences Research Council (grant EP/L016508/01), the Scottish Funding Council, Heriot-Watt University and the University of Edinburgh. + +# References + +Chatterji, N. S., Neyshabur, B., and Sedghi, H. The intriguing role of module criticality in the generalization of deep networks. *ICLR*, 2020. +Devlin, J., Chang, M.-W., Lee, K., and Toutanova, K. BERT: Pre-training of deep bidirectional transformers for language understanding. arXiv:1810.04805, 2018. +Draxler, F., Veschgini, K., Salmhofer, M., and Hamprecht, F. A. Essentially no barriers in neural network energy landscape. arXiv:1803.00885, 2018. +Fort, S. and Jastrzebski, S. Large scale structure of neural network loss landscapes. ICML, 2019. +Fort, S., Hu, H., and Lakshminarayanan, B. Deep ensembles: A loss landscape perspective. Bayesian Deep Learning workshop, NeurIPS, 2019. +Frankle, J. Revisiting "qualitatively characterizing neural network optimization problems". ML Retrospectives NeurIPS workshop, 2020. +Garipov, T., Izmailov, P., Podoprikhin, D., Vetrov, D. P., and Wilson, A. G. Loss surfaces, mode connectivity, and fast ensembling of DNNs. NIPS, 31:8789-8798, 2018. +Goodfellow, I., Warde-Farley, D., Mirza, M., Courville, A., and Bengio, Y. Maxout networks. ICML, 2013. +Goodfellow, I., Vinyals, O., and Saxe, A. Qualitatively characterizing neural network optimization problems. *ICLR*, 2015. +Hao, Y., Dong, L., Wei, F., and Xu, K. Visualizing and understanding the effectiveness of BERT. EMNLP, 2019. +He, K., Zhang, X., Ren, S., and Sun, J. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770-778, 2016. +Huang, G., Li, Y., Pleiss, G., Liu, Z., Hopcroft, J., and Weinberger, K. Snapshot ensembles: Train 1, get M for free. ICLR, 2017. +Im, D., M.Tao, and Branson, K. An empirical analysis of deep network loss surfaces. arXiv:1612.04010, 2016. +Izmailov, P., Podoprikhin, D., Garipov, T., Vetrov, D., and Wilson, A. G. Averaging weights leads to wider optima and better generalization. Uncertainty in Artificial Intelligence, 2018. +Jastrzebski, S., Kenton, Z., Arpit, D., Ballas, N., Fischer, A., Bengio, Y., and Storkey, A. Three factors influencing minima in SGD. ICANN, 2018. + +Jastrębski, S., Szymczak, M., Fort, S., Arpit, D., Tabor, J., Cho, K., and Geras, K. The break-even point on optimization trajectories of deep neural networks. *ICLR*, 2020. +Keskar, N., Mudigere, D., Nocedal, J., Smelyanskiy, M., and Tang, P. On large-batch training for deep learning: generalization gap and sharp minima. *ICLR*, 2017. +Krizhevsky, A. and Hinton, G. Learning multiple layers of features from tiny images. 2009. +Leimkuhler, B., Matthews, C., and Vlaar, T. Partitioned integrators for thermodynamic parameterization of neural networks. Foundations of Data Science, 1(4):457-489, 2019. +Li, C., Farkhoor, H., Liu, R., and Yosinski, J. Measuring the intrinsic dimension of objective landscapes. *ICLR*, 2018a. +Li, H., Xu, Z., Taylor, G., Studer, C., and Goldstein, T. Visualizing the loss landscape of neural nets. NeurIPS, 2018b. +Liu, S., Papailiopoulos, D., and Achlioptas, D. Bad global minima exist and SGD can reach them. NeurIPS, 2020. +Liu, Y., Ott, M., Goyal, N., Du, J., Joshi, M., Chen, D., Levy, O., Lewis, M., Zettlemoyer, L., and Stoyanov, V. RoBERTa: A robustly optimized BERT pretraining approach. arXiv:1907.11692, 2019. +Lucas, J., Bae, J., Zhang, M., Ba, J., Zemel, R., and Grosse, R. On monotonic linear interpolation of neural network parameters. OptML NeurIPS workshop, 2020. +Lucas, J., Bae, J., Zhang, M., Fort, S., Zemel, R., and Grosse, R. Analyzing monotonic linear interpolation in neural network loss landscapes. ICML, 2021. +McCandlish, S., Kaplan, J., Amodei, D., and Team, O. D. An empirical model of large-batch training. arXiv:1812.06162, 2018. +Murfet, D., Wei, S., Gong, M., Li, H., Gell-Redman, J., and Quella, T. Deep learning is singular, and that's good. arXiv:2010.11560, 2020. +Neyshabur, B., Sedghi, H., and Zhang, C. What is being transferred in transfer learning? NeurIPS, 2020. +Paszke, A., Gross, S., Chintala, S., Chanan, G., Yang, E., DeVito, Z., Lin, Z., Desmaison, A., Antiga, L., and Lerer, A. Automatic differentiation in PyTorch. 2017. +Szegedy, C., Liu, W., Jia, Y., Sermanet, P., Reed, S., Anguelov, D., Erhan, D., Vanhoucke, V., and Rabinovich, A. Going deeper with convolutions. CoRR, 2014. + +Vlaar, T. and Leimkuhler, B. Multivariate training of neural networks. ICML, 2022. +Yosinski, J., Clune, J., Bengio, Y., and Lipson, H. How transferable are features in deep neural networks? NIPS, 2014. +You, Y., Gitman, I., and Ginsburg, B. Large batch training of convolutional networks. arXiv preprint arXiv:1708.03888, 2017. +You, Y., Li, J., Reddi, S., Hseu, J., Kumar, S., Bhojana-palli, S., Song, X., Demmel, J., Keutzer, K., and Hsieh, C. Large batch optimization for deep learning: training BERT in 76 minutes. *ICLR*, 2020. +Zagoruyko, S. and Komodakis, N. Wide residual networks. CoRR, 2016. +Zhang, C., Bengio, S., and Singer, Y. Are all layers created equal? arXiv:1902.01996, 2019. +Zhang, J., Karimireddy, S., Veit, A., Kim, S., Reddi, S., Kumar, S., and Sra, S. Why are adaptive methods good for attention models? NeurIPS, 2020. + +# A. Implementation Details + +Throughout the paper we focus on a ResNet-18 architecture with batch normalization trained on CIFAR-10 data. We set batchsize to 128, use cross entropy loss, and use as data augmentation: horizontal flip, random crop, and normalization. We train the network for 100 epochs using SGD with momentum with weight decay set to 5e-4 and the momentum hyperparameter set to 0.9. We use an initial learning rate of $h = 0.1$ that is dropped by a factor of 10 every 33 epochs. For pre-trained models we use initial learning rate $h = 0.001$ that is dropped by a factor of 10 after 30 epochs. We obtain our pre-trained models from the PyTorch library, which have been trained on ImageNet. We replace the final fully connected layer to match the number of classes and (when training on CIFAR-10 data) set the first convolutional layer to have 3 input channels, 64 output channels, and a kernel size of $3 \times 3$ . We perform all our experiments in PyTorch using NVIDIA DGX-1 GPUs and use standard random PyTorch initialization. Our results are all averaged across multiple runs with different random seeds on initialization and data order. + +In this work we vary specific aspects of the training problem, such as the optimizer hyperparameters, data, initialization, and model, while keeping all other aspects fixed. For example, we consider deeper ResNet architectures (Figure 10), but use the same optimizer, data, and initialization settings as for our base model. But, as described in the paper, there are a few experiments where we change multiple aspects of the training problem: we turn off weight decay for both our random label initialization experiment (Figure 2B) and our height of barrier initialization experiment (Figure 3). For the former, we wanted to study the effect of adversarial initialization that lowered the test accuracy of the final trained network. A network trained on $100\%$ random labels as initialization typically does not affect the test accuracy of the final model, when using SGD with momentum, learning rate decay and weight decay (Liu et al., 2020). But turning off weight decay during training in combination with pre-training on random labels does lower the test accuracy. For our height of barrier initialization experiment (Figure 3) we needed a setting for which the linear path exhibited clear barriers. For a ResNet-18 this is found for some seeds when weight decay is turned off (Figure 7). For the runs that exhibited barriers we saved the state of the model at the height of this barrier and used this as initialization for our model to produce Figure 3. + +Further, to obtain Figure 1A we used a two hidden layer perceptron with 50 nodes in each hidden layer and ReLU activations. We used Adam with $h = 5\mathrm{e - }4$ , without weight decay or any learning rate scheduling. We use batch size 128 for MNIST data and cross entropy loss. We use binary cross entropy loss for the binary classification spiral data set. The first class of the spiral data set is generated using + +$$ +\begin{array}{l} x = 2 \sqrt {t} \cos (8 \sqrt {t} \pi) + 0. 0 2 \mathcal {N} (0, 1), \\ y = 2 \sqrt {t} \sin (8 \sqrt {t} \pi) + 0. 0 2 \mathcal {N} (0, 1), \tag {3} \\ \end{array} +$$ + +where $t$ is drawn repeatedly from the uniform distribution $\mathcal{U}(0,1)$ to generate data points. The other class of this dataset is obtained by shifting the argument of the trigonometric functions by $\pi$ . For our experiments on the spiral data set we used 10000 training data, 5000 test data points and a batch size of 500. + +# B. Overview of Results + +A summary of all our findings can be found in Figure A11. + +![](images/4828e86e07a5c5580e335d18822556242e97786408fad4d40011267c6b106f22.jpg) +Figure A11. The linear path between $\theta_{i}$ and $\theta_{f}$ of our base ResNet-18 architecture exhibits a plateau at the level of random chance until close to the optimum (plateau + drop); it exhibits barriers when evaluating the linear path layer-wise (see Figure 1B). The base model obtains $92.2\%$ accuracy on CIFAR-10 test data. In this figure we present the change in test accuracy and shape of the linear path between $\theta_{i}$ and $\theta_{f}$ compared to this base model along four axes: the optimizer, the data, the initialization, and the model. There are several cases where the presence of barriers coincides with increased test accuracy. But there are also cases where no barriers do. We conclude that the shape of the linear path is not a reliable indicator of accuracy. + +# C. Further Studies on the Role of Initialization + +Left/right of barrier initialization. In Section 4 we showed the effect of initializing neural networks at the parameter configuration which corresponds to the height of the barrier along their initial to converged state. We considered a ResNet-18 architecture which was trained without weight decay on CIFAR-10 data. The linear interpolation path in this setting clearly exhibits barriers for some seeds (Section 6, Figure 7). For the runs that exhibited barriers, we saved the model state at the height of the barrier and used this as initialization for our model. Although it was initialized at a higher loss than occurs at random initialization, the resulting network obtained a higher test accuracy than the network trained from scratch and its linear path exhibited monotonic decay (Figure 3). In Table A3 and Figure A12 we show that these effects are not restricted to initialization at the barrier: choosing an initialization along the linear path to the left or the right of the barrier leads to similar performance improvement (Table A3) and typically monotonic decay along the linear path (Figure A12). + +Table A3. ResNet-18 on CIFAR-10 without weight decay. Test loss between $\theta_{i}$ and $\theta_{f}$ for discrete set of $\alpha \in [0,1]$ in 50 equally spaced subintervals, when trained either from scratch (blue) or from an initialization corresponding to $\theta_{\alpha}$ of the blue line at: the height of the barrier $\alpha_{\mathrm{barrier}}$ before the barrier at $\alpha = \alpha_{\mathrm{barrier}} - 5$ , after the barrier at $\alpha = \alpha_{\mathrm{barrier}} + 5$ (red). + +
InitializationTraining accuracy (%)Test accuracy (%)
Random initialization99.44 ±0.1290.01 ±0.39
Before barrier99.80 ±0.0491.05 ±0.21
Height of barrier99.86 ±0.0291.12 ±0.18
After barrier99.88 ± 0.0290.85 ±0.17
+ +![](images/859f9e4313760ba5d144230d6ac8784cbe079d95e402d3efc1f8165b241a4208.jpg) +Figure A12. ResNet-18 on CIFAR-10 without weight decay. Test loss between $\theta_{i}$ and $\theta_{f}$ for discrete set of $\alpha \in [0,1]$ in 50 equally spaced subintervals, when trained either from scratch (blue) or from an initialization corresponding to $\theta_{\alpha}$ of the blue line at: the height of the barrier $\alpha_{\mathrm{barrier}}$ (orange), just before the barrier at $\alpha = \alpha_{\mathrm{barrier}} - 5$ (green), just after the barrier at $\alpha = \alpha_{\mathrm{barrier}} + 5$ (red). + +![](images/69a8660073804ae86c037668baf54b4070994ecaae6ce2c9d1d6c15965c59cb7.jpg) + +![](images/b783a9c3f89b8adf96a889b0f5dddedcff9f69426d2e36afffa39d4e277546f2.jpg) + +![](images/92fc7fd3392df7b228ae2da9328a744987a40a9cf2300c4fc05eabca75d0e575.jpg) + +![](images/6ebee450a0ffa25f9ecf506a6ad48f169d7070258011ebb778d1bb32836be6e1.jpg) +Figure A13. Test loss between $\theta_{i}$ and $\theta_{f}$ when one specific conv block (B) was adversarially initialized using random labels. The net was trained either without weight decay (WD) (left), with WD = 1e-4 (middle) or with WD = 5e-4 (right). Averaged over 10 runs. + +![](images/50e0e8d2cc63398b645474dd41657ecafd619ddffd31c12bdde0604a80ce7355.jpg) + +![](images/b48454dc93eb9e30933fcfb3915180381ca44e980290e13ed91a523e24fcff17.jpg) + +Block-wise adversarial initialization with different levels of weight decay. To further explore the effect of using different initializations for individual convolutional blocks on the linear path and test accuracy, we set one convolutional block to a random label adversarial initialization while using a standard random initialization for the rest of the net. We then re-train using this initialization with different amounts of weight decay (WD). We vary the WD value to study how changes in the full model linear path (Figure 7) are reflected by the convolutional block-wise linear path. We find that while adversarial initialization for the first convolutional blocks lowers the test accuracy, using adversarial initialization for convolutional block 4 slightly increases the final test accuracy compared to training from scratch (compare Figure A13 with Figure 7). This is also reflected by the shape of the linear path: when using an adversarial initialization for convolutional block 4 the linear path exhibits monotonic decay while others settings exhibit barriers (no WD) and a barrier while other settings exhibit a plateau $(\mathrm{WD} = 5\mathrm{e - }4)$ . + +# D. Further Studies on the Role of Data + +Less training data and no data augmentation. Further to our experiments in Section 5, we here show the combined effect of reducing the number of training data in addition to removing data augmentation (Figure A14, left). We find that although this further reduces the test accuracy and presence of block-wise barriers, the overall behaviour for the linear interpolation of the full model (blue dotted line) is maintained (unless the number of training data is further reduced, see Figure 6, left in main paper). + +More data augmentation. In Figure A15 we show that using additional data augmentation causes the height of layer-wise barriers to slightly increase (for B2 and B3). + +![](images/9b3f3332050f34382523c35856cc7d66a704930617b61fe049bcad682a9793a6.jpg) +Figure A14. Test loss between $\theta_{i}$ and $\theta_{f}$ for ResNet-18 on CIFAR-10 when varying the amount of training data and whether data augmentation (horizontal flips and random crops) is used. + +![](images/8c0f43439e7eb77dd4df1e346c387318bedc39a9448d4850e969fc1188a8c61b.jpg) + +![](images/a71cff543545afdd528c0908fa3a9e5c86f7696082e9edc03027227dd7de6a7d.jpg) + +![](images/6199c6ae8a9d7289ccfa18e475084c2b2f43569bf260bc8669c0795f3da8ca70.jpg) + +![](images/5bde0ea660931413fd748d13e3b148baba855c14fe6bdd58c7cf7b3dde630aaa.jpg) +Figure A15. Test loss between $\theta_{i}$ and $\theta_{f}$ for ResNet-18 on CIFAR-10 when using either no data augmentation (left), standard data augmentation (horizontal flips and random crops) (middle), or additional data augmentation (brightness = 0.05) (right). + +![](images/7505da75342d3f0ccccde0a5fd20b734235c1b10c5ad0bf251aaa69d21ad57b9.jpg) + +![](images/7c23af23f185f664b88ef88a2a2910398972aa16a9bef23b7dc288dcd5943770.jpg) + +# E. Further Studies on the Role of Optimization + +Distance. In our fixed learning rate experiment (Figure 8) we showed that setting $h = 0.01$ leads to the largest test accuracy of the trained model and non-monotonic behaviour of the loss along the linear path between initial and final state. Meanwhile using a larger ( $h = 0.1$ ) or smaller ( $h = 0.001$ ) learning rate led to a lower test accuracy and monotonic decay of the loss along the linear path. We used the same initialization to compare the different settings, but averaged the results presented in Figure 8 over 10 runs using different random seeds. To measure the distance between initial $\theta_{i}$ and final $\theta_{f}$ models we use the following measure (as used in (Liu et al., 2020)): + +$$ +d \left(\theta_ {f}, \theta_ {i}\right) = \frac {\left\| \theta_ {f} - \theta_ {i} \right\| _ {F}}{\left\| \theta_ {i} \right\| _ {F}}, \tag {4} +$$ + +where $\| \cdot \|_F$ denotes the Frobenius norm. There exist many other ways of measuring the distance, which affect the order of magnitude. Since we focus only on the relative distances travelled for different learning rate settings the use of Eq. (4) suffices for this purpose. We find that the average distance travelled when using $h = 0.1$ is 1.03, whereas the average distance travelled when using $h = 0.01$ is 0.88 and when using $h = 0.001$ is 0.22. This confirms our intuition that using a larger learning rate will increase the distance travelled. + +Layer-wise Sensitivity to Learning Rate. We observed that using a smaller initial learning rate for layers or convolutional blocks which exhibit barriers removes these barriers, but also lowers the test accuracy of the resulting model for a ResNet-18 architecture (Figure 9 or Figure A16A). We observe the same behaviour for a VGG-11 architecture (Figure A16B). We consider layers (or convolutional blocks) to not exhibit barriers if the loss along their linear path is monotonically decreasing; the exact layers are specified in the caption of Figure A16. + +![](images/aa90a8724d55f968c093015cd86f340280d2ad1ec3340cf66c8c7b37b55c0a7c.jpg) + +![](images/037fd2d883dd6756b1aeef0d714c10af333bbf2b8c3380718f6734869173a507.jpg) + +![](images/164b3a3e845ef754b5aa7c31d53c9ccfcb5e675e280d6f568d1e7e7fcae294e9.jpg) +Figure A16. Layer-wise (or block-wise) linear interpolation for ResNet-18 (A) and VGG-11 (B) trained from scratch on CIFAR-10 data using different initial learning rates $h_0$ . For ResNet-18 (A): left: $h_0 = 0.1$ for all, right: $h_0 = 0.01$ for conv block 2, 3, and 4.0 and $h_0 = 0.1$ for rest. For VGG-11 (B): left: $h_0 = 0.1$ for all, right: $h_0 = 0.01$ for layers 4-10 and $h_0 = 0.1$ for rest. Using smaller learning rates for layers that exhibit barriers (ResNet-18: conv block 2, 3, and 4.0, VGG-11: layer 4-10) can remove barriers, but lowers the test accuracy of the resulting model. + +![](images/2be82095e6269c26ec48ff40ee98ec1ee6677379590a92444e4d92a88a124174.jpg) + +# F. Further Studies on the Role of the Model + +Multi-layer perceptrons. For multi-layer perceptrons (MLPs) we find that the early layers (close to the input) typically exhibit barriers, whereas later layers exhibit monotonic decay (Figure A17, left). By increasing the number of nodes in layers that exhibit barriers one can reduce the presence of barriers for the overall model (Figure A17, middle). Meanwhile, layers that do not exhibit barriers can be narrowed without removing the monotonic decay property (Figure A17, right). + +![](images/83f1dd32504df3bd90d79e82013b0cdabd5a957066e530dc6b0e04ff5dacc270.jpg) +Figure A17. A 6 hidden layer MLP trained on spiral data (generated using Eq. 3) using different amount of nodes in the hidden layers: 50-node for all layers (left), 500-node for all layers (middle), 500-node for layers that exhibit barriers (layer 1-4) and 25-node for layers that exhibit monotonic decay (layer 5-8) (right). All approaches obtain $100\%$ test accuracy. Increasing the number of nodes in layers that exhibit barriers removes the presence of barriers for the overall model (blue dotted line). + +![](images/702de9cfe6d2420e4cc55c056250585b56314e5c9a89ad7c03ff8a97e2722a96.jpg) + +![](images/cf1da3464cade3ca7b4c620933adede6778a8a6b76a85e34c0567b4c7ac5d908.jpg) + +Batch normalization. In Figure A18 we show using parametergroup-wise linear interpolation that the running mean and variance batch normalization parameters appear to govern the behaviour of the full convolutional block. For the linear path of the full model, we corroborate the findings of (Lucas et al., 2021) that the use of batch normalization often leads to non-monotonic behaviour (Figure A19). In the absence of batch normalization, ResNet and VGG architectures often exhibit monotonic decay along their linear path from initial to final state. However, for various datasets we find that MLPs + +do exhibit barriers in the absence of batch normalization, see e.g., Figure A17. + +![](images/7555e406aaa18bc8dcfde635676e90f23564c9a5d72cd6bf12ef39d9ff45253e.jpg) +Figure A18. We keep all parameters of a ResNet-18 architecture fixed at their final trained position (on CIFAR-10 data), apart from specific parameter groups in the third convolutional block, which we vary from their initial to final position using the linear interpolation technique. The blue line is when the full third convolutional block is varied. The batch normalization parameters are split into two groups, the running mean and variance (red) and the others (green). + +VGG-11. In Figure A19 we show the loss along the linear path for a VGG-11 architecture on CIFAR-10 data with (left) and without (right) batch normalization. + +![](images/3ebb717d1055111d358866a5ee8720a26b14435a165d809d7fc05cd4b0247324.jpg) +Figure A19. Test loss between $\theta_{i}$ and $\theta_{f}$ for VGG-11 on CIFAR-10 when varying whether batch normalization (BN) is used. + +![](images/01688fb5843fccc7d30003a8c83be49ab3b7ba39ff66f875f933d9dfac598e78.jpg) + +Layer width: We find for a VGG-11 architecture with batch normalization on CIFAR-10 data that layers without barriers can be narrowed without affecting the generalization performance (Table A4). This does not hold for layers that do exhibit barriers along the linear path between the initial and final state. We found that this effect did not generalize to a ResNet-18 architecture, so recommend caution with using the presence or absence of layer-wise layers as an indication of which layers can be narrowed. + +Table A4. Layer-wise linear interpolation for a VGG-11 architecture with batch normalization trained from scratch on CIFAR-10 data. This architecture exhibits no barriers in the first two layers, final layer and the fully connected layer, whereas it does exhibit barriers in the five middle layers (see also Figure A19, left). We find that narrowing all non-barrier layers by half only marginally lowers the test accuracy (2nd row), whereas narrowing only one barrier layer (3rd row) already has a large impact. Narrowing two (4th row) or all barrier layers (final row) lowers the test accuracy even further. + +
InterventionTest accuracy (%)
Standard91.93 ±0.19
Narrow no-barrier layers91.73 ±0.19
Narrow 1 barrier layer91.53 ±0.20
Narrow 2 barrier layers91.25 ±0.12
Narrow all barrier layers91.15 ±0.13
\ No newline at end of file diff --git a/whatcanlinearinterpolationofneuralnetworklosslandscapestellus/images.zip b/whatcanlinearinterpolationofneuralnetworklosslandscapestellus/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..aee860488062e207e1a19898b41d702edb47cc3d --- /dev/null +++ b/whatcanlinearinterpolationofneuralnetworklosslandscapestellus/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:56942e39380bc895d31caa7fbfbb215deb8cb040112dc41bec8edc7a40632aec +size 1106187 diff --git a/whatcanlinearinterpolationofneuralnetworklosslandscapestellus/layout.json b/whatcanlinearinterpolationofneuralnetworklosslandscapestellus/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..e9d3e4e2fed278fbb01002eddd2c1cbec0152485 --- /dev/null +++ b/whatcanlinearinterpolationofneuralnetworklosslandscapestellus/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b6a127d996a274f8ebad4a4ad7c829b4dc110d038aa6b915dce3ac1aaff94897 +size 515933 diff --git a/whatdensegraphdoyouneedforselfattention/c32c6d82-fc2d-4d08-ac1f-f56b139db8e1_content_list.json b/whatdensegraphdoyouneedforselfattention/c32c6d82-fc2d-4d08-ac1f-f56b139db8e1_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..95ba2df7ad4bb41ed2d6da96b999b98db2e250f0 --- /dev/null +++ b/whatdensegraphdoyouneedforselfattention/c32c6d82-fc2d-4d08-ac1f-f56b139db8e1_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:365eee88a350ac8d7b8a4a7be0088f70c3255ccffa9de05bf539399997a49233 +size 111025 diff --git a/whatdensegraphdoyouneedforselfattention/c32c6d82-fc2d-4d08-ac1f-f56b139db8e1_model.json b/whatdensegraphdoyouneedforselfattention/c32c6d82-fc2d-4d08-ac1f-f56b139db8e1_model.json new file mode 100644 index 0000000000000000000000000000000000000000..d087f92e4120e14da692f83078ba7b052ed4f9d6 --- /dev/null +++ b/whatdensegraphdoyouneedforselfattention/c32c6d82-fc2d-4d08-ac1f-f56b139db8e1_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:14ea9f06f17b0484a7ab8530e3df5a9ea1b927635f857558b19932316871439c +size 130893 diff --git a/whatdensegraphdoyouneedforselfattention/c32c6d82-fc2d-4d08-ac1f-f56b139db8e1_origin.pdf b/whatdensegraphdoyouneedforselfattention/c32c6d82-fc2d-4d08-ac1f-f56b139db8e1_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..2b7432da026c01026449bda73cfdf7436953e0cc --- /dev/null +++ b/whatdensegraphdoyouneedforselfattention/c32c6d82-fc2d-4d08-ac1f-f56b139db8e1_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1a4ef8163aa0e02e04f29c537aef0e4bae7f97be7c21a7b3f873afef9c8d03e1 +size 1247995 diff --git a/whatdensegraphdoyouneedforselfattention/full.md b/whatdensegraphdoyouneedforselfattention/full.md new file mode 100644 index 0000000000000000000000000000000000000000..2e7a6c207c4cee52b154d4cecd4492fd99ed72ba --- /dev/null +++ b/whatdensegraphdoyouneedforselfattention/full.md @@ -0,0 +1,568 @@ +# What Dense Graph Do You Need for Self-Attention? + +Yuxing Wang12 Chu-Tak Lee1 Qipeng Guo1 Zhangyue Yin1 Yunhua Zhou1 Xuanjing Huang12 Xipeng Qiu13 + +# Abstract + +Transformers have made progress in miscellaneous tasks, but suffer from quadratic computational and memory complexities. Recent works propose sparse Transformers with attention on sparse graphs to reduce complexity and remain strong performance. While effective, the crucial parts of how dense a graph needs to be to perform well are not fully explored. In this paper, we propose Normalized Information Payload (NIP), a graph scoring function measuring information transfer on graph, which provides an analysis tool for trade-offs between performance and complexity. Guided by this theoretical analysis, we present Hypercube Transformer, a sparse Transformer that models token interactions in a hypercube and shows comparable or even better results with vanilla Transformer while yielding $O(N \log N)$ complexity with sequence length $N$ . Experiments on tasks requiring various sequence lengths lay validation for our graph function well1. + +# 1. Introduction + +In recent years, self-attention and its implementation Transformers (Vaswani et al., 2017) have achieved great success in a wide variety of Natural Language Processing (NLP) (Devlin et al., 2019; Vaswani et al., 2017; Miller, 2019; Sun et al., 2019) and Computer Vision (CV) (Yuan et al., 2021; Dosovitskiy et al., 2021) tasks. + +The key innovation of self-attention mechanism is to allow each token to interact with others directly, and thus avoid the long-term dependency problem. However, this results in + +![](images/9f08f7e6b1b2c53750c9632111da708cfb84df8957da3f236b1f211a74805a7a.jpg) +Figure 1. Attention map and its corresponding graph. + +![](images/89430016f669254035275449bad99ce9215bd4d36cc9ceb24a4d3bb5d7681e3b.jpg) + +the quadratic computational and memory complexity with the sequence length. To improve model efficiency, many lightweight Transformers are proposed (Tay et al., 2020b; Lin et al., 2021). Among them, sparse Transformers (Zaheer et al., 2021; Beltagy et al., 2020; Child et al., 2019; Guo et al., 2019) utilize sparse attention in the self-attention mechanism including global attention, window attention or rule-based sparse attention. + +Previous works view sparse attention as self-attention on sparse graphs. Figure 1 shows typical sparse attention map and its corresponding graph. Vanilla self-attention can be regarded as a complete graph. Although these Sparse Transformers have made progress, there still remains some questions: which property is important for those graphs serving as ground for self-attention? How dense do we need the graph to be in order to reduce complexity and at the same time remain performance? While some (Zaheer et al., 2021; Chen et al., 2021) showed theoretical analysis for existing sparse self-attention, they do not provide a general analysis tool for comparing different sparse patterns. + +To investigate further into differences between sparse patterns, we need theoretical analysis based on sparse graphs. In this paper, we propose Normalized Information Payload (NIP), a graph scoring function to measure information transfer on a given graph. Our function can also be applied to analyze previous sparse patterns and provide insights for their empirical results. Guided with our proposed function, we further present Hypercube Transformer which adapts hypercube into self-attention and achieves great balance between performance and computation costs. Experiments in long-context sequence modeling and large-corpus pretrained + +ing show that Hypercube Transformer is competitive both theoretically and practically. + +The contributions of our paper can be summarized as follows: + +- We propose Normalized Information Payload (NIP), a graph scoring function that tries to investigate important properties of graph used in self-attention. This function provides theoretical analysis tools for performance and complexity of different graphs used in position-based sparse self-attention. +- Guided with our theoretical analysis, we present Hypercube Transformer, which can behave competitively compared to vanilla Transformer in various tasks and better in long context tasks while requiring less time and computation. + +# 2. Graph Scoring Function for Balancing Costs and Performance + +What Dense Graph Do We Need? Self-attention (vanilla and sparse) can be viewed as attention-based information transfer on graphs. While many sparse patterns based on sparse graphs have been presented, there still remains questions: what is important for a sparse graph in self-attention? What dense graph do we need for self-attention? How dense is optimal for the graph to balance cost and performance? To answer these questions, we propose Normalized Information Payload, a graph scoring function to score any graphs used for self-attention. + +# 2.1. Normalized Information Payload + +Generally, we expect our model to grab all interactions among tokens. Sparse attentions indirectly capture these interactions by multi-layer information transfer. That comes to two questions: what costs do we pay for grabbing these interactions and how much information can be transferred? To answer these questions respectively, we consider graphs in two aspects: Computational Complexity and Information Payload. + +Computational Complexity. Computational Complexity (CC) of a graph $G$ , denoted by $\operatorname{CC}(G)$ , is the computation complexity required to allow the model to grab all interactions among tokens when using graph $G$ for self-attention. The requirement for graph $G$ used here is that $G$ is connected. Lower Computational Complexity of a graph makes the whole model less computational expensive. + +Information Payload. The amount of information transfer is also important. For instance, sequence models like LSTMs (Hochreiter & Schmidhuber, 1997) is able to transfer information in a long sequence but suffers from long- + +term dependency and low information capacity. So we introduce Information Payload (IP) for a graph $G$ , denoted by $\mathrm{IP}(G)$ , measuring how much information a graph can transfer when allowing the model to grab all interactions among tokens. Higher Information Payload of a graph enables the whole model to grab more information. + +To better compare information transfer on different graphs, we define the Normalized Information Payload for a graph $G$ , denoted by $\mathrm{NIP}(G)$ , as follows, + +$$ +\operatorname {N I P} (G) := \frac {\operatorname {I P} (G)}{\operatorname {C C} (G)}. \tag {1} +$$ + +The higher $\mathrm{IP}(G)$ is, the more information a graph can transfer. The lower $\mathrm{CC}(G)$ is, the less computational resources the graph costs, which also means that the graph can be used to model long sequences. And the higher score of $\mathrm{NIP}(G)$ implies the graph can perform well in real-world tasks. This is consistent with our observations in experiments. Then we will demonstrate how these two components of our function are defined in detail and show how previous works like BigBird fit our function. For a self-attention layer on graph $G$ , we denote it by $G$ -attention layer briefly. + +# 2.1.1.COMPUTATIONAL COMPLEXITY + +Computational Complexity is related to grabbing all interactions among tokens. Given a $G$ -attention layer, to make the whole model grab all interactions among tokens, we need to stack $\kappa(G)$ $G$ -attention layers. Straightforwardly, $\kappa(G)$ is the diameter of graph $G$ . And for one $G$ -attention layer, the Computational Complexity is proportional to the total number of edges in $G$ . When the input sequence is fixed at length $N$ , the Computational Complexity for one layer is proportional to the mean degree of $G$ , which we denoted by $\rho(G)$ here. Intuitively $\rho(G)$ measures the complexity of the graph itself and $\kappa(G)$ is how many times we forward the graph. + +Definition 2.1. Let Computational Complexity CC for a given graph $G$ be + +$$ +\mathbf {C C} (G) := \rho (G) \times \kappa (G). \tag {2} +$$ + +$\mathbf{CC}(G)$ shows the minimum computation costs to ensure information exchange for every node pair in a graph. + +# 2.1.2. INFORMATION PAYLOAD + +To capture all interactions among tokens is not enough, we have to take into account how much information a graph can transfer after that. Information Payload is introduced to measure it. First we examine how information transfer is like in self-attention. Since we have Softmax operation in self-attention mechanism acting as normalization, it is straightforward to set the total amount of information a + +Table 1. Normalized Information Payload for commonly used graphs, where $w$ is the number of neighbors in ring lattice. $\star \colon \Theta \left( \frac{1}{N^2} \right)$ after refinement. + +
Type of graphCC(G) ↓IP(G) ↑NIP(G) ↑
CompleteΘ(N)Θ(1/N)Θ(1/N2)
E-R randomΘ(log2N)Θ((N-2)/(N log N (N-log N))Θ((N-2)/(N-log N)/N log N log2(N))
TreeΘ(log N)Θ(1/N log(9))Θ(1/N log(9) log N)
StarΘ(1)Θ(1/N)Θ(1/N)★
Ring lattice + E-R randomΘ(log N(log N+w))Θ((N-2)/(N+ω/(N+ω log N) log N (N-log N))Θ((N-2)/(N-log N)/(N+ω log N) log N log N(log N+w))
Ring lattice + Star (Longformer)Θ(w)Θ(1/Nw)Θ(1/Nw2)
Ring lattice + Star + E-R random (BigBird)Θ(log N+w)Θ(1/N(log N+w))Θ(1/N(log N+w)2)
HypercubeΘ(log2N)Θ(log N)/(log N log N)Θ(log N)/(log N log N+2)
+ +![](images/29225bf0526af67b63a330eca4cd9312e492628bf1c2d5594acfedf50d7b8374.jpg) +Figure 2. $\mathrm{NIP}(G)$ for graphs divided by complete graph in Table 1. We do not include star graph and ring lattice in this Figure because $\mathrm{NIP}(G)$ for star graph is too large. The $w$ used for ring lattice is set to $\frac{N}{16}$ according to Longformer at length 4096. + +node can receive as one unit of information. For one node $i$ with degree $deg(i)$ , the average information it can receive is $\frac{1}{deg(i)}$ , so the total Information Payload for one path is related to all end nodes on the path. + +Notation. Given a graph $G(\mathcal{V}, \mathcal{E})$ , and nodes $a, b$ , let $\mathcal{P}_{ab}$ be the set of all paths that start with node $a$ and end with node $b$ and have length equal to the distance between node $a$ and node $b$ . For one path $P_{ab} \in \mathcal{P}_{ab}$ , $\text{len}(P_{ab})$ is the length of $P_{ab}$ . For one node $i$ , we use $\text{deg}(i)$ to denote the degree of it. + +Definition 2.2. For one path $P_{ab} \in \mathcal{P}_{ab}$ , the Information Payload of one path $P_{ab}$ , denoted by $R(P_{ab})$ , is defined as + +$$ +R \left(P _ {a b}\right) := \prod_ {\substack {v \in P _ {a b} \& v \neq a}} \frac {1}{\deg (v)}. \tag{3} +$$ + +Next we define the Information Payload between node $a$ and node $b$ . + +Definition 2.3. The Information Payload between node pair $(a, b)$ , denoted by $I_{ab}$ is sum of Information Payload of all paths that belong to $\mathcal{P}_{ab}$ : + +$$ +I _ {a b} = \sum_ {P _ {a b} \in \mathcal {P} _ {a b}} R (P _ {a b}). \tag {4} +$$ + +Note that $\frac{1}{k_i}$ is equal to the probability that a random walk starts from the node itself to any of its neighbors, which makes our Information Payload closely related to random walk on graphs. + +Relationship between Information Payload and Random Walk. Our Information Payload is deduced from self-attention forward, which is closely related to random walk. We show in Figure 3 that self-attention is like reversed random walk. In Figure 3, each column shows a $G$ -attention layer and we have $t$ layers. For $G$ used here, we present three nodes $a, b, c$ and edges $(a, b), (a, c)$ and self-loop of three nodes. Figure 3(a) shows the updating of $G$ -attention layers. The red paths show the information transferred from node $a$ to node $c$ . In Figure 3(b), blue paths show the random walk starts from node $c$ to node $a$ . We can see that the Information Payload from node $a$ to node $c$ after $t$ layers is equal to the probability of a random walk starting from node $c$ ends in node $a$ at the $t$ th step. We demonstrate it in the theorem below in detail. + +Theorem 2.4. Information Payload between two nodes $I_{ab}$ equals to the probability of a random walk starts from node $b$ that ends in node $a$ at step $\text{len}(P_{ab})$ . + +Proof of theorem 2.4 and calculating $I_{ab}$ via random walk is in Appendix B.1. + +![](images/0d1a09e33c0ad9a3754e1dbd9c2386673889306f7a2d1b2d82432a3d85108a02.jpg) +(a) Attention forward + +![](images/eca442ee4b93045ff223095c2546a2acace9ca51bf8c497f8a3fd5997bfeea67.jpg) +(b) Random walk +Figure 3. Relationship between $G$ -attention layer and random walk. Red lines in Figure (a) show attention forward from node $a$ to node $c$ across $t$ layers while blue lines in Figure (b) show random walk starting from node $c$ to node $a$ . + +Note that the probability of a random walk starts from $b$ that ends in $a$ within $\text{len}(P_{ab})$ steps equals to zero. Thus $I_{ab}$ measures the amount of information when information flow first reaches node $a$ from node $b$ . + +Since we have defined the Information Payload between two nodes, the Information Payload for the whole graph is chosen to the Information Payload between node pairs $(a,b)$ whose distance is the diameter of the graph. + +Definition 2.5. The Information Payload for a graph $G$ $\mathrm{IP}(G)$ is the smallest Information Payload $I_{ab}$ between node pairs $(a,b)$ whose distance is the diameter of the graph. Let $\Delta$ be the set of node pairs whose distance is the diameter of the graph, we have + +$$ +\operatorname {I P} (G) := \min _ {(a, b) \in \Delta} I _ {a b}. \tag {5} +$$ + +We consider the minimum Information Payload for node pair $(a, b)$ whose distance is the diameter, so we choose the smallest value to guarantee the lower bound of Information Payload, which is motivated by the theory of the Cannikin Law (Li et al., 2019), that the capacity of the wooden bucket is limited by the height of its shortest plank. + +# 2.1.3.DISCUSSION + +Table 1 lists $\mathrm{CC}(G)$ , $\mathrm{IP}(G)$ and $\mathrm{NIP}(G)$ for commonly used graphs2. The detailed computation is in Appendix A. + +Self-loop. In self-attention, a token can always attend to itself, meaning that all graphs have self-loop. $\mathrm{IP}(G)$ use node pair whose distance is the diameter of the graph, so self-loop does not affect its value much. Also $\operatorname{CC}(G)$ does not change much even if we have a large number of nodes. Thus $\mathrm{NIP}(G)$ does not change much compared to graphs without self-loop. + +Markov Chains. In self-attention, the information updating for a node is not uniform with its neighbors but dependent on representations of all relative nodes, which is not the case + +of normal random walk. However, previous analysis (Clark et al., 2019) on BERT attention shows that some attention heads, especially in lower layers, have very broad attention. Since information in lower layers is closer to the input and is important, we set the uniform distribution of attention weights and this setting is also the situation of random initialization. Also, viewing random walk as Markov chains can bring insights into this situation. If we let the transition matrix in Markov chains be attention-based, then normal random walk becomes attention-based random walk, which is suitable for self-attention. + +# 2.2. Case study + +To make $\mathrm{NIP}(G)$ clear, we show in Figure 2 all the $\mathrm{NIP}(G)$ in Table 1 except star graph. Because $\mathrm{NIP}(G)$ for star graph is too large. + +# Star graph. + +Star graph has the highest $\mathrm{NIP}(G)$ , however, huge amounts of information flow through the global node can cause a bottleneck of information transfer. This bottleneck reduces the Information Payload of star graph to $\frac{1}{N - 1}$ of the original one because $N - 1$ local nodes versus one global node. Thus, the refined $\mathrm{NIP}(G)$ of star graph is $\Theta\left(\frac{1}{N^2}\right)$ . + +Ring lattice. Ring lattice is often used in self-attention known as window attention or local attention. It is usually combined with other attention patterns so we compute NIP for its mixtures. Most of attention occupies in neighborhoods (Cui et al., 2019), which makes previous sparse patterns adapting it reasonable. + +Random graphs. We compute the expected values for random graphs in this paper. For the Erdős–Rényi (E-R) random graph used in BigBird, if the probability of every edge to exist is $p$ , the E-R random graph is highly possibly connected if $p > \frac{(1 + \epsilon)\ln(N)}{N}$ . This means that to make connected random graphs with high probability, the average degree of the graph is more than $\frac{(1 + \epsilon)\ln(N)(N - 1)}{2N}$ . We use the lower bound and set $p$ to $\Theta\left(\frac{\log N}{N}\right)$ here. We limit the choice of random graphs in this paper to E-R random graph because it has been applied in self-attention. + +BigBird, Longformer and mixed graphs. BigBird is mixed from star graph, ring lattice and random graph, while Longformer is only mixed from star graph and ring lattice. For BigBird, because of random graph, we compute the expected $\mathrm{NIP}(G)$ for a given graph $G$ . We use the settings for random graph as we mentioned in above paragraph. We have shown that adding random graph to Longformer like BigBird not necessarily improves the Normalized Information Payload for the graph because it makes the graph more complex and reduces the expectation Information Payload. While such observation is counterintuitive, the BigBird-ETC + +![](images/a0e73cee98c0698e1ccc53e96be6f6d119aa6ce2beb0b42af19e6e9ffeac2b66.jpg) +Figure 4. Iteratively mapping a sequence to a hypercube and its attention mask. Figure (a), (b) and (c) is the attention map for input sequences with length $N = 2, 4, 8$ respectively. + +![](images/4a1fc869a8fbc6aa81723cc7c13e3740b54954895017dca76ab3f44783f9420d.jpg) +Figure 5. Unpacking a hypercube to a sequence. Tokens that are neighbors in hypercube are also neighbors in a sequence. + +which is sota in BigBird models also despose random attention. Our ablation studies in the experiment section (in Table 2) also demonstrate that mixing Longformer with random attention does not necessarily improve the performance. + +# 3. Hypercube Transformer + +Guided with our Normalized Information Payload, we aim to find better graphs for self-attention and present Hypercube Transformer. Like vanilla Transformer, our Hypercube Transformer utilize positional embeddings to catch positional information. + +# 3.1. Hypercube + +The global node in star graph is very important but suffers from information interference as mentioned before. Hence we search for regular graphs with no inductive bias to alle + +viate information interference. An observation for complete graph is that the shortest distance between two neighbors' neighbors (excluding two nodes themselves) equals to zero, meaning that every two neighbor has the same neighbor. We propose a graph in which this distance equals to one, which makes the whole graph much sparser while maintaining the connectivity of the graph, and that graph is hypercube. + +After our computation, hypercube is potential according to our Normalized Information Payload. It has Normalized Information Payload larger than other sparse graphs except star graph as shown in Figure 2. At the same time, small $\mathrm{CC}(G)$ means hypercube can be applied to long sequences. Also, in parallel computing, hypercube is one of the most useful communication structures which encounters not much communication interference. + +# 3.2. Mapping Sequences to Hypercube + +Although we show that hypercube is potential in Normalized Information Payload, it's hard to apply it to real-world tasks if we can't map sequences to hypercube. Generally, we suggest a mapping method have two good properties: maintaining the original neighborhoods in sequences and easy to be extended to longer sequences. One example of unpacking hypercube to sequence is shown in Figure 5. Here we propose a novel iterative binary-number-based mapping from sequence to hypercube. We show this iterative binary mapping algorithm in Appendix B.3. We also show the iterative mapping pipeline and its attention map in Figure 4. + +If the dimension of binary numbers is $k$ , the final binary representation for token with index $i$ ( $X_{i} :=$ + +$$ +\begin{array}{l} X _ {i} ^ {k - 1} X _ {i} ^ {k - 2} \dots X _ {i} ^ {1} X _ {i} ^ {0}, i \in [ 0, N - 1 ]) \text {i s g i v e n b y} \\ X _ {i} ^ {d} = \left(\lfloor \frac {i \mod 2 ^ {k - d + 1}}{2 ^ {k - d}} \rfloor + \lfloor \frac {i \mod 2 ^ {k - d}}{2 ^ {k - d - 1}} \rfloor\right) \quad \text {m o d} 2, \tag {6} \\ \end{array} +$$ + +where $\lfloor x\rfloor$ means the largest integer smaller than $x$ . We denote the set of representation that has only one digit different from $X_{i}$ by $\mathcal{N}(X_i)$ . After we got $X_{i}$ for every token with index $i$ , we can easily draw the attention map by the rule that one token with representation $X_{i}$ can only attend to tokens with representation $X_{j}\in \mathcal{N}(X_{i})$ . + +# 3.3. Block Sparsity + +Block sparse pattern is introduced by (Gray et al., 2017) to tackle hardware problems for efficient calculating. It splits the sequence into several blocks and impose sparse patterns on blocks instead of tokens. Tokens can attend to every token in the same block and the block its block can attend to. Adapting block sparse lowers the sparsity of graph and intensifies information passing when the number of $G$ -attention layer is fixed. While all sparse patterns adapt block sparse, we don't compare those patterns after adapting block sparse. However, we consider how block sparse have effects on sparse patterns and we have the theorem below. + +Theorem 3.1. For block size $b \leq \frac{N}{2}$ , larger block size makes star graph and hypercube have less Normalized Information Payload. + +We put the proof in Appendix B.2. Although block sparse reduces Normalized Information Payload in most situation, we still adapt it in our experiment section for the sake of training efficiency. + +# 4. Experiments + +Experiments are conducted to validate theoretical results of Normalized Information Payload and then show performances of Hypercube Transformer. All experiments are conducted on RTX 3090 GPU. In detail, We implement all Sparse Transformers with self-loop and block sparse using triton (Tillet et al., 2019). We choose to conduct experiments mainly on block size 16 which is the smallest size allowed for triton. Recent work (Guo et al., 2021) also shows that block size 16 is cost effective on long range text tasks. + +# 4.1. $\mathbf{NIP}(G)$ and Performance on LRA + +To validate Normalized Information Payload, we focus on how our Normalized Information Payload is related to real-world situations. We rely on Long Range Arena (LRA) benchmark (Tay et al., 2020a) for validation for our graph scoring function, $\mathrm{NIP}(G)$ . Long Range Arena is a benchmark testing how well a model can capture long range dependencies with tasks with input lengths varied from 1024 + +to 4096. By deliberately making the task harder, such as training text on byte level and image on pixel level, LRA serves as a systematic and popular proxy for performance to computational efficiency. In our case, LRA restricts models to have equal or less than four layers, making it a good test bed for layer efficiency. We choose several different graphs and apply them on $G$ -attention layers in Transformer to evaluate performance. + +Implementation details. For the sake of consistency and simplicity, we do not strictly follow setting in the official implementation. Instead we use a four-layer network, in which every two layers with shared parameters for all tasks. All hyper-parameters are listed in Table 9 in Appendix C. Empirically we find that our architecture has fewer parameters than the original paper. We follow optimization configuration in (Ma et al., 2021) and run experiments for different sparse graphs listed in Table 1. Results for our experiments and Normalized Information Payload according to Table 1 with $N = 2048$ are in Table 2. We run each experiment for three times with different random seeds and report the average accuracy. + +![](images/87ddb4ddbb57b91c3abec4dd1601a9fc673946be5a132a41754b4e2bdc63d596.jpg) +Figure 6. Average performance on the LRA benchmark can have strong proposition with our proposed Normalized Information Payload. + +Results. In Table 2, we observe that Hypercube Transformer outperforms all other graphs including complete graph in average. Apart from star graph, which suffers from information interference in the global node and results in learning problems, other graphs' performance fits Normalized Information Payload well. We draw the average performance of various graphs on the LRA benchmark to $\mathrm{NIP}(G)$ in Figure 6 for these graphs. The average performance is strongly proportional to Normalized Information Payload in that the Pearson Correlation Coefficient between two variables is equal to 0.96, which lays validation for our graph scoring function well. + +Speedup. For speedup, we only report the training speedup of hypercube compared to complete graph at 4096 length. We do not compare hypercube with other sparse patterns + +Table 2. Performances for different graphs on Long-Range Arena. $\star$ means after refinement. + +
Graph +#LengthListOps +2KText +4KRetrieval +4KImage +1KPathfinder +1KAvg.NIP(G)SpeedUp
Complete37.2063.5481.0047.2374.3960.671×1×
Star37.5863.3779.7152.1966.9259.951×*-
Ring lattice + E-R random36.4463.8180.1750.8867.1459.691.43e-10×-
Ring lattice + Star (Longformer)37.5561.1280.5352.1368.6660.008.25e-2×-
Ring lattice + Star + E-R random (BigBird)37.8062.3479.4952.8767.4459.997.21e-2×-
Hypercube37.4863.7981.1653.7974.1262.074.85×15.8×
+ +because to make fair comparison between BigBird pattern and hypercube, we choose the number of blocks for each pattern to be the same. Therefore, the speedup of two sparse patterns are close. Detailed block numbers are listed in Appendix C. + +Table 3. Performance of Hypercube Transformer with different block sizes. + +
HypercubeRetrievalImage
Block size 1681.1653.79
Block size 3280.7451.98
Block size 6480.7550.75
+ +Block size impact. From Table 2, we find that Retrieval and Image can differentiate graphs better among five sub-tasks. So to validate theory 3.1, we investigate how block size affects performance empirically on these two sub-tasks of LRA. In Table 3, we find that larger the block size, lower the performance is, which is corresponding to our theory 3.1 that larger block size will result in lower Normalized Information Payload. + +# 4.2. Long-Context Sequence Modeling + +To show the effectiveness of Hypercube Transformer, we present the performances of previous works on LRA briefly in Table 4. Compared to recent Fnet (Lee-Thorp et al., 2021), Nystromformer (Xiong et al., 2021), LUNA (Ma et al., 2021), H-Transformer-1D (Zhu & Soricut, 2021), Pixelfly (Chen et al., 2021), our Hypercube Transformer achieves better average performance while using architecture with fewer parameters. H-Transformer-1D has very good performance on NLP tasks because their hierarchical method provides inductive bias for natural language. Hypercube Transformer improves the result of Image by a large margin because hypercube is like high-dimensional view of a picture and can catch more information. In summary, Hypercube Transformer shows potential for models only based on sparse graphs that can grab all interactions among tokens. + +Table 4. Performances for different models on Long Range Arena. The performance of previous works in the first area are from (Tay et al., 2020a). + +
Model +#LengthListOpsRetrievalImage Path. Avg.
2K4K4K1K1K
Transformer36.3764.2757.4642.4471.4054.39
Local Attention15.8252.9853.3941.4666.6346.06
Sparse Trans.17.0763.5859.5944.2471.7151.24
Longformer35.6362.8556.8942.2269.7153.46
Linformer35.7053.9452.2738.5676.3451.36
Reformer37.2756.1053.4038.0768.5050.67
Sinkhorn Trans.33.6761.2053.8341.2367.4551.39
Synthesizer36.9961.6854.6741.6169.4552.88
BigBird36.0564.0259.2940.8374.8755.01
Linear Trans.16.1365.9053.0942.3475.3050.55
Performer18.0165.4053.8242.7777.0551.41
Fnet35.3365.1159.6138.6777.8055.30
H-Trans.-1D49.5378.6963.9946.0568.7861.41
Nystromformer37.1565.5279.5641.5870.9458.95
Luna-25637.9865.7879.5647.8678.5561.95
Pixelfly37.6566.7880.5542.3572.0159.86
Hypercube +Trans.37.4863.7981.1653.7974.1262.07
+ +# 4.3. Masked Language Modeling for Large-Scale Pretraining + +One important application of Transformer is Large-Scale Pretraining like BERT (Devlin et al., 2019). Here we follow (Devlin et al., 2019; Izsak et al., 2021) to pretrain Hypercube Transformer from scratch, denoted by CubeBERT, and finetune it on downstream tasks. We denote the original BERT-large by BERT, our pretrained BERT-large with 128 length by $\mathrm{BERT}_{128}$ , and our pretrained CubeBERT-large with 128 length by $\mathrm{CubeBERT}_{128}$ . The detailed structure of CubeBERT is the same as BERT and experimental details are provided in Appendix C. We use English Wikipedia and BookCorpus2 (Gao et al., 2020) as our pretraining datasets. + +Finetuning on longer contexts. We first finetune $\mathrm{BERT}_{128}$ and $\mathrm{CubeBERT}_{128}$ on a language model dataset Wikitext103 that could model sequences at 512 length to show the strong + +Table 5. Finetuning MLM on Wikitext103. + +
ModelLossSpeedup
BERT1281.181×
CubeBERT1281.051.4×
+ +![](images/c2d21b5a254b6714fc688c502a7b9b04ece02ebd2f361f6234ffc1eb8b55fc3e.jpg) +Figure 7. CubeBERT $_{128}$ shows faster dropping rate of eval loss than $\mathrm{BERT}_{128}$ when finetuning on Wikitext103. + +generalization ability of Hypercube Transformer. We initiate the position embeddings out of 128 randomly and finetune $\mathrm{BERT}_{128}$ and $\mathrm{CubeBERT}_{128}$ in a Masked Language Model (MLM) way, results are provided in Table 5. We can see that the MLM loss (perplexity) of finetuned $\mathrm{CubeBERT}_{128}$ (1.05) is lower than that (1.18) of our $\mathrm{BERT}_{128}$ , demonstrating the better generalization ability of Hypercube Transformer than vanilla one. At the same time, attribute to sparse attention, $\mathrm{CubeBERT}_{128}$ still has a $1.4\mathrm{x}$ speedup compared to $\mathrm{BERT}_{128}$ at the training stage of finetuning. Another interesting finding is that the evaluation loss of $\mathrm{CubeBERT}_{128}$ drops faster than $\mathrm{BERT}_{128}$ , implying that Hypercube Transformer could learn faster for training short and finetuning long in certain circumstances. + +Finetuning on GLUE. For downstream tasks at 128 length, we finetune CubeBERT $_{128}$ on GLUE benchmark and compare CubeBERT $_{128}$ with BERT. Results are reported in Table 6. To do fair comparison, we also provide finetuning results for our reimplemented BERT $_{128}$ . We observe that CubeBERT $_{128}$ achieves comparable performance without global attention routing information directly to [CLS] token. This demonstrate Hypercube sparsity is effective on information passing on graph. In detail, our CubeBERT $_{128}$ can have on par performance with BERT in most tasks (MNLI, QQP, SST-2, CoLA, STS-B), all with differences less than 1 point. For rest tasks like QNLI, RTE and MRPC, CubeBERT $_{128}$ is lower than BERT in 2 points except MRPC which has the smallest number of dataset examples. Overall, the average performance of CubeBERT $_{128}$ is slightly lower than BERT within 1 point and higher than BERT $_{128}$ . The speedup for CubeBERT $_{128}$ is measured at the training train + +ing for finetuning GLUE. Because of the sequence length is 128, speedup is $1.1\mathrm{x}$ , which is not remarkable compared to $1.4\mathrm{x}$ for sequence at 512 length. + +# 5. Related Work + +To the best of our knowledge, our paper is related to sparse attention and their analysis. + +Theoretical Analysis. Previous works mainly focus on the approximation of sparse attention to vanilla attention. BigBird (Zaheer et al., 2021) first proved sparse attention mechanism defined by any graph containing star graph is a universal approximator. They also showed Turing Completeness of sparse encoder and sparse decoder. Pixelated Butterfly (Chen et al., 2021) proved their flat butterfly matrices can approximate butterfly matrices which can tightly represent all structured matrices. Our paper focuses on finding graphs with better properties, not graphs to approximate complete graph. Axial Attention (Ho et al., 2019) mentioned having the full receptive field, which is similar to grabbing all interactions among tokens in the paper. (Li et al., 2019) proposed Information Capacity between two nodes based on the path transferring least information while we propose Information Payload based on all paths between two nodes. + +Sparse Attention. Previous Transformers adapt sparse attention including Star Transformer (Guo et al., 2019), Sparse Transformer (Child et al., 2019), Longformer (Beltagy et al., 2020) and BigBird (Zaheer et al., 2021). Compared to all those patterns, our proposed Hypercube Transformer adapts a fixed simple sparse pattern and is easy to implement. The recent flat butterfly pattern (Chen et al., 2021) is also another simple sparse pattern with $O(N \log N)$ complexity with input length $N$ . NAS has been applied to learning sparse patterns like SparseBERT (Shi et al., 2021), but searching methods cannot be applied to long-context tasks. Besides, their learned sparse patterns are data-dependent and cannot generalize. + +# 6. Conclusion + +We have introduced Normalized Information Payload (NIP), a graph scoring function for various graphs used in Transformer attention mechanism. By taking Computational Complexity and Information Payload into consideration, we can analyze sparse graphs via NIP to find what dense graph do we need for self-attention. After examining existed sparse patterns with NIP, we further present hypercube and utilize it in simple masked-based sparse Transformer. Hypercube Transformer achieves comparable or even better performances compared to strong baselines in pretrain tasks in NLP and long-context sequence modeling while reducing the usage of memory and computation. Experiments on different graphs on LRA benchmark also lay validation for + +Table 6. Performances on GLUE test sets. For our implementation, results for RTE, STS and MRPC are reported by first finetuning on the MNLI model instead of the baseline pretrained model. + +
#metric #ExamplesMNLI-m/mm Acc 393kQNLI Acc 105kQQP F1 364kRTE Acc 2.5kSST-2 Acc 67kMRPC F1 3.7kCoLA Matthew's corr. 8.5kSTS-B Spearman corr. 7kAvg. Speedup
BERT86.0/85.292.672.078.394.589.960.987.583.01×
BERT12884.9/84.891.171.076.693.190.458.088.382.01×
CubeBERT12885.9/85.090.871.377.195.386.461.587.682.31.1×
+ +Normalized Information Payload well. We hope our graph scoring function will reveal important parts behind different sparse patterns. In future work, we may utilize hypercube structure in other modules like MLPs. Another potential direction is to apply Hypercube Transformer to NLP tasks requiring long-context modeling like summarization and question answering. + +# Acknowledgements + +This work was supported by the National Key Research and Development Program of China (No. 2020AAA0108702), the National Natural Science Foundation of China (No. 62022027) and the major key project of PCL (No. PCL2021A12). + +# References + +Beltagy, I., Peters, M. E., and Cohan, A. Longformer: The long-document transformer, 2020. +Chen, B., Dao, T., Liang, K., Yang, J., Song, Z., Rudra, A., and Re, C. Pixelated butterfly: Simple and efficient sparse training for neural network models, 2021. +Child, R., Gray, S., Radford, A., and Sutskever, I. Generating long sequences with sparse transformers, 2019. +Chung, F. and Lu, L. The average distances in random graphs with given expected degrees. Proceedings of the National Academy of Sciences, 99(25): 15879-15882, 2002. ISSN 0027-8424. doi: 10.1073/pnas.252631999. URL https://www.pnas.org/content/99/25/15879. +Clark, K., Khandelwal, U., Levy, O., and Manning, C. D. What does bert look at? an analysis of bert's attention, 2019. URL https://arxiv.org/abs/1906.04341. +Cui, B., Li, Y., Chen, M., and Zhang, Z. Fine-tune BERT with sparse self-attention mechanism. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing + +(EMNLP-IJCNLP), pp. 3548-3553, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1361. URL https://aclanthology.org/D19-1361. +Devlin, J., Chang, M.-W., Lee, K., and Toutanova, K. Bert: Pre-training of deep bidirectional transformers for language understanding, 2019. +Dosovitskiy, A., Beyer, L., Kolesnikov, A., Weissenborn, D., Zhai, X., Unterthiner, T., Dehghani, M., Minderer, M., Heigold, G., Gelly, S., Uszkoreit, J., and Houlsby, N. An image is worth 16x16 words: Transformers for image recognition at scale, 2021. +Gao, L., Biderman, S., Black, S., Golding, L., Hoppe, T., Foster, C., Phang, J., He, H., Thite, A., Nabeshima, N., Presser, S., and Leahy, C. The pile: An 800gb dataset of diverse text for language modeling, 2020. +Gray, S., Radford, A., and Kingma, D. P. GPU kernels for block-sparse weights. arXiv preprint arXiv:1711.09224, 3:2, 2017. +Guo, M., Ainslie, J., Uthus, D., Ontanon, S., Ni, J., Sung, Y.-H., and Yang, Y. Longt5: Efficient text-to-text transformer for long sequences, 2021. +Guo, Q., Qiu, X., Liu, P., Shao, Y., Xue, X., and Zhang, Z. Star-transformer. In Proceedings of HLT-NAACL, pp. 1315-1325, 2019. URL https://www.aclweb.org/anthology/N19-1133. +Ho, J., Kalchbrenner, N., Weissenborn, D., and Salimans, T. Axial attention in multidimensional transformers, 2019. +Hochreiter, S. and Schmidhuber, J. Long short-term memory. Neural Computation, 9(8):1735-1780, 1997. +Izsak, P., Berchansky, M., and Levy, O. How to train bert with an academic budget, 2021. +Katzav, E., Biham, O., and Hartmann, A. K. Distribution of shortest path lengths in subcritical erdos-renyi networks. Physical Review E, 98(1):012301, 2018. + +Lee-Thorp, J., Ainslie, J., Eckstein, I., and Ontanon, S. Fnet: Mixing tokens with fourier transforms, 2021. +Li, X., Liu, S., Chen, H., and Wang, K. A potential information capacity index for link prediction of complex networks based on the cannikin law. Entropy, 21 (9), 2019. ISSN 1099-4300. doi: 10.3390/e21090863. URL https://www.mdpi.com/1099-4300/21/9/863. +Lin, T., Wang, Y., Liu, X., and Qiu, X. A survey of transformers, 2021. +Ma, X., Kong, X., Wang, S., Zhou, C., May, J., Ma, H., and Zettlemoyer, L. Luna: Linear unified nested attention, 2021. +Miller, D. Leveraging bert for extractive text summarization on lectures, 2019. +Shi, H., Gao, J., Ren, X., Xu, H., Liang, X., Li, Z., and Kwok, J. T. Sparsebert: Rethinking the importance analysis in self-attention, 2021. URL https://arxiv.org/abs/2102.12871. +Sun, C., Huang, L., and Qiu, X. Utilizing bert for aspect-based sentiment analysis via constructing auxiliary sentence, 2019. +Tay, Y., Dehghani, M., Abnar, S., Shen, Y., Bahri, D., Pham, P., Rao, J., Yang, L., Ruder, S., and Metzler, D. Long range arena: A benchmark for efficient transformers, 2020a. +Tay, Y., Dehghani, M., Bahri, D., and Metzler, D. Efficient transformers: A survey, 2020b. +Tillet, P., Kung, H. T., and Cox, D. Triton: An Intermediate Language and Compiler for Tiled Neural Network Computations, pp. 10-19. Association for Computing Machinery, New York, NY, USA, 2019. ISBN 9781450367196. URL https://doi.org/10.1145/3315508.3329973. +Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, L., and Polosukhin, I. Attention is all you need, 2017. +Xiong, Y., Zeng, Z., Chakraborty, R., Tan, M., Fung, G., Li, Y., and Singh, V. Nyströmformer: A nyström-based algorithm for approximating self-attention, 2021. +Yuan, L., Chen, Y., Wang, T., Yu, W., Shi, Y., Jiang, Z., Tay, F. E., Feng, J., and Yan, S. Tokens-to-token vit: Training vision transformers from scratch onImagenet, 2021. +Zaheer, M., Guruganesh, G., Dubey, A., Ainslie, J., Alberti, C., Ontanon, S., Pham, P., Ravula, A., Wang, Q., Yang, L., and Ahmed, A. Big bird: Transformers for longer sequences, 2021. + +Zhu, Z. and Soricut, R. H-transformer-1d: Fast one-dimensional hierarchical attention for sequences, 2021. + +# A. Computation for Normalized Information Payload + +Since computation for $\mathrm{NIP}(G)$ is related to $\mathrm{CC}(G)$ and $\mathrm{IP}(G)$ , we respectively show these two parts. + +# A.1. Computation for $\mathbf{CC}(G)$ + +We compute $\rho(G)$ and $\kappa(G)$ to get $\operatorname{CC}(G)$ . For all graphs, $\rho(G)$ can be computed easily through definition. For E-R random graph, we choose the probability of every edge to exist $p$ to be $\Theta\left(\frac{\log N}{N}\right)$ for the sake of connectivity. $\kappa(G)$ is the diameter of the graph, which can be straightforwardly computed by definition of graphs. For E-R random graph, the shortest path between any two nodes is logarithmic in the number of nodes (Chung & Lu, 2002; Katzav et al., 2018), thus it equals to $\Theta(\log N)$ . For $w$ used in ring lattice, we assume $w \ll N$ for approximation. + +$\rho (G),\kappa (G)$ and $\mathbf{CC}(G)$ for graphs in Table 1 are listed in Table 7. + +Table 7. $\rho (G),\kappa (G)$ and $\mathbb{C}\mathbb{C}(G)$ for graphs in Table 1, where $w$ is the number of neighbors of a ring lattice. + +
Type of graphρ(G)κ(G)CC(G)
CompleteΘ(N)Θ(1)Θ(N)
E-R randomΘ(log N)Θ(log N)Θ(log2N)
TreeΘ(1)Θ(log N)Θ(log N)
StarΘ(1)Θ(1)Θ(1)
Ring lattice + E-R randomΘ(log N+w)Θ(log N)Θ(log N(log N+w))
Ring lattice + Star (Longformer)Θ(w)Θ(1)Θ(w)
Ring lattice + Star + E-R random (BigBird)Θ(log N+w)Θ(1)Θ(log N+w)
HypercubeΘ(log N)Θ(log N)Θ(log2N)
+ +# A.2. Computation for $\mathbf{IP}(G)$ + +To compute $\mathrm{IP}(G)$ , we first find node pair $(a, b)$ whose distance is the diameter of the graph and calculate Information Payload for that node pair. + +$$ +I _ {a b} = \sum_ {P _ {a b} \in \mathcal {P} _ {a b}} R \left(P _ {a b}\right). \tag {7} +$$ + +For graphs in Table 1, $R(P_{ab})$ is constant for all paths $P_{ab} \in \mathcal{P}_{ab}$ . So we can compute $\mathrm{IP}(G)$ as follows, where $|\mathcal{P}_{ab}|$ is the number of paths in $\mathcal{P}_{ab}$ , + +$$ +I _ {a b} = \left| \mathcal {P} _ {a b} \right| R \left(P _ {a b}\right). \tag {8} +$$ + +For Complete graph, Tree, Star graph, Ring lattice + random, Longformer pattern and BigBird pattern, the number of paths $|\mathcal{P}_{ab}|$ is 1 and that path can be easily found. $R(P_{ab})$ for that path can be computed by definition. Here we choose the degree of non-global node in Longformer pattern and BigBird pattern to be $w$ and $\log N + w$ respectively. + +For E-R random graph and Ring lattice + E-R random, we assume adding neighbors does not shorten the diameter of the graph. Thus the $|\mathcal{P}_{ab}|$ and length of the shortest path between any two nodes in ring lattice + E-R random is the same as those in E-R random graph. In E-R random graph, the expected number of a $k$ -length path between two nodes is $p^k (k - 1)!C_{N - 2}^{k - 1}$ where $p$ is the probability for one edge to exist. That is the value of $|\mathcal{P}_{ab}|$ . The expected degree for every node in E-R random graph and ring lattice + E-R random is $\Theta (\log N)$ and $\Theta (\log N + w)$ respectively, so the expectation of $R$ for one path is $\Theta \left( \frac{1}{(\log N)^{\log N}} \right)$ and $\Theta \left( \frac{1}{(\log N + w)^{\log N}} \right)$ respectively. In this case, $k = \log N$ and $p = \Theta \left( \frac{\log N}{N} \right)$ , we + +Table 8. Information Payload for one path $R(P_{ab})$ and the number of paths $|\mathcal{P}_{ab}|$ between node $a$ and node $b$ . $w$ is the number of neighbors of a ring lattice. $p$ is the probability of one edge exist in E-R random graph and is set as $\Theta(\frac{\log N}{N})$ for $\mathrm{IP}(G)$ . + +
Type of graphR(Pab)|Pab|IP(G)
CompleteΘ(1/N)1Θ(1/N)
E-R randomΘ(1/(logN)^logN)pk(k-1)!Ck-1N-2Θ((N-2)!/N^log N (N-log N)!
TreeΘ(1/N^log(9))1Θ(1/N^log(9))
StarΘ(1/N)1Θ(1/N)
Ring lattice + E-R randomΘ(1/(log N+w)^log N)pk(k-1)!Ck-1N-2Θ((N-2)!/(N+w/√log N)^log N (N-log N)!
Ring lattice + Star (Longformer)Θ(1/Nw)1Θ(1/Nw)
Ring lattice + Star + E-R random (BigBird)Θ(1/N(log N+w))1Θ(1/N(log N+w))
HypercubeΘ(1/(log N)^log N)(log N)!Θ(log N!/(log N)^log N)
+ +compute $\mathrm{IP}(G)$ for E-R random graph as follows for example. + +$$ +\begin{array}{l} \operatorname {I P} (G) = p ^ {k} (k - 1)! C _ {N - 2} ^ {k - 1} \times \Theta \left(\frac {1}{(\log N) ^ {\log N}}\right) (9) \\ = \Theta \left(\left(\frac {\log N}{N}\right) ^ {\log N} (\log N - 1)! C _ {N - 2} ^ {\log N - 1} \frac {1}{(\log N) ^ {\log N}}\right) (10) \\ = \Theta \left(\frac {(\log N - 1) ! C _ {N - 2} ^ {\log N - 1}}{N ^ {\log N}}\right) (11) \\ = \Theta \left(\frac {(N - 2) !}{N ^ {\log N} (N - \log N) !}\right). (12) \\ \end{array} +$$ + +For Hypercube, every node in $P_{ab}$ has a degree of $\Theta (\log N)$ and $\text{len}(P_{ab})$ equals to $\Theta (\log N)$ , so $R(P_{ab})$ is $\Theta \left( \frac{1}{(\log N)^{\log N}} \right)$ . For $|\mathcal{P}_{ab}|$ , we consider the choices of every step in the random walk. For the first step it is $\log N$ and it is $\log N - 1$ for the second step. Thus the $|\mathcal{P}_{ab}|$ equals to the full-permutation number of $\log N$ , $(\log N)!$ . + +# B. Proofs and Algorithm + +# B.1. Proof for Theorem 2.4 + +Theorem 2.4 states that Information Payload between two nodes $I_{ab}$ equals to the probability of a random walk starts from node $b$ that ends in node $a$ at step $\text{len}(P_{ab})$ . + +Proof. First we introduce lemma B.1. + +Lemma B.1. Information Payload for one path $R(P_{ab})$ equals to the probability $(Pr(P_{ba}))$ of a random walk starts from $b$ and ends in a following reversed path of $P_{ab}$ . + +Proof. Let us consider random walk on the reversed path of $P_{ab}$ , namely $P_{ba}$ . For the $i$ th step we take, the probability equals to $1 / deg(v)$ where $v$ is the node that we are at the $i - 1$ th step. So the total probability of this path is $Pr(P_{ba}) = \prod_{v \in \mathcal{P}_{ba}} \& v \neq a \frac{1}{deg(v)}$ . We know that $\{v | v \in P_{ba} \& v \neq a\}$ equals to $\{v | v \in P_{ab} \& v \neq a\}$ . So $R(P_{ab}) = Pr(P_{ba})$ . + +Then, the probability of a random walk starts from $b$ that ends in $a$ at the $len(P_{ab})$ step, denoted by $SPr(P_{ba})$ is the + +summation of the probability of all paths in $P_{ba}$ . + +$$ +S P r _ {b a} = \sum_ {P _ {b a} \in \mathcal {P} _ {b a}} P r \left(P _ {b a}\right). \tag {13} +$$ + +For every $R(P_{ab})$ , from lemma B.1 we know that for every $P_{ab} \in \mathcal{P}_{ab}$ , $R(P_{ab}) = Pr(P_{ba})$ . So the Information Payload between two nodes $a, b$ + +$$ +\begin{array}{l} I _ {a b} = \sum_ {P _ {a b} \in \mathcal {P} _ {a b}} R \left(P _ {a b}\right) (14) \\ = \sum_ {P _ {a b} \in \mathcal {P} _ {a b}} P r \left(P _ {b a}\right) (15) \\ = \sum_ {P _ {b a} \in \mathcal {P} _ {b a}} P r \left(P _ {b a}\right) (16) \\ = S P r _ {b a}. (17) \\ \end{array} +$$ + +![](images/5894947fdea8a8e23016b0f9315b764322fb0913b88a67703bb3aafe83732bcc.jpg) + +Since we have Theorem 2.4, we can compute $\mathrm{IP}(G)$ via random walk as below. + +Computing Information Payload $\mathbf{IP}(G)$ via random walk. Using adjacent matrix $A_{G}$ and diagonal matrix $D =$ diag $(\frac{1}{d_1},\frac{1}{d_2},\dots \frac{1}{d_N})$ , we can easily calculate $I_{ab}$ by random walk. + +For each $a, b$ , we have + +$$ +M = D A _ {G}, +$$ + +$$ +M ^ {i} = M ^ {\text {l e n} \left(P _ {a b}\right)}, \tag {18} +$$ + +$$ +I _ {a b} = \left[ \left(M ^ {i}\right) ^ {T} \right] _ {a b}. +$$ + +According to Definition 2.5, let $\text{len}(P_{ab}) = \kappa(G)$ in equation (18) and $\Delta$ be the set of node pairs whose distance is the diameter of the graph, we can get + +$$ +\operatorname {I P} (G) := \min _ {(a, b) \in \Delta} \left(\left[ \left(\left(D A _ {G}\right) ^ {\kappa (G)}\right) ^ {T} \right] _ {a b}\right). \tag {19} +$$ + +# B.2. Proof for Theorem 3.1 + +Theorem 3.1 states that larger block size makes star graph and hypercube have less Normalized Information Payload. + +Proof. Given one graph $G_0(\mathcal{V}_0, \mathcal{E}_0)$ where $|\mathcal{V}_0| = N_0$ , we denote the two graphs adapting block sparse with different block sizes $x$ and $y$ by $G_x(\mathcal{V}_x, \mathcal{E}_x)$ and $G_y(\mathcal{V}_y, \mathcal{E}_y)$ . We know that $|\mathcal{V}_x|$ and $|\mathcal{V}_y|$ all equal to $N_0$ . Let $x < y$ , our goal is to prove that $\mathrm{NIP}(G_x) > \mathrm{NIP}(G_y)$ . + +We first use $b$ to denote the block size and deduce $\mathrm{NIP}(G_b)$ . We have another affiliated graph $G_{1/b}(\mathcal{V}_{1/b}, \mathcal{V}_{1/b})$ where $|\mathcal{V}_{1/b}| = \frac{N_0}{b}$ that adapts the same sparse pattern as $G_0$ . Here we use a function of sequence length $N$ to denote $\mathrm{NIP}(G)$ , namely $NIP_G(N)$ . + +We first consider $\mathbb{C}\mathbb{C}(G_b)$ + +$$ +\kappa \left(G _ {b}\right) = \kappa \left(G _ {1 / b}\right), \tag {20} +$$ + +$$ +\rho \left(G _ {b}\right) = b \rho \left(G _ {1 / b}\right), \tag {21} +$$ + +(22) + +So + +$$ +\mathbf {C C} \left(G _ {b}\right) = b \cdot \mathbf {C C} \left(G _ {1 / b}\right). \tag {23} +$$ + +Next, for $\mathrm{IP}(G_b)$ , the longest path in $G_{b}$ is equal to that in $G_{1 / b}$ , while any node $v$ in the path changes its degree $\deg (v)$ to $b\cdot deg(v)$ . Thus we have + +$$ +\mathrm {I P} \left(G _ {b}\right) = \frac {\mathrm {I P} \left(G _ {1 / b}\right)}{b ^ {\kappa \left(G _ {1 / b}\right)}}. \tag {24} +$$ + +The final $\mathrm{NIP}(G_b)$ then + +$$ +\begin{array}{l} \mathrm {N I P} \left(G _ {b}\right) = \frac {\mathrm {I P} \left(G _ {b}\right)}{\mathrm {C C} \left(G _ {b}\right)} (25) \\ = \frac {\operatorname {I P} \left(G _ {1 / b}\right)}{b \cdot \operatorname {C C} \left(G _ {1 / b}\right) b ^ {\kappa \left(G _ {1 / b}\right)}} (26) \\ = \frac {1}{b ^ {\kappa \left(G _ {1 / b}\right) + 1}} \mathrm {N I P} \left(G _ {1 / b}\right) (27) \\ = \frac {1}{b ^ {\kappa \left(G _ {1 / b}\right) + 1}} N I P _ {G} \left(\frac {N _ {0}}{b}\right). (28) \\ \end{array} +$$ + +Let $f(b) = \mathrm{NIP}(G_b)$ , our goal is to prove that $f(b)$ is monotonically decreasing for star, hypercube. + +Star graph. While $\kappa(G)$ for star is always 2, the $f(b)$ for star is as follows + +$$ +\begin{array}{l} f (b) = \frac {1}{b ^ {3}} N I P _ {G} \left(\frac {N _ {0}}{b}\right) (29) \\ = \frac {b}{N _ {0} b ^ {3}} (30) \\ = \frac {1}{N _ {0} b ^ {2}}. (31) \\ \end{array} +$$ + +It's monotonically decreasing for $b$ . + +Hypercube. We do the same computation for hypercube. $\kappa (G)$ for hypercube is log $N$ , so + +$$ +\begin{array}{l} f (b) = \frac {1}{b ^ {\log N _ {0} + 1}} N I P _ {G} \left(\frac {N _ {0}}{b}\right) (32) \\ = \frac {1}{b ^ {\log N _ {0} + 1}} \frac {\left(\log \frac {N _ {0}}{b}\right) !}{\left(\log \frac {N _ {0}}{b}\right) ^ {\log \frac {N _ {0}}{b} + 2}}. (33) \\ \end{array} +$$ + +Using Sterling Equation to approximate factorial, where $c$ is $\sqrt{2\pi}$ , we get + +$$ +\begin{array}{l} f (b) \approx \frac {1}{b ^ {\log N _ {0} + 1}} \frac {c \left(\log \frac {N _ {0}}{b}\right) \left(\log \frac {N _ {0}}{b}\right) + \frac {1}{2} e ^ {- \left(\log \frac {N _ {0}}{b}\right)}}{\left(\log \frac {N _ {0}}{b}\right) ^ {\log \frac {N _ {0}}{b} + 2}} (34) \\ = \frac {1}{b ^ {\log N _ {0} + 1}} \frac {c}{\left(\log \frac {N _ {0}}{b}\right) ^ {1 . 5} e ^ {\left(\log \frac {N _ {0}}{b}\right)}} (35) \\ = \frac {1}{b ^ {\log N _ {0} + 1}} \frac {c}{\left(\log \frac {N _ {0}}{b}\right) ^ {1 . 5} \left(\frac {N _ {0}}{b}\right) ^ {\frac {1}{\ln 2}}} (36) \\ = \frac {C}{b ^ {\log N _ {0} + 1 - \frac {1}{\ln 2}} \left(\log \frac {N _ {0}}{b}\right) ^ {1 . 5}}. (37) \\ \end{array} +$$ + +while $C$ is another constant. To make $f(b)$ monotonically decreasing, the derivative of $f(b)$ should be less than zero, which is true when + +$$ +\log N _ {0} + 1 - \frac {1}{\ln 2} > \frac {3}{2 \ln 2 (\log N _ {0} - \log b)}. \tag {38} +$$ + +Note that $b \leq \frac{N}{2}$ , thus we have to prove + +$$ +\log N _ {0} + 1 - \frac {1}{\ln 2} > \frac {3}{2 \ln 2}, \tag {39} +$$ + +which is true for $N_0 \geq 128$ . + +Now we have proved Theorem 3.1. + +# B.3. Iterative mapping algorithm + +We demonstrate the iterative binary mapping algorithm here. $<<$ means left logical shift for binary numbers. + +Algorithm 1 Binary representation of sequences +Input: sequence $S = (s_0,\dots,s_{N - 1})$ +Output: Binary representation $X^{N} = X_{0}X_{1}X_{2}\dots X_{i}\dots X_{N - 1}$ Initialize $X = (0,1)$ +repeat + $Y = ()$ +for i in $X$ do +Y.append(i $< < 1$ +end for +for i in reversed $X$ do +Y.append(i $< < 1 + 1$ +end for + $X = Y$ +until len $(X) > = N$ +Output: $X^{N} = X[:N]$ + +Final representation + +$$ +X _ {i} ^ {d} = \left(\lfloor \frac {i \mod 2 ^ {k - d + 1}}{2 ^ {k - d}} \rfloor + \lfloor \frac {i \mod 2 ^ {k - d}}{2 ^ {k - d - 1}} \rfloor\right) \mod 2 \tag {40} +$$ + +can be proved by mathematical induction. + +Proof. + +Base case: For $k = 1$ , we know that equation (40) is true. + +Inductive step: Assume for $k = n - 1$ equation (40) is true we deduce it for $k = n$ . If $d = 0$ , we can easily verify that equation (40) is true. + +For $d \neq 0$ situations, if $i < 2^{n-1}$ , according to algorithm 1, $X_i^d (k = n) = X_i^{d-1}(k = n-1)$ , so + +$$ +\begin{array}{l} X _ {i} ^ {d} (k = n) = X _ {i} ^ {d - 1} (k = n - 1) (41) \\ = \left(\left\lfloor \frac {i \mod 2 ^ {n - 1 - (d - 1) + 1}}{2 ^ {n - 1 - (d - 1)}} \right\rfloor + \left\lfloor \frac {i \mod 2 ^ {n - 1 - (d - 1)}}{2 ^ {n - 1 - (d - 1)} - 1} \right\rfloor\right) \mod 2 (42) \\ = \left(\lfloor \frac {i \mod 2 ^ {n - d + 1}}{2 ^ {n - d}} \rfloor + \lfloor \frac {i \mod 2 ^ {n - d}}{2 ^ {n - d - 1}} \rfloor\right) \mod 2. (43) \\ \end{array} +$$ + +$$ +\mathrm {I f} i \geq 2 ^ {n - 1}, X _ {i} ^ {d} (k = n) = X _ {2 ^ {n} - 1 - i} ^ {d} (k = n) = X _ {2 ^ {n} - 1 - i} ^ {d - 1} (k = n - 1), \mathrm {s o} +$$ + +$$ +X _ {i} ^ {d} (k = n) = X _ {2 ^ {n} - 1 - i} ^ {d - 1} (k = n - 1) \tag {44} +$$ + +$$ += \left(\left\lfloor \frac {\left(2 ^ {n} - 1 - i\right) \mod 2 ^ {n - 1 - (d - 1) + 1}}{2 ^ {n - 1 - (d - 1)}} \right\rfloor + \left\lfloor \frac {\left(2 ^ {n} - 1 - i\right) \mod 2 ^ {n - 1 - (d - 1)}}{2 ^ {n - 1 - (d - 1) - 1}} \right\rfloor\right) \quad \text {m o d} 2 \tag {45} +$$ + +$$ += \left(\lfloor \frac {\left(2 ^ {n} - 1 - i\right) \mod 2 ^ {n - d + 1}}{2 ^ {n - d}} \rfloor + \lfloor \frac {\left(2 ^ {n} - 1 - i\right) \mod 2 ^ {n - d}}{2 ^ {n - d - 1}} \rfloor\right) \mod 2 \tag {46} +$$ + +$$ += \left(\lfloor \frac {i \mod 2 ^ {n - d + 1}}{2 ^ {n - d}} \rfloor + \lfloor \frac {i \mod 2 ^ {n - d}}{2 ^ {n - d - 1}} \rfloor\right) \mod 2. \tag {47} +$$ + +# C. Hyper-parameters + +# C.1. Long Range Arena + +We put hyper-parameters for LRA here. We set the embedding hidden size to 64 and the hidden size for attention to be 128. Dropout rate and weight decay is different for each task. + +Table 9. Hyper-parameters used for all models we trained on Long Range Arena. + +
Hyper-parameterOur Model
Batch size32
Number of Layers4
Number of Shared Layers2
Hidden size64
FFN inner hidden size128
Attention heads4
Attention head size32
Block size16
Dropout0.1, 0.2, 0.3
Attention Dropout0
Learning Rate DecayCosine
Weight Decay0, 0.0001
OptimizerAdamW
Adam ε1e-6
Adam β10.9
Adam β20.98
Gradient Clipping0
Prediction Head Poolingmean
+ +Table 10. Sparsity settings. $b$ is the block size. + +
GraphGlobal tokensWindow lengthRandom tokensBlocks (1K)Blocks (2K)Blocks (4K)
Star1 × b00190382766
Ring lattice + E-R random03 × b5 × b49810062028
Ring lattice + Star (Longformer)1 × b3 × b03146341274
Ring lattice + Star + E-R random (BigBird)1 × b3 × b4 × b54611192274
Hypercube0--44810242304
+ +# C.2. CubeBERT $_{128}$ Hyper-parameters + +We present hyper-parameters for pretraining in Table 11 and downstream tasks in Table 12. + +Table 11. Hyper-parameters used for CubeBERT $_{128}$ pretraining. + +
HyperparameterOur Model
Number of Layers24
Hidden size1024
FFN inner hidden size4096
Attention heads16
Attention head size64
Dropout0.1
Attention Dropout0.1
Learning Rate DecayLinear
Weight Decay0.01
OptimizerAdamW
Adam ε1e-6
Adam β10.9
Adam β20.98
Gradient Clipping0.0
Batch Size4096
Peak Learning Rate1e-3
Warmup Proportion2%
Max Steps240k
+ +Table 12. Hyper-parameters used for downstream tasks, + +
Hyper-parameterGLUEWikitext103
Batch Size{32,16}8
Learning Rate{2e-5, 5e-5}5e-5
Weight Decay0.010
Max Epochs53
Warmup Steps500
\ No newline at end of file diff --git a/whatdensegraphdoyouneedforselfattention/images.zip b/whatdensegraphdoyouneedforselfattention/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..968f00131e7b73c6fccb447545a221cb1a24f6f7 --- /dev/null +++ b/whatdensegraphdoyouneedforselfattention/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9288f6b32a3321e5aacd8ca6f0290748250dba8732b031f73703708116fd5108 +size 896293 diff --git a/whatdensegraphdoyouneedforselfattention/layout.json b/whatdensegraphdoyouneedforselfattention/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..024a1d2e100dcd58243ad88f4fe13877beabc69f --- /dev/null +++ b/whatdensegraphdoyouneedforselfattention/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5c11de787c7309be47e8dedb10cb712860eb8237f093493ce9f39f4c892b2a2e +size 720924 diff --git a/whatlanguagemodelarchitectureandpretrainingobjectiveworksbestforzeroshotgeneralization/a995aaa0-8587-443e-b23c-76ab4805ff22_content_list.json b/whatlanguagemodelarchitectureandpretrainingobjectiveworksbestforzeroshotgeneralization/a995aaa0-8587-443e-b23c-76ab4805ff22_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..bcc30d1970d4c3b3956b95bab368adea6bdef06c --- /dev/null +++ b/whatlanguagemodelarchitectureandpretrainingobjectiveworksbestforzeroshotgeneralization/a995aaa0-8587-443e-b23c-76ab4805ff22_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b9e268b91d5c9d734416e5a150485afacbf69c760c85d5d5b3a444e1d8512f04 +size 125732 diff --git a/whatlanguagemodelarchitectureandpretrainingobjectiveworksbestforzeroshotgeneralization/a995aaa0-8587-443e-b23c-76ab4805ff22_model.json b/whatlanguagemodelarchitectureandpretrainingobjectiveworksbestforzeroshotgeneralization/a995aaa0-8587-443e-b23c-76ab4805ff22_model.json new file mode 100644 index 0000000000000000000000000000000000000000..ad7e2036da24df2ed32fa93eb48b64820488e1a9 --- /dev/null +++ b/whatlanguagemodelarchitectureandpretrainingobjectiveworksbestforzeroshotgeneralization/a995aaa0-8587-443e-b23c-76ab4805ff22_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:234f361c4f6066a858a8d11ecb350e2941fa5e52d86c9a1340f6861281ebb2b5 +size 154540 diff --git a/whatlanguagemodelarchitectureandpretrainingobjectiveworksbestforzeroshotgeneralization/a995aaa0-8587-443e-b23c-76ab4805ff22_origin.pdf b/whatlanguagemodelarchitectureandpretrainingobjectiveworksbestforzeroshotgeneralization/a995aaa0-8587-443e-b23c-76ab4805ff22_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..14e640ede06096d793854cbff16a607e6c16d037 --- /dev/null +++ b/whatlanguagemodelarchitectureandpretrainingobjectiveworksbestforzeroshotgeneralization/a995aaa0-8587-443e-b23c-76ab4805ff22_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:405f4ada7e5313a5230c91d01620dcc4c00e9020782c585570120ad17915dfef +size 955569 diff --git a/whatlanguagemodelarchitectureandpretrainingobjectiveworksbestforzeroshotgeneralization/full.md b/whatlanguagemodelarchitectureandpretrainingobjectiveworksbestforzeroshotgeneralization/full.md new file mode 100644 index 0000000000000000000000000000000000000000..a07cd7997e0848c1d4e52b16565f3c10e7ec268c --- /dev/null +++ b/whatlanguagemodelarchitectureandpretrainingobjectiveworksbestforzeroshotgeneralization/full.md @@ -0,0 +1,422 @@ +# What Language Model Architecture and Pretraining Objective Work Best for Zero-Shot Generalization? + +Thomas Wang $^{1*}$ Adam Roberts $^{2*}$ Daniel Hesslow $^{3}$ Teven Le Scao $^{1}$ Hyung Won Chung $^{2}$ Iz Beltagy $^{4}$ Julien Launay $^{35\dagger}$ Colin Raffel $^{1\dagger}$ + +# Abstract + +Large pretrained Transformer language models have been shown to exhibit zero-shot generalization, i.e. they can perform a wide variety of tasks that they were not explicitly trained on. However, the architectures and pretraining objectives used across state-of-the-art models differ significantly, and there has been limited systematic comparison of these factors. In this work, we present a large-scale evaluation of modeling choices and their impact on zero-shot generalization. In particular, we focus on text-to-text models and experiment with three model architectures (causal/non-causal decoder-only and encoder-decoder), trained with two different pretraining objectives (autoregressive and masked language modeling), and evaluated with and without multitask prompted finetuning. We train models with over 5 billion parameters for more than 168 billion tokens, thereby increasing the likelihood that our conclusions will transfer to even larger scales. Our experiments show that causal decoder-only models trained on an autoregressive language modeling objective exhibit the strongest zero-shot generalization after purely self-supervised pretraining. However, models with non-causal visibility on their input trained with a masked language modeling objective followed by multitask finetuning perform the best among our experiments. We therefore consider the adaptation of pretrained models across architectures and objectives. Code and checkpoints are available at https://github.com/bigscience-workshop/architecture-objective. + +# 1. Introduction + +Large language models (LLMs) pretrained on unstructured text data have been shown to be capable of performing a wide variety of text processing tasks without additional training or labeled data. This ability has been referred to as zero-shot generalization since these models are typically pretrained with a self-supervised objective with no regards to specific downstream tasks. As such, there has been an explosion of work on developing LLMs and training techniques that produce strong zero-shot generalization (Brown et al., 2020; Wang and Komatsuzaki, 2021; Du et al., 2021; Lin et al., 2021; Rae et al., 2021; Hoffmann et al., 2022; Chowdhery et al., 2022). + +Modern LLMs are based on the Transformer architecture (Vaswani et al., 2017). While the original Transformer included a separate encoder that processes input text and a decoder that generates target text, most recent LLMs are causal decoder-only (CD) models trained to autoregressively predict a text sequence (Liu et al., 2018; Radford et al., 2018; Al-Rfou et al., 2019). In contrast with this trend, Raffel et al. (2020) has shown that encoder-decoder (ED) models outperform decoder-only LLMs for transfer learning (i.e. where a pretrained model is finetuned on a single downstream task). Non-causal decoders-only (ND) (Liu et al., 2018; Dong et al., 2019) use a modified attention mask to bridge the gap between decoder-only and encoder-decoder models. However, they have seen limited adoption. One recent line of work has demonstrated that adding an explicit multitask finetuning stage on an ensemble of prompted tasks after pretraining can significantly boost the zero-shot capabilities of LLMs on both encoder-decoder models (Sanh et al., 2021; Xu et al., 2022) and causal decoders-only model (Wei et al., 2021). This begs the question as to which architecture would be a better choice for zero-shot generalization, especially if used in conjunction with multitask finetuning. + +Transformer models can be trained with a variety of self-supervised training objectives. Typically, causal decoder-only LLMs are pretrained using a full language modeling (FLM) objective (Dai and Le, 2015; Radford et al., 2018), and encoder-decoder models with a masked + +![](images/33b11a6ddbc53adb655d673635ac835cceed383ce59a6d678a18001a5d41125b.jpg) +Figure 1. We perform an extensive study of architecture, objective, adaptation, and finetuning impact on zero-shot generalization. With 6 pretrained models of over 5 billion parameters each trained on 168 billion tokens, adaptations on up to 100 billion tokens, multitask finetuning on 13 billion tokens, and evaluation on 30 tasks from 2 different benchmarks with varied prompts, our study is the largest to date on the influence of modeling decisions on zero-shot generalization. + +language modeling (MLM) objective (Taylor, 1953; Devlin et al., 2018), such as span corruption (Raffel et al., 2019; Joshi et al., 2020). It has repeatedly been shown that a MLM objective produces a better pretrained model for subsequent supervised finetuning (Devlin et al., 2018; Lample and Conneau, 2019; Voita et al., 2019; Raffel et al., 2020). Straightforward application of the model to many downstream tasks could be the reason for the frequent use of FLM objective (Radford et al., 2019). Still, the effectiveness of MLM in the transfer learning setting suggests it could create LLMs that are better suited to multitask finetuning. Notably, T0 (Sanh et al., 2021) used a MLM pretraining objective, which may have contributed to its strong performance relative to larger models trained with a FLM objective. Recently, Lester et al. (2021) also proposed introducing an adaptation stage (i.e. extending pretraining but with a different objective) to enable a MLM model to perform prompted text generation tasks, bridging the gap across objectives. + +These results indicate a need for a more systematic analysis of which architecture and pretraining objective pair produces LLMs with the strongest zero-shot generalization capabilities. Past studies on architectures and objectives for language models (e.g. Narang et al., 2021; Raffel et al., 2020) have focused mainly on the transfer learning setting, with models that were orders of magnitude smaller than the current state-of-the-art. Furthermore, recent results demonstrating the effectiveness of multitask finetuning raise the question of which architecture and pretraining objective is best suited to that promising setting. + +Large-scale systematic study. We undertake a study of architecture and pretraining objective combinations for LLMs with a focus on zero-shot generalization. We consider decoder-only and encoder-decoder models using full, prefix, and masked language modeling, spanning six $\langle$ architecture, objective\rangle pairs. We also evaluate performance with and without multitask finetuning. In hopes of producing insights that transfer to very large models, we + +undertake our experiments at large scale: we train models with 5 billion parameters (11 for encoder-decoder) on 168 billion tokens, and perform multitask finetuning on 13 billion tokens. We base our zero-shot evaluation on evaluation set from T0 (T0-Eval) (Sanh et al., 2021) and the EleutherAI language model evaluation harness (EAI-Eval) (Gao et al., 2021), totalling 30 different datasets with varied prompts. Figure 1 provides an overview of our study. + +Multitask finetuning impacts architecture and objective choice. We find that the popular recipe of a causal decoder model trained with a FLM objective performs best when zero-shot capabilities are measured immediately after pretraining. However, after multitask finetuning, the results are the opposite: models pretrained with MLM perform significantly better and causal decoder models perform worse. + +Bridging across architectures and objectives with adaptation. This discrepancy motivates us to explore the practice of adaptation (i.e. extending the pretraining of a model with a different architecture/objective) as a way to efficiently obtain both a model suited to generative use cases and to multitask finetuning. We first consider full language modeling adaptation: adapting a MLM-trained non-causal decoder model by converting it to a causal decoder and extending its pretraining with a FLM objective. We find that using a pretrained model in this way speeds up convergence on FLM by a factor 1.6x. We then explore non-causal MLM adaptation, starting from a causal decoder trained with a FLM objective, converting it to a non-causal decoder, and expanding its pretraining with a MLM objective. Convergence on the MLM task is sped-up by 3.3x. This form of adaptation produces a new version of the model suited for multitask finetuning, achieving second-best performance across our benchmarks. + +![](images/4d587278a9603def8d95746bfb9a8f20db77ea9ad54d33e0feb3e655fcac0b56.jpg) +Figure 2. Attention patterns in a causal decoder, non-causal decoder, and encoder-decoder. In a causal decoder, each token attends to the previous tokens only. In both non-causal decoder and encoder-decoder, attention is allowed to be bidirectional on any conditioning information. For the encoder-decoder, that conditioning is fed into the encoder part of the model. + +# 2. Background + +# 2.1. Architectures + +Transformer. Virtually all state-of-the-art LLMs are based on the Transformer architecture (Vaswani et al., 2017). Due to its ubiquity, we only highlight a few relevant high-level characteristics. The main architectural unit of the Transformer is a Transformer block, which consists of (at minimum) multi-headed self attention (Cheng et al., 2016), layer normalization (Ba et al., 2016), a dense two-layer feedforward network, and residual connections (He et al., 2016). A Transformer stack is a sequence of such blocks. + +Encoder-decoder. As originally proposed, the Transformer consisted of two stacks: an encoder and a decoder. The encoder encodes an input sequence using bidirectional conditioning, ie input tokens can see all other input tokens. Then, the decoder autoregressively predicts the target sequence, token by token, conditioned on the output of the encoder using a cross-attention layer in each of its blocks. The self-attention layers in the decoder utilize a causal masking pattern that prevents the model from attending to future tokens (see Figure 2, on the right). Pre-trained language models using an encoder-decoder architecture include BART (Lewis et al., 2019) and T5 (Raffel et al., 2020). + +Causal decoder-only. Although the encoder-decoder is the original Transformer variant, most recent LLMs use a decoder-only architecture. Decoder-only models use as input a single text stream, and, because of the causal masking pattern, conditioning is simply based on past tokens (see Figure 2, on the left). On the one hand, representation for any conditioning text is inherently weaker due to the causal masking; on the other hand, it yields a simpler architecture that is naturally suited to autoregressive next-step-prediction pretraining objective. Most notably, the CD architecture makes up the backbone of the GPT series of models (Radford et al., 2018; 2019; Brown et al., 2020) as well as many other recent record-breaking LLMs (Zeng + +![](images/dae90c78a0aa4151909d20347867ed72e0d97ea02f6677bdaef45d65335cc357.jpg) +Figure 3. Input and targets tokens in full, prefix, and masked language modeling training objectives. For full language modeling, all tokens in a sequence are used during training. For prefix language modeling, we randomly select a prefix size, and hence only half of the tokens are used on average to derive the loss. Finally, for masked language modeling, we mask $15\%$ of the tokens, in spans of 3 tokens on average. + +et al., 2021; Kim et al., 2021; Smith et al., 2022; Thoppilan et al., 2022; Rae et al., 2021; Hoffmann et al., 2022; Chowdhery et al., 2022). + +Non-causal decoder-only. To allow decoder-only models to build richer representations of the input/conditioning text, it has been proposed to simply modify the attention mask used. Specifically, the self-attention masking pattern can be changed so that the region of the input sequence has a non-causal mask (i.e. attention in this region is not restricted to past tokens, see middle of Figure 2), as in the encoder of an encoder-decoder architecture. Sometimes called a prefix language model, this approach was introduced by Liu et al. (2018) and was later explored as an architectural variant by (Raffel et al., 2020; Wu et al., 2021). + +Encoder-only. As an aside, we note another popular architectural variant, BERT (Devlin et al., 2018) and its derivatives, is to only use a Transformer encoder stack. However, its limited generative capabilities limit its evaluation in zero-shot setting (Tamborrino et al., 2020). Consequently we omit it from consideration. + +Comparisons across architectures. Decoder-only models process a single sequence consisting of the concatenation of the input and target text. On the other hand, in an encoder-decoder, the encoder processes only the input and the decoder processes only the target. The total amount of computation performed by an encoder-decoder will therefore be approximately equivalent to a decoder-only model when the encoder and decoder each have as many parameters as the entire decoder-only model (assuming almost linear complexity and ignoring self-attention blocks' quadratic complexity), which doubles the memory footprint. + +# 2.2. Pretraining objectives + +An important step in building LLMs is pretraining, where the model is trained on a large, unlabeled dataset via self-supervision. We therefore include multiple choice of pre-training objective as a factor in our empirical study. Fig- + +ure 3 outlines the input and target tokens for the pretraining objectives considered. + +Full Language modeling. Since the advent of GPT-2 (Radford et al., 2019), large decoder-only models have generally been pretrained with an autoregressive language modeling objective (Brown et al., 2020; Wu et al., 2021; Rae et al., 2021). Given previous tokens, the model is tasked with predicting the following one. + +Prefix language modeling. For encoder-decoder and non-causal decoder-only models to perform language modeling, one can define a prefix where the conditioning is allowed to be non-causal. Similar to full language modeling, the model is tasked to predict each token outside the prefix given all previous tokens. We hereafter refer to this objective as prefix language modeling (PLM). + +Masked language modeling. Tokens or spans of tokens in the input text are replaced with a special mask token and the model is trained to predict the missing tokens. A notable example for token-masked language modeling BERT (Devlin et al., 2018). Raffel et al. (2020) introduced a version of this objective adapted to span-masking in the form of span corruption: sentinel tokens are used to flag masked spans of short random lengths in the input, the model is tasked to output the sentinels followed by their respective predicted content. + +# 2.3. Model adaptation + +Adaptation extends pretraining with a different objective and/or architecture. In contrast with finetuning, no new downstream data is used, only additional pretraining data. + +Language modeling adaptation (LM-A) takes a model pretrained with MLM and extend its training with PLM or FLM. It has been used to convert encoder-decoder models pretrained with MLM into better generative models. Notably, it is used as a first step before prompt tuning (Lester et al., 2021) and also to prepare the model before multitask finetuning in T0 (Sanh et al., 2021). + +# 2.4. Multitask finetuning + +Modern pretraining corpora are typically massive preprocessed generalist web crawls (Ortiz Suárez et al., 2019; Raffel et al., 2020), although adding curated high-quality cross-domain data has been proposed as a path towards better zero-shot generalization (Gao et al., 2020; Scao et al., 2022). Recently, Sanh et al. (2021) (on an encoder-decoder model trained with MLM) and Wei et al. (2021) (on a causal decoder-only model trained with FLM) explored the potential of explicitly finetuning the model to solve multiple tasks in order to bolster zero-shot generalization. This is done by finetuning the model on a dataset of prompted tasks (i.e. in a natural language format, lever + +aging prompt templates applied over many datasets), which ultimately improves zero-shot performance over purely self-supervised pretraining. We refer to this as multitask finetuning (MT-F), and use the openly available datasets and prompts developed for T0. + +# 2.5. Zero-shot evaluation + +Radford et al. (2019) first demonstrated that LLMs display zero-shot capabilities: given sufficient scale, language models are able to perform many tasks without having explicitly accessed any supervised samples. Zero-shot use of language models relies on a technique called prompting, where tasks are formulated in a natural language format (in accordance with the pretraining objective). The template applied to each example to convert it to this format is called the prompt. Unfortunately, models can exhibit significant sensitivity to the wording of the prompt (Sanh et al., 2021). + +Zero-shot capabilities are of increasing interest in the community, as evidenced by most record-breaking LLMs only reporting zero/few-shot results (Brown et al., 2020; Smith et al., 2022; Rae et al., 2021; Chowdhery et al., 2022). There are many reasons why zero-shot use is gaining such traction: it does not require any labeled examples, it removes the complexity of model finetuning and deployment, and it also tests generalization to unseen tasks. + +# 3. Methods + +We pretrain all possible $\langle$ architecture, objective $\rangle$ pairs on 168 billion tokens from C4, consider multitask finetuning, and finally evaluate zero-shot performance. We also study the possibility of using adaptation to efficiently transfer the benefits from one architecture/objective to another. + +Compute budget guideline. Different architectures and objectives come with different compute trade-offs. We aim to make the training budget similar across all models, using $\sim 15$ petaflops-days for pretraining (for a total of 830,000 TPUv4-hours over the study, see Appendix C.2 for details). We do not take into account memory use: typical use cases are compute-bound by the available GPU/TPU-hours. + +Resources and implementation. We run all computation on Google Cloud TPUv4s, using the T5X codebase (Roberts et al., 2022), leveraging JAX (Bradbury et al., 2018) and Flax (Heek et al., 2020). + +# 3.1. Architecture + +We consider causal decoder (CD), encoder-decoder (ED), and non-causal decoder (ND) architectures. All models share the basic configuration outlined in Table 2. For fair comparison across architectures, we aim to approximately match pretraining compute budget; accordingly, + +our encoder-decoder models have twice as many layers as the decoder-only models as detailed in Section 2.1. This results in encoder-decoder models with 11B parameters and decoder-only models with 4.8B parameters. We note that due to the cross-attention layers, encoder-decoder models are approximately $\sim 10\%$ more computationally expensive to run than the decoder-only models we consider. + +# 3.2. Pretraining + +We consider full language modeling (FLM), prefix language modeling (PLM), and masked language modeling (MLM), specifically the span corruption objective of Raffel et al. (2020). The choice of language modeling objective depends on the architecture: the causal decoder uses either FLM or MLM, while the non-causal decoder and the encoder-decoder use either PLM or MLM. + +All of our models are pretrained on 168 billion tokens of the C4 dataset from Raffel et al. (2020). We use the Adafactor (Shazeer and Stern, 2018) optimizer with an inverse square root learning rate schedule, training on batches of 2,048 sequences of length 626 tokens. Detailed pretraining hyperparameters can be found in Table 3: we based elements of our pretraining setup (such as Adafactor, GEGLU, and the use of an auxiliary $Z$ loss $\mathcal{L}(Z) = 10^{-4} * \log^2(Z)$ to stabilize training (Chowdhery et al., 2022)) on the popular T5.1.1 recipe. + +To operate with a fixed compute budget, we match the amount of tokens seen during pretraining, not the number of tokens trained on (i.e. on which a loss is calculated). Full language modeling computes a loss on all the tokens it sees, whereas prefix language modeling cannot train on the tokens in its prefix: on average, it will train on half as many tokens as full language modeling. We consider these to be inherent trade-offs in efficiency between training objectives, an illustration is available in Figure 3. We concatenated and sampled text from documents in such a way that there was virtually no padding during pretraining. More specifically to each objective: + +Full language modeling. the loss is computed for all 626 token in each sequence in parallel, making for the most efficient configuration (100% of tokens are trained on). + +Prefix language modeling. we select a random split point in [1, 626], which we use as the prefix length of one example and the suffix length for another, packing them together to avoid padding (using appropriately masked attention), and computing the loss only on the suffixes as prefix can attend to their targets (50% of tokens on average). See Appendix D for implementation details on TPUs. + +Masked language modeling. $15\%$ of input tokens are masked with an average span length of 3 (as used by Raffel et al. (2020)), such that there are approximately 512 input + +and 114 target tokens, with the loss computed only on the targets (18% of tokens on average). + +# 3.3. Multitask finetuning + +Drawing from recent work demonstrating that multitask finetuning improves zero-shot performance, we also evaluate our models after multitask finetuning (MT-F), following T0 procedure (Sanh et al., 2021). Our goal is to better disambiguate the influence of architecture and objective in this relatively nascent practice. For example, we note that T0 and FLAN are significantly different in their architecture and objective, encoder-decoder with MLM and causal decoder with FLM, respectively. + +After pretraining, we create multitask versions of our models by finetuning on the T0 training dataset mixture from Sanh et al. (2021) (not $\mathrm{T0 + }$ or $\mathrm{T0 + + }$ ) for 13 billion tokens. Our finetuning configurations follow those used for T0 (see Table 3 for details), and note that we found dropout to significantly impact zero-shot generalization (see Appendix F.3 for a comparison with and without dropout). We refer readers to Sanh et al. (2021) for further information about this multitask finetuning procedure. + +One significant departure to note from the approach of Sanh et al. (2021) is that we do not perform language modeling adaptation first before multitask finetuning. Preliminary results (see Appendix F.1) did not show any systematic improvement from performing language modeling adaptation, so we omitted this step. This is consistent with the finding from Lester et al. (2021) that language modeling adaptation is not necessary before prompt tuning for large models. + +# 3.4. Evaluation + +We use two zero-shot evaluation benchmarks to assess our models. First, we use the same set of tasks, datasets, and prompts as was used to evaluate T0 (T0-Eval) (Sanh et al., 2021), and second, the EleutherAI LM evaluation harness (EAI-Eval) (Gao et al., 2021). The EAI prompts attempt to replicate the evaluation set of Brown et al. (2020). The prompts of T0 were built to be "human understandable". See Appendix E for a detailed list of tasks, and the overlap between T0-Eval, EAI-Eval, and T0-Train. + +T0-Eval provides multiple prompts per task, whereas EAI-Eval provides only one prompt per task. Accordingly, for T0-Eval, we take the median accuracy over all prompts for each task and then average across all 11 datasets. For EAI-Eval we simply average the accuracy obtained on each of the 31 datasets. Hence, when reporting performance on T0-Eval, we report a spread across prompts, giving an indication of the impact of the choice of prompt. Note that because these are aggregated zero-shot benchmarks, varia + +tions of even a percent can hide significant differences on a single task. + +All but one task in T0-Eval (StoryCloze) are also in EAI-Eval. Some of the datasets in EAI-Eval are also in the T0 training datasets: GLUE-MRPC, GLUE-QQP, and SciQ. We also did not check for contamination from C4, but given the fact that all models would have the opportunity to memorize the tasks leaked in C4, we believe it does not impact our evaluation. For additional discussion of the overlap between T0 and C4, we refer readers to the original T0 paper Sanh et al. (2021). + +We perform evaluation of model checkpoints at 42B, 84B, and 168B tokens. We note that the random baselines are $\sim$ $33\%$ for EAI-Eval and $\sim$ $42\%$ for T0-Eval. The complete set of results across all checkpoints obtained through this study is made available in Appendix F.2. + +# 4. Experiments + +# 4.1. After self-supervised pretraining only + +We are first interested in the architecture and objective achieving the best zero-shot performance after self-supervised pretraining only. For this, we only consider the full-prefix language modeling objectives since masked language modeling does not yield a model appropriate for our zero-shot prompted evaluation. This is validated with early checkpoints in Appendix F.1. + +We present our results in Table 1. On both our evaluation benchmarks, the causal decoder architecture systematically outperforms the other architectures when using language modeling pretraining alone. The non-causal decoder remains within a percent of the causal decoder performance, but the encoder-decoder performance lags far behind. Finally, we note that the performances on T0-Eval are close to the random baseline, while performance differences on EAI-Eval are significant enough to make comparison across experiments. + +Finding 1. Causal decoder-only models pretrained with a full language modeling objective achieve best zero-shot generalization when evaluated immediately after self-supervised pretraining, in line with current common practices for large language models. + +# 4.2. After multitask finetuning + +We now focus on the relatively new practice of multitask finetuning, where there has not yet been any systematic study of the influence of the architecture and training objective. Notably, the two main papers advocating this practice use completely different approaches: Sanh et al. (2021) finetunes an encoder-decoder model pretrained with span + +corruption, whereas Wei et al. (2021) finetunes a decoder-only pretrained with full language modeling. It is not immediately clear which approach is more natural: while decoder-only models trained with full language modeling are better at zero-shot generalization (as evidenced in Section 4.1), encoder-decoder models and masked language modeling pretraining have been shown to perform significantly better after finetuning (Raffel et al., 2020). We therefore evaluate every architecture and objective combination after multitask finetuning. + +Our results are outlined in Figure 4. The encoder-decoder pretrained with span corruption offers the best performance after multitask finetuning. Specifically, on EAI-Eval, the best performance is achieved by the encoder-decoder with MLM, and the non-causal decoder with MLM comes in a close second. However, the difference is more significant on T0-Eval, where the encoder-decoder with MLM pretraining outperforms other models by a large margin. Finally, encoder-decoder pretrained with PLM and causal decoder with MLM achieve significantly worse performance than other models. These results are consistent across all levels of pretraining (see early checkpoints in Appendix E). + +Finding 2. Encoder-decoder models pretrained with masked language modeling achieve the best zero-shot performance after multitask finetuning. More broadly, approaches that perform well in the single-task finetuning setting perform well on multitask finetuning. + +# 4.3. Influence of the tasks and prompts used for zero-shot evaluation + +Although the datasets considered in EAI-Eval and T0-Eval have significant overlap (10 out of 11 T0 tasks are in EAI-Eval), the prompts are always different between the two benchmarks. The EAI prompts for these datasets were + +Table 1. After language modeling pretraining, the causal decoder (FLM) exhibits the best zero-shot performances, followed closely by the non-causal decoder (PLM). Average accuracy on EAI-Eval and T0-Eval after pretraining for 168B tokens. MLM pretraining is not considered here, as the models produced are not suitable for direct use in our zero-shot setting. Note that performance on T0-Eval remains close to random baseline. Best for each benchmark. + +
EAI-EVALT0-EVAL
Causal decoder44.242.4
Non-causal decoder43.541.8
Encoder-decoder39.941.7
Random baseline32.941.7
+ +![](images/b53aff3efb70740b236d3892624a2fa945a6776a1351f9a0463a92bb6afb25d7.jpg) +Figure 4. When considering multitask finetuning, the encoder-decoder pretrained with MLM significantly outperforms other models, with the non-causal decoder pretrained with MLM a close second on EAI-Eval. Detailed mean performance and spread compared to baselines on T0-Eval (left) and EAI-Eval (right) after multitask finetuning on T0-train set. The T5-LM and T0 results are taken from Sanh et al. (2021) and utilize T5.1.1-XXL model, which was pretrained for $7.6 \times$ the number of tokens used in this study. + +taken from Brown et al. (2020), who hand-tuned them to maximize performance of the GPT-3 models. In contrast, the T0-Eval prompts were sourced through a community effort with prompt diversity and naturalness as primary goals (Sanh et al., 2021). Consequently, on each task, the EAI prompt has higher performance than the average T0 prompt for all models and tends to be on par with the best T0 prompt. The difference is most pronounced for causal decoder language models without multitask finetuning, likely because this is a similar setting to GPT-3. This is reflected in the structure of the prompts, which tend not to explain the task to the reader like T0 evaluation prompts do, but instead, attempt to reformulate it as a language modeling task. + +In addition to this base performance discrepancy, EAI-Eval has less discrepancy between encoder-decoder models and the rest, and better performance for autoregressive decoder models. We untangle the effect of the difference in prompts and the different task sets by separately comparing performance on tasks that are in T0-Eval and those that are not, while always using EAI-Eval prompts, as shown in Figure 5. The set of EAI-Eval tasks considered in T0-Eval seems to lend itself better to encoder-decoder models than the rest. On non-T0-Eval tasks, in contrast, causal decoder performance shoots up dramatically, although a lot of the difference is driven by LAMBADA (Paperno et al., 2016a), a language modeling task. Nevertheless, we note that when considering wide and varied task aggregates, our high-level findings are mostly consistent across evaluation settings + +# 5. Can models be adapted from one architecture/objective to another? + +Our experimental study has led us to conclude the optimal architecture and objective choice for zero-shot performance depends on whether or not the model will ultimately un + +dergo multitask finetuning. While a decoder-only model pretrained with FLM achieves the best zero-shot performance if not, an encoder-decoder with MLM is best if multitask finetuning is applied. This is inconvenient, as the multitask finetuned encoder-decoder model may not be suitable for open-ended generative tasks that the decoder-only model excels at, while the decoder-only model will not be the best at many zero-shot tasks. + +In this section, we attempt a compromise between the two options above. We study the practice of adaptation: extending pretraining with a different architecture and/or objective. Our end-goal is to efficiently obtain two distinct models: one that leverages multitask finetuning to maximize zero-shot performance, and another that can be used for high-quality language generation. + +Language modeling adaptation (LM-A). First, we propose to pretrain a non-causal decoder model with a MLM objective and then further train the model as a causal decoder with a FLM objective. This conversion is simple, as the parameters and overall architecture can be kept the same, and only the attention mask needs to be switched. We note that we also attempted this adaptation from the decoder portion of an encoder-decoder model, but it performed significantly worse than training from scratch, as discussed in Appendix F.4. + +Validations losses are plotted in Figure 6, on the left. To achieve a loss comparable to the one achieved after 168B tokens of FLM pretraining, language modeling adaptation requires 105B additional tokens (a $1.6 \times$ speed-up). + +Non-causal masked language modeling adaptation (NC-A). To investigate alternative avenues for adaptation, we now introduce non-causal masked language modeling adaptation: starting from a causal decoder model pretrained with FLM, we then continue training the model as a non-causal decoder using a MLM objective. This is es + +![](images/dd52e2ef68be853587c1f151b56e3bf3567dfcf51857c80abb4f4306a1501464.jpg) +Figure 5. Decoder-only models perform better on EAI-Eval because of specific tasks, not because of differences in prompts used. Zero-shot performance on T0-Eval tasks (left) and non-T0-Eval tasks (right), both using EAI-Eval prompts to control for the influence of T0-Eval prompts. +Finding 3. Decoder-only models can be efficiently adapted from one architecture/objective prior to the other. Specifically, we recommend starting with a causal decoder-only model, pretraining it with a full language modeling objective, and then using non-causal masked language modeling adaptation before taking it through multitask finetuning. + +sentially the reverse of the language modeling adaptation setup, and the conversion is as easily undertaken by switching the attention mask as well. + +Validation losses are plotted in Figure 6, on the right. Convergence on the MLM pretraining objective is significantly accelerated: by a factor of $3.3 \times$ compared to training a non-causal decoder from scratch, and up to a factor $9.1 \times$ compared to training a causal decoder from scratch (both with MLM). This enables one to obtain both a zero-shot model and an excellent generative model for only $1.3 \times$ the cost of training a single model. + +Finally, we confirm that the improvement in validation loss also transfer to an improvement in zero-shot generalization. We evaluate the non-causal MLM adapted model, and check that it is better than the original causal decoder model pretrained with full language modeling, and control for the total number of training tokens. Specifically, we evaluate zero-shot performance after multitask finetuning in three settings: first, a causal decoder model pretrained with FLM for 219 billion tokens before multitask finetuning; second, a causal decoder model pretrained with FLM for 219 billion tokens and then multitask finetuned as a non-causal decoder model; and, third, a causal decoder model first trained with FLM for 168 billion tokens, then MLM-adapted as an non-causal model for 51 billion tokens, and finally multitask finetuned. All three variants are multitask finetuned for 13 billion tokens. Results are presented in Figure 7. We find that the MLM-adapted model performs best by a significant margin and outperforms every other model we considered on EAI-Eval. Furthermore, the measured zero-shot generalization is in line with the MLM-pretrained non-causal decoder reported in Figure 4, though it still lags behind the MLM-pretrained encoder-decoder, despite the adapted models having seen 51 billion additional tokens. + +# 6. Conclusion + +In this paper, we systematically studied the effects of pretraining objective and architecture choices on the zero-shot generalization abilities of large language models. Specifically, we compared language modeling and masked language modeling objectives applied to causal/non-causal decoder-only and encoder-decoder architectures with and without multitask finetuning. Notably, we found that the best objective and architecture is the opposite in these two settings when considering multitask finetuning or not: a causal decoder-only pretrained with full language modeling performs best without, whereas when adding a multitask finetuning step, an encoder-decoder pretrained with masked language modeling performs best. We therefore evaluate the practice of adaptation, to convert models across architectures and objectives. We found that a causal decoder-only model pretrained with full language modeling with additional masked language model training as a non-causal decoder-only model yields significant speedup in convergence over starting from scratch. This enables practitioners to get both an excellent generative model and a model that delivers good performance after multitask finetuning. In the future, we are interested in work producing architectures and objectives that perform well on both. We also hope to explore whether our insights apply to other architectural variants like sparsely-gated mixture-of-experts (Shazeer et al., 2017; Fedus et al., + +![](images/c6d3d886f58ac14a3610c1ce996aa1da8c80821561d5e4caf984915ebbe5ea8f.jpg) +Figure 6. Adaptation can efficiently convert non-causal decoder-only models pretrained with MLM into causal decoder-only models with FLM (left), and vice-versa (right). Validation loss when adapting decoder-only models to different architecture/objectives following pretraining. Left: A causal decoder-only pretrained with FLM from scratch compared to one initialised with weights from a non-causal pretrained with MLM for 168B tokens. Right: Causal and non-causal decoder-only models pretrained with MLM trained from scratch compared to a non-causal decoder-only model initialised with weights from a causal decoder-only model pretrained with FLM for 168B tokens and adapted with MLM. + +![](images/4c1c6e2e1f6a900ff7e330df2cb5333996391ff2e4c0de54b032f9414fad06af.jpg) + +![](images/0d412b2859ee1af56b2714174db530fc18d0f732199b1f6bc77bad3054279db9.jpg) +Figure 7. Applying non-causal MLM adaptation to a causal decoder-only FLM before multitask finetuning improves zero-shot performances Zero-shot generalization on T0-Eval (left) and EAI-Eval (right), for the T5-LM and T0 baselines, and for models from our study. Converting the model into a non-causal decoder for multitask finetuning only does not improve performance on T0-Eval. + +![](images/93db02d288604d4412ef333f4193b28e6a98e79c662b936b90bbdfc86474888d.jpg) + +![](images/6876c41bd58521eb1735eacf54bc5a12dfaa6505b7c4aea04ba4f003ad8507a4.jpg) + +2021; Lewis et al., 2021; Zoph et al., 2022), retrieval modules (Guu et al., 2020; Lewis et al., 2020), or parameter sharing (Lan et al., 2019; Dehghani et al., 2018). To facilitate future work, we release all models, code, and data used in our study. + +# Acknowledgements + +BigScience. This work was pursued as part of the BigScience research workshop. Specifically, this work was conducted by a the architecture & scaling group, seeking to establish the optimal architecture and pretraining objective for the final 176B parameter model produced by BigScience. We would also like to thank Stella Biderman for valuable comments. + +Compute. We thank the TPU Research Cloud team for providing us with generous access to TPUv4. We thank the TPUv4 Alpha team for providing technical support for this work, and notably James Bradbury. Pretrainings, adap + +tations, finetunings, and evaluations featured in this paper used TPUv4. + +This work was granted access to the HPC resources of Institut du développement et des ressources en informatique scientifique (IDRIS) du Centre national de la recherche scientifique (CNRS) under the allocation 2021-A0101012475 made by Grand équipement national de calcul intensif (GENCI). Specifically, early experiments on non-causal decoder models, which sparked this exhaustive study, were performed on the Jean Zay supercomputer of IDRIS. + +Author-specific funding. Daniel Hesslow has received funding from the European Union's Horizon 2020 research and innovation programme under the Marie Skłodowska-Curie grant agreement No 860360. + +![](images/d3d287b8e0ce91ef17c9d494c1a7ef5039c4775fb6420efcff762a8f0c35aff7.jpg) + +# References + +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. URL https://arxiv.org/abs/2005.14165. +Ben Wang and Aran Komatsuzaki. GPT-J-6B: A 6 Billion Parameter Autoregressive Language Model. https://github.com/kingoflolz/mesh-transformer-jax, May 2021. +Nan Du, Yanping Huang, Andrew M Dai, Simon Tong, Dmitry Lepikhin, Yuanzhong Xu, Maxim Krikun, Yanqi Zhou, Adams Wei Yu, Orhan Firat, et al. Glam: Efficient scaling of language models with mixture-of-experts. arXiv preprint arXiv:2112.06905, 2021. URL https://arxiv.org/abs/2112.06905. +Xi Victoria Lin, Todor Mihaylov, Mikel Artetxe, Tianlu Wang, Shuohui Chen, Daniel Simig, Myle Ott, Naman Goyal, Shruti Bhosale, Jingfei Du, et al. Few-shot learning with multilingual language models. arXiv preprint arXiv:2112.10668, 2021. URL https://arxiv.org/abs/2112.10668. +Jack W Rae, Sebastian Borgeaud, Trevor Cai, Katie Millican, Jordan Hoffmann, Francis Song, John Aslanides, Sarah Henderson, Roman Ring, Susannah Young, et al. Scaling language models: Methods, analysis & insights from training gopher. arXiv preprint arXiv:2112.11446, 2021. URL https://arxiv.org/abs/2112.11446. +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. arXiv preprint arXiv:2203.15556, 2022. URL https://arxiv.org/abs/2203.15556. +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 Levskaya, 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, Brennan 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. arXiv preprint arXiv:2204.02311, 2022. URL https://arxiv.org/abs/2204.02311. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pages 5998-6008, 2017. +Peter J Liu, Mohammad Saleh, Etienne Pot, Ben Goodrich, Ryan Sepassi, Lukasz Kaiser, and Noam Shazeer. Generating wikipedia by summarizing long sequences. In International Conference on Learning Representations, 2018. +Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training. OpenAI Blog, 2018. +Rami Al-Rfou, Dokook Choe, Noah Constant, Mandy Guo, and Llion Jones. Character-level language modeling with deeper self-attention. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 3159-3166, 2019. +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. Journal of Machine Learning Research, 21(140):1-67, 2020. URL http://jmlr.org/papers/v21/20-074.html. +Li Dong, Nan Yang, Wenhui Wang, Furu Wei, Xiaodong Liu, Yu Wang, Jianfeng Gao, Ming Zhou, and Hsiao-Wuen Hon. Unified language model pre-training for natural language understanding and generation. In Proceedings of the 33rd International Conference on Neural Information Processing Systems, pages 13063-13075, 2019. +Victor Sanh, Albert Webson, Colin Raffel, Stephen H Bach, Lintang Sutawika, Zaid Alyafeai, Antoine Chaffin, Arnaud Stiegler, Teven Le Scao, Arun Raja, et al. + +Multitask prompted training enables zero-shot task generalization. arXiv preprint arXiv:2110.08207, 2021. URL https://arxiv.org/abs/2110.08207. +Hanwei Xu, Yujun Chen, Yulun Du, Nan Shao, Yanggang Wang, Haiyu Li, and Zhilin Yang. Zeroprompt: Scaling prompt-based pretraining to 1,000 tasks improves zero-shot generalization. arXiv preprint arXiv:2201.06910, 2022. URL https://arxiv.org/abs/2201.06910. +Jason Wei, Maarten Bosma, Vincent Y Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew M Dai, and Quoc V Le. Finetuned language models are zero-shot learners. arXiv preprint arXiv:2109.01652, 2021. URL https://arxiv.org/abs/2109.01652. +Andrew M Dai and Quoc V Le. Semi-supervised sequence learning. Advances in neural information processing systems, 28:3079-3087, 2015. +Wilson L Taylor. "cloze procedure": A new tool for measuring readability. Journalism quarterly, 30(4):415-433, 1953. +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. URL https://arxiv.org/abs/1810.04805. +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. arXiv preprint arXiv:1910.10683, abs/1910.10683, 2019. URL http://arxiv.org/abs/1910.10683. +Mandar Joshi, Danqi Chen, Yinhan Liu, Daniel S Weld, Luke Zettlemoyer, and Omer Levy. Spanbert: Improving pre-training by representing and predicting spans. Transactions of the Association for Computational Linguistics, 8:64-77, 2020. +Guillaume Lample and Alexis Conneau. Crosslingual language model pretraining. arXiv preprint arXiv:1901.07291, 2019. URL https://arxiv.org/abs/1901.07291. +Elena Voita, Rico Senrich, and Ivan Titov. The bottom-up evolution of representations in the transformer: A study with machine translation and language modeling objectives. arXiv preprint arXiv:1909.01380, 2019. URL https://arxiv.org/abs/1909.01380. +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. + +Brian Lester, Rami Al-Rfou, and Noah Constant. The power of scale for parameter-efficient prompt tuning. arXiv preprint arXiv:2104.08691, 2021. URL https://arxiv.org/abs/2104.08691. +Sharan Narang, Hyung Won Chung, Yi Tay, William Fedus, Thibault Févry, 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? arXiv preprint arXiv:2102.11972, abs/2102.11972, 2021. URL https://arxiv.org/abs/2102.11972. +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. +Jianpeng Cheng, Li Dong, and Mirella Lapata. Long short-term memory-networks for machine reading. arXiv preprint arXiv:1601.06733, 2016. URL https://arxiv.org/abs/1601.06733. +Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E. Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016. URL https://arxiv.org/abs/1607.06450. +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, 2016. +Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov, and Luke Zettlemoyer. Bart: Denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension. arXiv preprint arXiv:1910.13461, 2019. URL https://arxiv.org/abs/1910.13461. +Wei Zeng, Xiaozhe Ren, Teng Su, Hui Wang, Yi Liao, Zhiwei Wang, Xin Jiang, ZhenZhang Yang, Kaisheng Wang, Xiaoda Zhang, et al. Pangu-alpha: Large-scale autoregressive pretrained chinese language models with auto-parallel computation. arXiv preprint arXiv:2104.12369, 2021. URL https://arxiv.org/abs/2104.12369. +Boseop Kim, HyoungSeok Kim, Sang-Woo Lee, Gichang Lee, Donghyun Kwak, Dong Hyeon Jeon, Sunghyun Park, Sungju Kim, Seonhoon Kim, Dongpil Seo, et al. + +What changes can large-scale language models bring? intensive study on hyperclova: Billions-scale korean generative pretrained transformers. arXiv preprint arXiv:2109.04650, 2021. URL https://arxiv.org/abs/2109.04650. +Shaden Smith, Mostofa Patwary, Brandon Norick, Patrick LeGresley, Samyam Rajbhandari, Jared Casper, Zhun Liu, Shrimai Prabhumoye, George Zerveas, Vijay Korthikanti, et al. Using deepspeed and megatron to train megatron-turing nlg 530b, a large-scale generative language model. arXiv preprint arXiv:2201.11990, 2022. URL https://arxiv.org/abs/2201.11990. +Romal Thoppilan, Daniel De Freitas, Jamie Hall, Noam Shazeer, Apoorv Kulshreshtha, Heng-Tze Cheng, Alicia Jin, Taylor Bos, Leslie Baker, Yu Du, et al. Lamda: Language models for dialog applications. arXiv preprint arXiv:2201.08239, 2022. URL https://arxiv.org/abs/2201.08239. +Shaohua Wu, Xudong Zhao, Tong Yu, Rongguo Zhang, Chong Shen, Hongli Liu, Feng Li, Hong Zhu, Jian-gang Luo, Liang Xu, et al. Yuan 1.0: Large-scale pretrained language model in zero-shot and few-shot learning. arXiv preprint arXiv:2110.04725, 2021. URL https://arxiv.org/abs/2110.04725. +Alexandre Tamborrino, Nicola Pellicano, Baptiste Pannier, Pascal Voitot, and Louise Naudin. Pre-training is (almost) all you need: An application to commonsense reasoning. arXiv preprint arXiv:2004.14074, 2020. URL https://arxiv.org/abs/2004.14074. +Pedro Javier Ortiz Suárez, Benoit Sagot, and Laurent Romary. Asynchronous pipelines for processing huge corpora on medium to low resource infrastructures. In Proceedings of the Workshop on Challenges in the Management of Large Corpora, 2019. +Leo Gao, Stella Biderman, Sid Black, Laurence Golding, Travis Hoppe, Charles Foster, Jason Phang, Horace He, Anish Thite, Noa Nabeshima, Shawn Presser, and Connor Leahy. The Pile: An 800gb dataset of diverse text for language modeling. arXiv preprint arXiv:2101.00027, 2020. URL https://arxiv.org/abs/2101.00027. +Tven Le Scao, Thomas Wang, Daniel Hesslow, Lucile Saulnier, Stas Bekman, M Saiful Bari, Stella Biderman, Hady Elsahar, Jason Phang, Ofir Press, Colin Raffel, Victor Sanh, Sheng Shen, Lintang Sutawika, Jaesung Tae, Zheng Xin Yong, Julien Launay, and Iz Beltagy. What language model to train if you have one million GPU hours? In Challenges & Perspectives in Creating Large Language Models, 2022. URL https://openreview.net/forum?id=rI7BL3fHIZq. + +Adam Roberts, Hyung Won Chung, Anselm Levskaya, Gaurav Mishra, James Bradbury, Daniel Andor, Sharan Narang, Brian Lester, Colin Gaffney, Afroz Mohiuddin, Curtis Hawthorne, Aitor Lewkowycz, Alex Salcianu, Marc van Zee, Jacob Austin, Sebastian Goodman, Livio Baldini Soares, Haitang Hu, Sasha Tsvyashchenko, Aakanksha Chowdhery, Jasmijn Bastings, Jannis Bulian, Xavier Garcia, Jianmo Ni, Andrew Chen, Kathleen Kenealy, Jonathan H. Clark, Stephan Lee, Dan Garrette, James Lee-Thorp, Colin Raffel, Noam Shazeer, Marvin Ritter, Maarten Bosma, Alexandre Passos, Jeremy Maitin-Shepard, Noah Fiedel, Mark Omernick, Brennan Saeta, Ryan Sepassi, Alexander Spiridonov, Joshua Newlan, and Andrea Gesmundo. Scaling up models and data with t5x and seqio. arXiv preprint arXiv:2203.17189, 2022. URL https://arxiv.org/abs/2203.17189. +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. URL http://github.com/google/jax. +Jonathan Heek, Anselm Levskaya, Avital Oliver, Marvin Ritter, Bertrand Rondepierre, Andreas Steiner, and Marc van Zee. Flax: A neural network library and ecosystem for JAX, 2020. URL http://github.com/google/flax. +Noam Shazeer and Mitchell Stern. Adafactor: Adaptive learning rates with sublinear memory cost. In International Conference on Machine Learning, pages 4596-4604. PMLR, 2018. +Denis Paperno, Germán Kruszewski, Angeliki Lazari-dou, Quan Ngoc Pham, Raffaella Bernardi, Sandro Pezzelle, Marco Baroni, Gemma Boleda, and Raquel Fernandez. The LAMBADA dataset: Word prediction requiring a broad discourse context. arXiv preprint arXiv:1606.06031, abs/1606.06031, 2016a. URL http://arxiv.org/abs/1606.06031. +Noam Shazeer, Azalia Mirhoseini, Krzysztof Maziarz, Andy Davis, Quoc Le, Geoffrey Hinton, and Jeff Dean. Outrageously large neural networks: The sparsely-gated mixture-of-experts layer. arXiv preprint arXiv:1701.06538, 2017. +William Fedus, Barret Zoph, and Noam Shazeer. Switch transformers: Scaling to trillion parameter models with simple and efficient sparsity. arXiv preprint arXiv:2101.03961, 2021. +Mike Lewis, Shruti Bhosale, Tim Dettmers, Naman Goyal, and Luke Zettlemoyer. Base layers: Simplifying training + +of large, sparse models. In International Conference on Machine Learning, 2021. +Barret Zoph, Irwan Bello, Sameer Kumar, Nan Du, Yanping Huang, Jeff Dean, Noam Shazeer, and William Fedus. Designing effective sparse expert models. arXiv preprint arXiv:2202.08906, 2022. +Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Ming-Wei Chang. Realm: Retrievalaugmented language model pre-training. arXiv preprint arXiv:2002.08909, 2020. +Patrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Küttler, Mike Lewis, Wen-tau Yih, Tim Rocktäschel, Sebastian Riedel, and Douwe Kiela. Retrieval-augmented generation for knowledge-intensive nlp tasks. In Advances in Neural Information Processing Systems, 2020. +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. +Mostafa Dehghani, Stephan Gouws, Oriol Vinyals, Jakob Uszkoreit, and Łukasz Kaiser. Universal transformers. arXiv preprint arXiv:1807.03819, 2018. +Noam Shazeer. Glu variants improve transformer. arXiv preprint arXiv:2002.05202, 2020. URL https:// arxiv.org/abs/2002.05202. +Irene Solaiman, Miles Brundage, Jack Clark, Amanda Askell, Ariel Herbert-Voss, Jeff Wu, Alec Radford, Gretchen Krueger, Jong Wook Kim, Sarah Kreps, et al. Release strategies and the social impacts of language models. arXiv preprint arXiv:1908.09203, 2019. URL https://arxiv.org/abs/1908.09203. +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. URL https://arxiv.org/abs/2108.07258. +Sidney Black, Stella Biderman, Eric Hallahan, Quentin Gregory Anthony, Leo Gao, Laurence Golding, Horace He, Connor Leahy, Kyle McDonell, Jason Phang, Michael Martin Pieler, USVSN Sai Prashanth, Shivanshu Purohit, Laria Reynolds, Jonathan Tow, Ben Wang, and Samuel Weinbach. GPT-neox-20b: An open-source autoregressive language model. In *Challenges & Perspectives in Creating Large Language Models*, 2022. URL https://openreview.net/forum?id=HL7IhzS8W5. + +Sara Hooker. Moving beyond "algorithmic bias is a data problem". Patterns, 2(4):100241, 2021. +David Patterson, Joseph Gonzalez, Quoc Le, Chen Liang, Lluis-Miquel Munguia, Daniel Rothchild, David So, Maud Texier, and Jeff Dean. Carbon emissions and large neural network training. arXiv preprint arXiv:2104.10350, 2021. URL https://arxiv.org/abs/2104.10350. +Peter Clark, Isaac Cowhey, Oren Etzioni, Tushar Khot, Ashish Sabharwal, Carissa Schoenick, and Oyvind Tafjord. Think you have solved question answering? try arc, the AI2 reasoning challenge. arXiv preprint arXiv:1803.05457, abs/1803.05457, 2018. URL http://arxiv.org/abs/1803.05457. +William B Dolan and Chris Brockett. Automatically constructing a corpus of sentential paraphrases. In Proceedings of the Third International Workshop on Paraphrasing (IWP2005), 2005. +Shankar Iyer, Nikhil Dandekar, and Kornel Cser +nai. First quora dataset release: Question pairs, 2017. URL https://data.quora.com/ +First-Quora-Dataset-Release-Question-Pairs. +Rowan Zellers, Ari Holtzman, Yonatan Bisk, Ali Farhadi, and Yejin Choi. HellaSwag: Can a machine really finish your sentence? In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 4791-4800, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1472. URL https://aclanthology.org/P19-1472. +Denis Paperno, Germán Kruszewski, Angeliki Lazaridou, Ngoc Quan Pham, Raffaella Bernardi, Sandro Pezzelle, Marco Baroni, Gemma Boleda, and Raquel Fernández. The LAMBADA dataset: Word prediction requiring a broad discourse context. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1525-1534, Berlin, Germany, August 2016b. Association for Computational Linguistics. doi: 10.18653/v1/P16-1144. URL https://aclanthology.org/P16-1144. +Jian Liu, Leyang Cui, Hanmeng Liu, Dandan Huang, Yile Wang, and Yue Zhang. Logiqa: A challenge dataset for machine reading comprehension with logical reasoning. arXiv preprint arXiv:2007.08124, abs/2007.08124, 2020. URL https://arxiv.org/abs/2007.08124. +Aida Amini, Saadia Gabriel, Shanchuan Lin, Rik Koncel-Kedziorski, Yejin Choi, and Hannaneh Hajishirzi. MathQA: Towards interpretable math word problem + +solving with operation-based formalisms. 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), pages 2357-2367, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-1245. URL https://aclanthology.org/N19-1245. +Todor Mihaylov, Peter Clark, Tushar Khot, and Ashish Sabharwal. Can a suit of armor conduct electricity? a new dataset for open book question answering. In EMNLP, 2018. +Yonatan Bisk, Rowan Zellers, Ronan Le Bras, Jianfeng Gao, and Yejin Choi. Piqa: Reasoning about physical commonsense in natural language. In Thirty-Fourth AAAI Conference on Artificial Intelligence, 2020. +Stéphane Aroca-Ouellette, Cory Paik, Alessandro Roncone, and Katharina Kann. PROST: Physical reasoning about objects through space and time. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, pages 4597-4608, Online, August 2021. Association for Computational Linguistics. URL https://aclanthology.org/2021.findings-acl.404. +Qiao Jin, Bhuwan Dhingra, Zhengping Liu, William Cohen, and Xinghua Lu. Pubmedqa: A dataset for biomedical research question answering. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 2567-2577, 2019. +Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. Squad: 100,000+ questions for machine comprehension of text. arXiv preprint arXiv:1606.05250, 2016. URL https://arxiv.org/abs/1606.05250. +Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. GLUE: A multitask benchmark and analysis platform for natural language understanding. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id=rJ4km2R5t7. +Guokun Lai, Qizhe Xie, Hanxiao Liu, Yiming Yang, and Eduard Hovy. Race: Large-scale reading comprehension dataset from examinations. arXiv preprint arXiv:1704.04683, 2017. URL https://arxiv.org/abs/1704.04683. +Johannes Welbl, Nelson F Liu, and Matt Gardner. Crowdsourcing multiple choice science questions. In Proceed- + +ings of the 3rd Workshop on Noisy User-generated Text, pages 94-106, 2017. +Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D Manning, Andrew Ng, and Christopher Potts. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 conference on empirical methods in natural language processing, pages 1631-1642, 2013. +Christopher Clark, Kenton Lee, Ming-Wei Chang, Tom Kwiatkowski, Michael Collins, and Kristina Toutanova. *Boolq: Exploring the surprising difficulty of natural yes/no questions.* In *NAACL*, 2019. +Andrew Gordon, Zornitsa Kozareva, and Melissa Roemmele. SemEval-2012 task 7: Choice of plausible alternatives: An evaluation of commonsense causal reasoning. In *SEM 2012: The First Joint Conference on Lexical and Computational Semantics - Volume 1: Proceedings of the main conference and the shared task, and Volume 2: Proceedings of the Sixth International Workshop on Semantic Evaluation (SemEval 2012), pages 394-398, Montreal, Canada, 7-8 June 2012. Association for Computational Linguistics. URL https://aclanthology.org/S12-1052. +Daniel Khashabi, Snigdha Chaturvedi, Michael Roth, Shyam Upadhyay, and Dan Roth. Looking beyond the surface: a challenge set for reading comprehension over multiple sentences. In Proceedings of North American Chapter of the Association for Computational Linguistics (NAACL), 2018. +Ido Dagan, Oren Glickman, and Bernardo Magnini. The pascal recognising textual entailment challenge. In *Machine Learning Challenges Workshop*, pages 177-190. Springer, 2005. +Mohammad Taher Pilehvar and os'e Camacho-Collados. Wic: 10, 000 example pairs for evaluating context-sensitive representations. arXiv preprint arXiv:1808.09121, abs/1808.09121, 2018. URL http://arxiv.org/abs/1808.09121. +Hector Levesque, Ernest Davis, and Leora Morgenstern. The winograd schema challenge. In Thirteenth International Conference on the Principles of Knowledge Representation and Reasoning, 2012. +Mandar Joshi, Eunsol Choi, Daniel S. Weld, and Luke Zettlemoyer. Triviaqa: A large scale distantly supervised challenge dataset for reading comprehension. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, Vancouver, Canada, July 2017. Association for Computational Linguistics. + +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, pages 1533-1544, 2013. +Keisuke Sakaguchi, Ronan Le Bras, Chandra Bhagavatula, and Yejin Choi. Winogrande: An adversarial winograd schema challenge at scale. arXiv preprint arXiv:1907.10641, 2019. URL https://arxiv.org/abs/1907.10641. + +# A. Experiment configurations + +# A.1. Architecture configurations + +Table 2. Shared architecture for all models trained. Encoder-decoder architectures are doubled in size to obtain a pretraining compute budget similar to the decoder-only architecture. + +
MODELS ARCHITECTURE
Decoder-onlyEncoder-decoder
Parameters4.8B11.0B
Vocabulary32,128
Positional embed.T5 relative
Embedding dim.4,096
Attention heads64
Feedforward dim.10,240
ActivationGEGLU (Shazeer, 2020)
Layers2448
Tied embeddingsTrue
Precisionbfloat16
+ +# A.2. Training configurations + +Table 3. Pretraining and multitask finetuning configurations for all models trained. Pretraining lasts for 168 billion tokens, while multitask finetuning is done for 13 billion tokens. + +
PRETRAININGMULTITASK FINE-TUNING
DatasetC4T0-Train
Steps131,07210,000
Batch size in tokens1,282,0481,310,720
OptimizerAdafactor(decay_rate=0.8)
LR schedule1/√max(n,10^4)fixed, 0.001
Dropout0.00.1
z loss0.0001
Precisionbfloat16
+ +# B. Contributions + +Thomas Wang wrote code, ran experiments, performed evaluation, generated plots, and helped with paper writing. Adam Roberts led the creation of the codebase used in this project, proposed some experiments, ran all of the final experiments, generated plots, and helped with paper writing. Daniel Hesslow made it possible to evaluate models with the EleutherAI harness, created diagrams, and helped with paper writing. Teven Le Scao ran evaluations and plotted results. Hyung Won Chung implemented infrastructure code for different architectural and objective variants. Iz Beltagy co-chaired the BigScience Architecture & Scaling Group and helped with paper editing. Julien Launay co-chaired the BigScience Architecture & Scaling Group and had the largest role in paper writing. Colin Raffel proposed + +the project, the experiments, and the adaptation methods and wrote portions of the paper. + +# C. Broader impacts + +# C.1. Societal impact + +The risks and societal challenges raised by large language models have been discussed extensively in the literature (Solaiman et al., 2019; Bommasani et al., 2021). Our research is strictly oriented on benchmarking modeling aspects, and thus does not introduce any novel challenge beside those already identified. Notably, many similarly capable models have already been released publicly in the past (Raffel et al., 2020; Wang and Komatsuzaki, 2021; Sanh et al., 2021; Black et al., 2022). + +In the spirit of reproducibility and openness, we release all artefacts produced during this study: the configs necessary to reproduce our results from scratch, checkpoints of all of the models trained, and detailed evaluation results. These artefacts are intended for research only: we did not evaluate the potential biases of the models trained, and cannot guarantee they won't produce harmful content. Accordingly, these models should not be used in production or exposed to the public. + +We also highlight that algorithmic choices can introduce biases on their own (Hooker, 2021): one limitation of our study is that we did not explore whether specific architectures and objectives had an impact on the toxicity and biases of a given model. However, the public availability of all the models trained for this study enables researchers to conduct such a follow-up study at minimal compute cost. + +# C.2. Environmental impact + +Across all experiments undertaken over the course of this study (including unreported preliminary and failed experiments), we performed training for 1,854 hours on 64 chips (TPUv4-128) and 1,395 hours on 512 TPUv4 chips (TPUv4-1024) for a total of 832,896 chip-hours. Recently, Chowdhery et al. (2022) presented the results of training a 540 billion parameter language model on TPUv4 chips in the same datacenter where we ran our experiments. Their model was trained for 1,200 hours on 6,144 TPUv4 chips and 336 hours on 3,072 TPUv4 chips, for a total of 8,404,992 chip-hours. Chowdhery et al. (2022) estimates the carbon emissions of their model training to be 240.5 tCO2e based on the net tCO2e per MWh of the datacenter during training and the energy usage of TPUv4 chips. We therefore estimate our carbon emissions to be approximately 23.8 tCO2e, which is approximately half of what (Patterson et al., 2021) report for the original T5 model training (46.7 tCO2). + +# D. Implementation: prefix language modeling for encoder-decoder on TPU + +Due to constant size constraints, for encoder-decoder with prefix language modeling, we have to concatenate two examples of 626 tokens into one. We randomly sample an index $i$ between 0 and 626, and use $i$ and $626 - i$ as prefix indices in the two examples. We use masking to keep them independent throughout training. The encoder-decoder thus has a 1,252 sequence length, and we train it with a batch size of 1,024 sequences instead of 2,048 to keep the number of tokens constant. + +# E. Evaluation: benchmarks composition and baselines + +We detail the split across EAI-Eval and T0-Eval in Table 4, and provide random baselines in Table 5. + +# F. Additional results + +# F.1. Preliminary results and evolution throughout pretraining + +Leveraging early pretraining results at 42B and 84B tokens, we motivate in this section two special design decisions in our study: + +- Not considering span corruption for evaluation after pretraining only. In Table 1, we only report zero-shot generalization results immediately after pretraining for the full and prefix language modeling objectives. We choose not to report results when using a masked language modeling objective, as Table 6 demonstrates that after 84B tokens of pretraining, models pretrained with this objective still achieve close to random performance, and severely underperform models pretrained with prefix or full language modeling. +- Not systematically performing LM adaptation before multitask finetuning. Sanh et al. (2021) originally perform LM adaptation before multitask finetuning. As outlined in Table 7, using early models pretrained for 42B tokens, we found this practice did not consistently improve zero-shot generalization, and in fact worsened it in most cases. Accordingly, results in Figure 4 do not use LM adaptation before multitask finetuning. This is in line with the findings of Lester et al. (2021) that larger models (of the same scale that we are considering in our study) do not benefit from performing LM adaptation before prompt tuning. + +# F.2. Complete Results + +We report results for all intermediary checkpoints produced in Table 8, and specifically for all multitask finetuned checkpoints on T0-Eval in Figure 8. + +# F.3. Impact of dropout on multitask finetuning + +We also performed multitask finetuning without using dropout, with results in Figure 9. We find that using dropout as originally suggested by Sanh et al. (2021) significantly boosts zero-shot generalization. Results are consistent across architectures and pretraining objectives. + +# F.4. Adaptation from an encoder-decoder + +When studying adaptation and the conversion from one architecture to another, we also considered converting to and from encoder-decoder models. Conversion across causal and non-causal decoder-only models is straightforward, simply by switching the attention mask; for encoder-decoder, parameters have to be either pruned or added for both the entire encoder, and for the cross-attention in the decoder. Results from one of our attempt to convert an encoder-decoder into a causal decoder are reported in Figure 10. While converting across causal/non-causal decoder provides an improvement over training from scratch, this is not the case here. + +Table 4. Tasks used for zero-shot evaluation within EAI-Eval and T0-Eval, as well as tasks included in the T0 training set for multitask finetuning. Note that T0-Eval/Training tasks include multiple prompts, while EAI-Eval tasks have a single prompt. Although tasks are shared between the two, there are no shared prompts between EAI-Eval and T0-Eval. + +
TASKTYPEDATASET
T0 TrainingEAI-EvalT0-Eval
ANLINatural Language Inference✓✓
ARC (Clark et al., 2018)ChallengeClosed-Book Question Answering✓
EasyClosed-Book Question Answering✓
GLUEMRPC (Dolan and Brockett, 2005)Paraphrase Identification✓✓
QQP (Iyer et al., 2017)Paraphrase Identification✓✓
HEAD-QAMultiple-Choice Question Answering✓
HellaSwag (Zellers et al., 2019)Sentence Completion✓✓
LAMBADA (Paperno et al., 2016b)Sentence Completion✓
LogiQA (Liu et al., 2020)Multiple-Choice Question Answering✓
MathQA (Amini et al., 2019)Multiple-Choice Question Answering✓
OpenBookQA (Mihaylov et al., 2018)Multiple-Choice Question Answering✓
PIQA (Bisk et al., 2020)Multiple-Choice Question Answering✓
PROST (Aroca-Ouellette et al., 2021)Multiple-Choice Question Answering✓
PudMedQA (Jin et al., 2019)Multiple-Choice Question Answering✓
QNLI (Rajpurkar et al., 2016; Wang et al., 2019)Sentence Completion✓
Race (Lai et al., 2017)Multiple-Choice Question Answering✓
SciQ (Welbl et al., 2017)Multiple-Choice Question Answering✓✓
SST (Socher et al., 2013) (Socher et al., 2013)Sentiment✓
StoryClozeSentence Completion✓
SuperGLUEBoolq (Clark et al., 2019)Multiple-Choice Question Answering✓
CBNatural Language Inference✓✓
COPA (Gordon et al., 2012)Sentence Completion✓✓
MultiRC (Khashabi et al., 2018)Multiple-Choice Question Answering✓
RTE (Dagan et al., 2005)Natural Language Inference✓✓
WIC (Pilehvar and os'e Camacho-Collados, 2018)Word Sense Disambiguation✓✓
WSC (Levesque et al., 2012)Word Sense Disambiguation✓✓
TriviaQA (Joshi et al., 2017)Closed-Book Question Answering✓
WebQuestions (Berant et al., 2013)Closed-Book Question Answering✓
Winogrande (Sakaguchi et al., 2019)Coreference resolution✓✓
WNLI (Sakaguchi et al., 2019)Natural language inference✓
+ +![](images/735474cf9bc0aacf051db6e2053a61aacb021b620b4b04689fa4a8f12e61bc55.jpg) +Figure 8. Performance on T0-Eval after multitask finetuning for increasing amounts of pretraining (measured in tokens). Our best model, an encoder-decoder trained with masked language modeling, is already above the final performance of the other configurations with only a quarter of the pretraining tokens. Note that the ordering does not change significantly throughout pretraining. + +![](images/e2ca42da0364418063bdcf9f43798a3a50e416a92f2fcf8a8107ef2e56024f99.jpg) +Figure 9. Using dropout during multitask finetuning improves zero-shot generalization. Performance on T0-Eval with and without dropout. The impact of dropout is proportionally similar across architecture and objectives, not benefitting any specific configuration more. + +![](images/27f04f966d5d73497e04a4d3089d10fc3ca956229e475b7b2967c9d4a503f5d0.jpg) +Figure 10. Converting an encoder-decoder pretrained with MLM to a causal decoder-only using FLM leads to worse performance compared to training from scratch. Validation loss when adapting an encoder-decoder pretrained with MLM to a causal decoder-only using FLM. We adapted a pretrained (for 168B tokens) encoder-decoder model to decoder-only by feeding an empty input into the encoder and causally training with a FLM objective on the decoder. We stopped this adaptation once it was clear the performance would not match that of a causal FLM trained from scratch, in contrast with the other adaptations we studied. + +Table 5. Random baselines for all tasks considered across EAI harness and T0 Eval. These baselines were obtained from the papers introducing these tasks. + +
TASKRANDOM BASELINE
ANLI33.3
ARCChallenge25.0
Easy25.0
GLUEMRPC50.0
QQP50.0
HEAD-QA25.0
HellaSwag25.0
LAMBADA0.0
LogiQA25.0
MathQA20.1
OpenBookQA25.0
PIQA50.0
PROST25.0
PudMedQA33.3
QNLI50.0
Race25.0
SciQ25.0
SST50.0
StoryCloze50.0
SuperGLUEBoolq50.0
CB50.0
COPA50.0
MultiRC5.8
RTE50.0
WIC50.0
WSC50.0
TriviaQA0.0
WebQuestions0.0
Winogrande50.0
WNLI50.0
EAI-EVAL33.3
T0-EVAL41.7
+ +Table 6. Models pretrained with masked language modeling achieve performance close to the random $33.3\%$ baseline on EAI-Eval, significantly underperforming full and prefix language modeling. Average accuracy on EAI-Eval after pretraining for 84B tokens. This observations leads us to not consider masked language modeling for evaluations after pretraining only. + +
EAI-EVAL
FLM/PLM
Causal decoder42.4
Non-causal decoder42.2
Encoder-decoder39.6
MLM
Causal decoder37.8
Non-causal decoder37.7
Encoder-decoder34.6
+ +Table 7. Performing LM adaptation before multitask finetuning does not improve results, and in fact hinders performance in most cases. Average accuracy on EAI-Eval and T0-Eval for different adaptation strategies after 42B tokens of masked language modeling pretraining. LM adaptation alone is insufficient, and most performance gains come from MT finetuning. Accordingly, we diverge from the setup of Sanh et al. (2021), and forego systematic LM adaptation before multitask finetuning. + +
EAI-EVALT0-EVAL
LM ADAPTATION
Causal decoder38.643.9
Non-causal decoder39.540.8
Encoder-decoder38.639.1
MT FINETUNING
Causal decoder43.345.8
Non-causal decoder45.948.9
Encoder-decoder45.453.7
LM-A+MT FINETUNING
Causal decoder43.946.7
Non-causal decoder45.048.0
Encoder-decoder45.752.6
+ +Table 8. Average accuracy on EAI-EVal and T0 Eval for all experiments. Experiments are represented as a combination of architecture:objective (tokens) training stages, where architecture is one of causal decoder-only (CD), non-causal decoder-only (ND), or encoder-decoder (ED), and objective is one of full language modeling (FLM), prefix language modeling (PLM), masked language modeling (MLM), or multitask finetuning (MTF). + +
PRETRAININGTRAINING STAGE ADAPTATIONFINETUNINGTOTAL TAXENSEAI-EVALT0-EVAL
CD:MLM(38B)CD:FLM(4B)42B38.643.9
ND:MLM(38B)ND:PLM(4B)42B39.540.8
ED:MLM(38B)ED:MLM(4B)42B38.639.1
CD:MLM(42B)CD:MTF(13B)55B43.345.8
ND:MLM(42B)ND:MTF(13B)55B45.948.9
ED:MLM(42B)ED:MTF(13B)55B45.453.7
CD:MLM(38B)CD:FLM(4B)CD:MTF(13B)55B43.946.7
ND:MLM(38B)ND:PLM(4B)ND:MTF(13B)55B45.048.0
ED:MLM(38B)ED:PLM(4B)ED:MTF(13B)55B45.752.6
CD:FLM(84B)84B42.4-
ND:PLM(84B)84B42.2-
ED:PLM(84B)84B39.6-
CD:MLM(84B)84B37.8-
ND:MLM(84B)84B37.7-
ED:MLM(84B)84B34.6-
CD:FLM(84B)CD:MTF(13B)97B49.049.9
ND:PLM(84B)ND:MTF(13B)97B46.350.0
ED:PLM(84B)ED:MTF(13B)97B43.246.5
CD:MLM(84B)CD:MTF(13B)97B45.848.2
ND:MLM(84B)ND:MTF(13B)97B49.052.6
ED:MLM(84B)ED:MTF(13B)97B49.056.5
CD:FLM(168B)168B44.242.4
ND:PLM(168B)168B43.541.8
ED:PLM(168B)168B39.941.7
CD:FLM(168B)CD:MTF(13B)181B50.451.4
ND:PLM(168B)ND:MTF(13B)181B48.954.0
ED:PLM(168B)ED:MTF(13B)181B44.245.8
CD:MLM(168B)CD:MTF(13B)181B47.150.3
ND:MLM(168B)ND:MTF(13B)181B51.055.2
ED:MLM(168B)ED:MTF(13B)181B51.360.6
CD:FLM(168B)CD:FLM(51B)CD:MTF(13B)232B51.352.1
CD:FLM(168B)CD:FLM(51B)ND:MTF(13B)232B52.352.0
CD:FLM(168B)ND:MLM(51B)ND:MTF(13B)232B52.354.9
T5-LM BASELINE (LESTER ET AL., 2021)
ED:MLM(1.28T)ED:PLM(131B)1.41T39.043.2
T0 BASELINE (SANH ET AL., 2021)
ED:MLM(1.28T)ED:PLM(131B)ED:MTF(13B)1.43T52.262.5
RANDOM BASELINE-32.941.7
\ No newline at end of file diff --git a/whatlanguagemodelarchitectureandpretrainingobjectiveworksbestforzeroshotgeneralization/images.zip b/whatlanguagemodelarchitectureandpretrainingobjectiveworksbestforzeroshotgeneralization/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..16b9c7118c5909f70b4399f1431e5d34b79d408a --- /dev/null +++ b/whatlanguagemodelarchitectureandpretrainingobjectiveworksbestforzeroshotgeneralization/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:47c7d81c6b61f5dee02c377cf65408db4fce519c5fed8fdd5a1a82114c6a3963 +size 861736 diff --git a/whatlanguagemodelarchitectureandpretrainingobjectiveworksbestforzeroshotgeneralization/layout.json b/whatlanguagemodelarchitectureandpretrainingobjectiveworksbestforzeroshotgeneralization/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..c4f1e60720cf0b75db179d01c6735ae4d25f4202 --- /dev/null +++ b/whatlanguagemodelarchitectureandpretrainingobjectiveworksbestforzeroshotgeneralization/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:85afb8ff6eae76e2e0840c6ead50a503828571853bfce470bb29912890475390 +size 483711 diff --git a/whenandhowmixupimprovescalibration/22dc9abe-f5a2-4bdd-98a2-aeae5d3f5c94_content_list.json b/whenandhowmixupimprovescalibration/22dc9abe-f5a2-4bdd-98a2-aeae5d3f5c94_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..929112e4cdddb7d7673b6e55e5beb96ddfcdf702 --- /dev/null +++ b/whenandhowmixupimprovescalibration/22dc9abe-f5a2-4bdd-98a2-aeae5d3f5c94_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1928e080073b1eff8ae0caec4007ae8552a8b61ee384c7992069e9de6fb332c4 +size 204496 diff --git a/whenandhowmixupimprovescalibration/22dc9abe-f5a2-4bdd-98a2-aeae5d3f5c94_model.json b/whenandhowmixupimprovescalibration/22dc9abe-f5a2-4bdd-98a2-aeae5d3f5c94_model.json new file mode 100644 index 0000000000000000000000000000000000000000..194a49bfd7f8440b4fea4af87e447495c3060e85 --- /dev/null +++ b/whenandhowmixupimprovescalibration/22dc9abe-f5a2-4bdd-98a2-aeae5d3f5c94_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6185707ab876820c66ca49032308f3b6f868aa5858c9bf8e7d8930933ce54c02 +size 240641 diff --git a/whenandhowmixupimprovescalibration/22dc9abe-f5a2-4bdd-98a2-aeae5d3f5c94_origin.pdf b/whenandhowmixupimprovescalibration/22dc9abe-f5a2-4bdd-98a2-aeae5d3f5c94_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..e25ecf34f313aa750e8e020484c61d7b63153530 --- /dev/null +++ b/whenandhowmixupimprovescalibration/22dc9abe-f5a2-4bdd-98a2-aeae5d3f5c94_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e0bcc0f45ed4c2f58341ea24563dea68746d9bb6d426e93e88c38054b7108386 +size 1686147 diff --git a/whenandhowmixupimprovescalibration/full.md b/whenandhowmixupimprovescalibration/full.md new file mode 100644 index 0000000000000000000000000000000000000000..c3e1615a4390a258caf9fd36e613594abf93e789 --- /dev/null +++ b/whenandhowmixupimprovescalibration/full.md @@ -0,0 +1,1263 @@ +# When and How Mixup Improves Calibration + +Linjun Zhang*1 Zhun Deng*2 Kenji Kawaguchi3 James Zou4 + +# Abstract + +In many machine learning applications, it is important for the model to provide confidence scores that accurately capture its prediction uncertainty. Although modern learning methods have achieved great success in predictive accuracy, generating calibrated confidence scores remains a major challenge. Mixup, a popular yet simple data augmentation technique based on taking convex combinations of pairs of training examples, has been empirically found to significantly improve confidence calibration across diverse applications. However, when and how Mixup helps calibration is still a mystery. In this paper, we theoretically prove that Mixup improves calibration in high-dimensional settings by investigating natural statistical models. Interestingly, the calibration benefit of Mixup increases as the model capacity increases. We support our theories with experiments on common architectures and datasets. In addition, we study how Mixup improves calibration in semi-supervised learning. While incorporating unlabeled data can sometimes make the model less calibrated, adding Mixup training mitigates this issue and provably improves calibration. Our analysis provides new insights and a framework to understand Mixup and calibration. + +# 1. Introduction + +Modern machine learning methods have dramatically improved the predictive accuracy in many learning tasks (Simonyan & Zisserman, 2014; Srivastava et al., 2015; He et al., 2016a). The deployment of AI-based systems in high risk fields such as medical diagnosis (Jiang et al., 2012) requires a predictive model to be trustworthy, which makes the topic of accurately quantifying the predictive uncertainty an + +*Equal contribution $^{1}$ Rutgers University $^{2}$ Harvard University $^{3}$ National University of Singapore $^{4}$ Stanford University. Correspondence to: Linjun Zhang , Zhun Deng . + +Proceedings of the $39^{th}$ International Conference on Machine Learning, Baltimore, Maryland, USA, PMLR 162, 2022. Copyright 2022 by the author(s). + +increasingly important problem (Thulasidasan et al., 2019). However, as pointed out by Guo et al. (2017), many popular modern architectures such as neural networks are very poorly calibrated. A variety of methods have been proposed for quantifying predictive uncertainty including training multiple probabilistic models with ensembling or bootstrap (Osband et al., 2016) and re-calibration of probabilities on a validation set through temperature scaling (Platt et al., 1999), which usually involves much more complicated procedures and extra computation. Meanwhile, recent work (Thulasidasan et al., 2019) has shown that models trained with Mixup (Zhang et al., 2017), a simple data augmentation technique based on taking convex combinations of pairs of examples and their labels, are significantly better calibrated. However, when and how Mixup helps calibration is still not well-understood, especially from a theoretical perspective. + +As our first contribution, we demonstrate that the calibration improvement brought by Mixup is more significant in the high-dimensional settings, i.e. the number of parameters is comparable to the training sample size. Figure 1 shows a motivating experiment on CIFAR-10. The Expected Calibration Error (ECE), which is a standard measure of how un-calibrated a model is, is smaller with Mixup augmentation compared to those without Mixup augmentation, especially when the model is wider or deeper. We provide a theoretical explanation for this phenomenon under several natural statistical models. In particular, our theory holds when the data distribution can be described by a Gaussian generative model, which is very flexible and includes many generative adversarial networks (GANs). In a Gaussian generative model, a function is used to map a Gaussian random variable to an input vector of some models such as neural networks. Because the function used to map a Gaussian random variable is arbitrary and can be nonlinear, our theory is applicable to a very broad class of data distributions. + +As our second contribution, we investigate how Mixup helps calibration in semi-supervised learning, which is relatively under-explored. Labeled data are usually expensive to obtain, and training models by combining a small amount of labeled data with abundant unlabeled data plays an important role in AI (Chapelle et al., 2009). In light of this, we investigate the effect of Mixup in semi-supervised learning, where we focus on the commonly used pseudo-labeling algorithm (Chapelle et al., 2009; Carmon et al., 2019). We + +![](images/3ba07bde28f57d955b342b89a48613dddaa03a5344db191a2f1f78932ca85c5f.jpg) +(a) Network width + +![](images/c0a540b9f669b441dc575953591c2d185dcda66c427b17daed0bb2674e81863b.jpg) +(b) Network depth +Figure 1. Expected calibration error (ECE) calculated for a fully-connected neural network on CIFAR-10. In (a), we fix the depth and increase the width of the neural network; while in (b), we fix the width and increase the depth of the neural network. Mixup augmentation can reduce ECE especially for larger capacity models. + +observe experimentally that the pseudo-labeling by itself can sometimes hurt calibration. However, combining Mixup with pseudo-labeling consistently improves calibration. We provide theories to explain these findings. + +As our third contribution, we further extend our results to Maximum Calibration Error (MCE), which also demonstrates similar phenomena as those for ECE. + +Outline of the paper. Section 2 discusses related works and introduces the notations. In Section 3, we present our main theoretical results for ECE by showing that Mixup improves calibration for classification problems in the high-dimensional regime. Section 4 investigates the semi-supervised learning setting and demonstrates the benefit of further applying Mixup to the pseudo-labeling algorithm. In Section 5, we extend our studies of calibration to MCE. Section 6 concludes with a discussion of future work. Proofs are deferred to the Appendix. + +# 1.1. Related Work + +Mixup is a popular data augmentation scheme that has been shown to improve a model's prediction accuracy (Zhang et al., 2017; Thulasidasan et al., 2019; Guo et al., 2019). Recent theoretical analysis shows that Mixup has an implicit regularization effect that enables models to better generalize (Zhang et al., 2020). The focus of our work is not on accuracy, but on calibration. + +Modern learning models such as neural networks have achieved remarkable performance nowadays in optimization (Deng et al., 2020a; Ji et al., 2021b; Deng et al., 2021c; Ji et al., 2021a; Kawaguchi et al., 2022). Even though the generalization and prediction (Deng et al., 2020b; Zhang et al., 2020; Deng et al., 2021a) of neural networks are quite amazing, it has shown that neural networks tend to be over-confident. A well-calibrated predictive model is needed in many applications of machine learning, ranging from economics (Foster & Vohra, 1997), personalized medicine (Jiang et al., 2012), to weather forecasting (Gneit- + +ing & Raftery, 2005), to fraud detection (Bahnsen et al., 2014). The problem on producing a well-calibrated model has received increasing attention in recent years (Naeini et al., 2015; Lakshminarayanan et al., 2016; Guo et al., 2017; Zhao et al., 2020; Foster & Stine, 2004; Kuleshov et al., 2018; Wen et al., 2020; Huang et al., 2020). In real-world settings, the input distributions are sometimes shifted from the training distribution due to non-stationarity. The predictive uncertainty under such out-of-distribution condition was studied by Ovadia et al. (2019) and Chan et al. (2020). Mixup has been empirically shown to improve the calibration for deep neural networks in both the same and out-of-distribution domains (Thulasidasan et al., 2019; Tomani & Buettner, 2020). Ours is the first work to provide theoretical explanation for this phenomenon. + +Semi-supervised learning is a broad field in machine learning concerned with learning from both labeled and unlabeled datasets (Chapelle et al., 2009). Prior work mostly focuses on improving the prediction accuracy with unlabeled data (Zhu et al., 2003; Zhu & Goldberg, 2009; Berthelot et al., 2019) and adversarial robustness (Carmon et al., 2019; Deng et al., 2021b). Recently, Chan et al. (2020) found that unlabeled data improves Bayesian uncertainty calibration in some experiments, but the relationship between using unlabeled data and calibration, especially from the theoretical perspective, is still largely unknown. All of the facts above motivate our theoretical exploration in this paper. + +# 2. Preliminaries + +In this section, We introduce the notations and briefly recap the mathematical formulation of Mixup and calibration measures considered in this paper. + +# 2.1. Notations + +We denote the training data set by $S = \{(x_1, y_1), \dots, (x_n, y_n)\}$ , where $x_i \in \mathcal{X} \subseteq \mathbb{R}^d$ and $y_i \in \mathcal{Y} \subseteq \mathbb{R}^m$ are drawn i.i.d. from a joint distribution $\mathcal{P}_{x,y}$ . The general parameterized loss is denoted by $l(\theta, z)$ where $\theta \in \Theta \subseteq \mathbb{R}^p$ and $z_i = (x_i, y_i)$ denotes the input and output pair. Let $L(\theta) = \mathbb{E}_{z \sim \mathcal{P}_{x,y}} l(\theta, z)$ denote the standard population loss and $L_n^{std}(\theta, S) = \sum_{i=1}^n l(\theta, z_i) / n$ denote the standard empirical loss. In addition, we define $\tilde{x}_{i,j}(\lambda) = \lambda x_i + (1 - \lambda)x_j$ , $\tilde{y}_{i,j}(\lambda) = \lambda y_i + (1 - \lambda)y_j$ , and $\tilde{z}_{i,j}(\lambda) = (\tilde{x}_{i,j}(\lambda), \tilde{y}_{i,j}(\lambda))$ for $\lambda \in [0,1]$ . We use $t\mathcal{D}_1 + (1 - t)\mathcal{D}_2$ for $t \in (0,1)$ to denote the mixture distribution such that a sample coming from that distribution is drawn with probabilities $t$ and $(1 - t)$ from $\mathcal{D}_1$ and $\mathcal{D}_2$ respectively. In classification, the output $y_i$ is the embedding of the class of $x_i$ ; i.e., $y_i \in \{0,1\}^m$ is the one-hot encoding of the class (with all entries equal to zero except for the one corresponding to the class of $x_i$ ), where $m$ is the total number of classes. + +# 2.2. Mixup + +Mixup is a data augmentation technique, which linearly interpolates the training sample pairs within the training data set to create a new data set $S^{mix}(\lambda) = \{(\tilde{z}_{i,j}(\lambda))\}_{i,j=1}^n$ , with $\lambda$ following a distribution $\mathcal{D}_{\lambda}$ supported on $[0,1]$ . Throughout the paper, we consider the most commonly used $\mathcal{D}_{\lambda}$ — the Beta distribution $Beta(\alpha, \beta)$ for $\alpha, \beta > 0$ . + +Typically, in a machine learning task, one wants to learn a function $f: \mathcal{X} \to \mathcal{Y}$ from a function class $\mathcal{F}$ using the training data set $S \in (\mathcal{X} \times \mathcal{Y})^n$ . Such a function is usually parametrized as $f_{\theta}$ with some parameter $\theta$ . Let us denote the learned parameter by $\hat{\theta} = \mathcal{M}(S)$ . In this paper, we consider learning the parameter by the Mixup training $\mathcal{M}(S^{mix}(\lambda))$ . Due to the randomness in $\lambda$ , we consider taking the expectation over $\lambda$ . For example, a mapping could either be an estimator, such as the empirical mean of input: $\mathcal{M}(S) = \sum_{i=1}^{n} x_i / n$ , or be the minimizer of a loss function: $\mathcal{M}(S, \theta) = \operatorname*{argmin}_{\theta} \sum_{i=1}^{n} l(\theta, z_i) / n$ . The corresponding transformed mappings obtained via Mixup are then $\mathbb{E}_{\lambda \sim \mathcal{D}_\lambda} \mathcal{M}(S^{mix}(\lambda)) = \sum_{i,j=1}^{n} \mathbb{E}_{\lambda \sim \mathcal{D}_\lambda} x_{i,j}(\lambda) / n^2$ and $\mathbb{E}_{\lambda \sim \mathcal{D}_\lambda} \mathcal{M}(S^{mix}(\lambda), \theta) = \sum_{i,j=1}^{n} \mathbb{E}_{\lambda \sim \mathcal{D}_\lambda} l(\theta, \tilde{z}_{i,j}(\lambda)) / n^2$ respectively. + +# 2.3. Calibration for classification + +For a classification problem, if there are $K$ classes, typically, for an input $x$ , a probability vector $\hat{h}(x) = (p_1(x), \dots, p_K(x))^{\top} \in \mathbb{R}^K$ is obtained from the trained model, where $p_i$ is the corresponding probability (or so-called confidence score) that $x$ belongs to the class $i$ , and $\sum_{i=1}^{K} p_i = 1$ . Then, the output is $\hat{y} = \operatorname{argmax}_i p_i(x)$ . The hope is that, for instance, given 1000 samples, each with confidence 0.7, around 700 examples should be classified correctly. In other words, we expect for all $v \in [0,1]$ , $\mathbb{P}(\hat{y} = y | \hat{p} = v) \approx v$ , where $\hat{p}$ is the largest entry in $\hat{h}(x)$ and $y$ is the true class $x$ belongs to, which is termed as prediction confidence. + +Expected Calibration Error (ECE). The most prevalent calibration metric is the Expected Calibration Error (Naeini et al., 2015), which is defined as, + +$$ +E C E = \mathbb {E} _ {v \sim \mathcal {D} _ {\hat {p}}} [ | \mathbb {P} (\hat {y} = y | \hat {p} = v) - v | ], \tag {1} +$$ + +where $\mathcal{D}_{\hat{p}}$ is the distribution of $\hat{p}$ . While ECE is widely used, we note that recent works (Nixon et al., 2019; Kumar et al., 2019) found that some methods of estimating ECE in practice (such as the binning method) is sometimes undesirable and can produce biased estimator under some specially constructed data distributions. Throughout this paper, in our theories, we mainly focus on the population version of calibration error as defined in (1), which does not suffer from any such bias. + +Maximum Calibration Error (MCE). Another widely used calibration metric is the Maximum Calibration Error (Naeini et al., 2015), which is defined as + +$$ +M C E = \max _ {v \in [ 0, 1 ]} | \mathbb {P} (\hat {y} = y | \hat {p} = v) - v |. +$$ + +Again, in our theory, we will only consider this population version of MCE. A predictor $\hat{p}$ with ECE/MCE equal to 0 is said to be perfectly calibrated. + +# 3. Calibration in Supervised Learning + +Although Mixup has been shown to improve the test accuracy (Zhang et al., 2017; Guo et al., 2019; Zhang et al., 2020), there has been much less understanding of how it affects model calibration1. In this section, we focus on investigating when and how Mixup improves calibration. + +# 3.1. Problem set-up + +As a confirmation of the phenomenon suggested in Figure 1 in the introduction, our theoretical results demonstrate that Mixup indeed improves calibration, and the improvement is especially significant in the high-dimensional regime. Here, by high-dimensional regime, we mean when the number of parameters in the model, $p$ , is comparable to the sample size $n$ , i.e. $p / n > c$ for some constant $c > 0$ . In other words, the improvement in calibration by using Mixup is more significant in the over-parameterized case or when the ratio between $p$ and $n$ is a constant asymptotically larger than 0. Moreover, we also prove that Mixup helps calibration on out-of-domain data, which is critical for machine learning applications. + +In order to derive tractable analysis, we first study the concrete and natural Gaussian model. The Gaussian model is a popular setting for understanding phenomena happening in more complex models due to its tractability in theory and its ability to partially capture some essence of the phenomena. Indeed, the Gaussian model has been widely used in theoretical investigations of more complex machine learning models such as neural networks in adversarial learning (Schmidt et al., 2018; Carmon et al., 2019; Dan et al., 2020; Deng et al., 2021b). We further extend our analysis to the very flexible Gaussian generative models in Section 3.4. + +The Gaussian model. We consider a common model used for theoretical machine learning analysis: a mixture of two spherical Gaussians with one component per class (Carmon et al., 2019): + +Definition 3.1 (Gaussian model). For $\theta^{*} \in \mathbb{R}^{p}$ and $\sigma > 0$ , the $(\theta^{*}, \sigma)$ -Gaussian model is defined as the following + +distribution over $(x,y)\in \mathbb{R}^p\times \{1, - 1\}$ .. + +$$ +x \mid y \sim \mathcal {N} (y \cdot \theta^ {*}, \sigma^ {2} I), f o r i = 1, 2, \dots , n, +$$ + +and $y$ follows the Bernoulli distribution $\mathbb{P}(y = 1) = \mathbb{P}(y = -1) = 1 / 2$ . + +For simplicity, we first consider the case where $\sigma$ is known, and the only unknown parameter is $\mu$ . The case where $\sigma$ is unknown is a special example of the general Gaussian generative model that we will consider in Section 3.4. + +Algorithms. In this section, we focus on studying the following linear classifier for the Gaussian classification. Specifically, the classifier follows the celebrated Fisher's rule (Johnson et al., 2002), or so-called linear discriminant analysis, which is also considered by Carmon et al. (2019) to study the adversarial robustness. The classifier is constructed as + +$$ +\hat {\mathcal {C}} (x) = \operatorname {s g n} \left(\hat {\theta} ^ {\top} x\right), \tag {2} +$$ + +where $\hat{\theta} = \sum_{i=1}^{n} x_i y_i / n$ . Given $\hat{\theta}$ and $x$ , the output $y$ obtained via classifier $\hat{C}$ can be equivalently defined by the following process: we first obtain the confidence vector $h(x) = (p_1(x), p_{-1}(x))^{\top}$ , and then output $y = \hat{C}(x) = \operatorname{argmax}_{k \in \{-1,1\}} p_k(x)$ . Here, for $k \in \{-1,1\}$ , the confidence score $p_k(x)$ represents an estimator of $\mathbb{P}(y = k|x)$ and therefore takes the following form: + +$$ +p _ {k} (x) = \frac {1}{e ^ {- 2 k \cdot \hat {\theta} ^ {\top} x _ {i} / \sigma^ {2}} + 1}. \tag {3} +$$ + +In comparison, by applying Mixup to the above algorithm, we first obtain $\{\tilde{x}_{i,j}(\lambda),\tilde{y}_{i,j}(\lambda)\}_{i,j = 1}^{n}$ , which leads to another classifier + +$$ +\hat {\mathcal {C}} ^ {m i x} (x) = \operatorname {s g n} \left(\hat {\theta} ^ {m i x \top} x\right), \tag {4} +$$ + +where $\hat{\theta}^{mix} = \mathbb{E}_{\lambda \sim \mathcal{D}_{\lambda}}\sum_{i,j = 1}^{n}\tilde{x}_{i,j}(\lambda)\tilde{y}_{i,j}(\lambda) / n^2$ . Here, given the randomness of $\lambda$ , we take expectation with respect to $\lambda$ in the same way as in the previous study (Zhang et al., 2017), though this is unnecessary in our theoretical analysis. The confidence score obtained by $\hat{\mathcal{C}}^{mix}$ can be obtained similarly to that in Eq. (3) with $\hat{\theta}$ being replaced by $\hat{\theta}^{mix}$ . + +# 3.2. Mixup helps calibration in classification + +We follow the convention in high-dimensional statistics, where the parameter dimension $p$ grows along with the sample size $n$ , and state our theorem in the large $n, p$ regime where both $n$ and $p$ goes to infinity. + +Throughout the paper, we use the term "with high probability" to indicate that the event happens with probability at least $1 - o(1)$ , where $o(1) \to 0$ as $n \to \infty$ and the randomness is taken over the training data set. In the following, we + +show that the condition $p / n = \Omega(1)$ is necessary and the fact that Mixup improves calibration is a high-dimensional phenomenon. + +Let us denote the ECE calculated with respect to $\hat{C}$ and $\hat{C}^{mix}$ by $\mathrm{ECE}(\hat{C})$ and $\mathrm{ECE}(\hat{C}^{mix})$ respectively. Our first theorem states that Mixup indeed improves calibration for the above algorithm under the Gaussian model. + +Theorem 3.1. Under the settings described above, there exists $c_2 > c_1 > 0$ , when $p / n \in (c_1, c_2)$ and $\| \theta \|_2 < C$ for some universal constants $C > 0$ (not depending on $n$ and $p$ ), then for sufficiently large $p$ and $n$ , there exist $\alpha, \beta > 0$ such that when the distribution $\mathcal{D}_{\lambda}$ is chosen as $\text{Beta}(\alpha, \beta)$ with high probability, + +$$ +E C E (\hat {\mathcal {C}} ^ {m i x}) < E C E (\hat {\mathcal {C}}). +$$ + +The above theorem states that when $p$ is comparable to $n$ and $p / n$ is not too small, applying Mixup leads to a better calibration than without applying Mixup. In the very next theorem, we further demonstrate that the condition " $p$ and $n$ are comparable" is necessary for Mixup to reach a smaller ECE. + +Theorem 3.2. There exists a threshold $\tau = o(1)$ such that if $p / n\leq \tau$ and $\| \theta \| _2 < C$ for some universal constant $C > 0$ given any constants $\alpha ,\beta >0$ (not depending on $n$ and $p$ when $n$ is sufficiently large, we have, with high probability, + +$$ +E C E (\hat {\mathcal {C}}) < E C E (\hat {\mathcal {C}} ^ {m i x}). +$$ + +In Theorem 3.2, we can see if $p$ is too small compared with $n$ , then applying Mixup cannot have any gain and even hurts the calibration. + +Usually, in the implementation of Mixup, we first fix $\alpha$ and $\beta$ before training, and the above theorem reveals the fact that in the low-dimensional regime, where $p / n$ is sufficiently close to 0, the Mixup could not help calibration with high probability. Moreover, combined with Theorem 3.3 stated below, which characterizes the monotonic relationship between $p / n$ and the improvement brought by Mixup, we can see Mixup helps calibration more when the dimension is higher. + +For the ease of presentation, for all $\beta > 0$ , let us define $\mathit{Beta}(0,\beta)$ as the degenerated distribution which takes the only value at 0 with probability one. We also define $\hat{\mathcal{C}}_{\alpha,\beta}^{mix}$ as the classifier where we apply Mixup with distribution $\lambda \sim \mathit{Beta}(\alpha,\beta)$ . + +Theorem 3.3. For any constant $c_{\mathrm{max}} > 0$ , $p / n \to c_{\mathrm{ratio}} \in (0, c^{\mathrm{max}})$ , when $\theta$ is sufficiently large (still of a constant level), we have for any $\beta > 0$ , with high probability, the change of ECE by using Mixup, characterized by + +$$ +\frac {d}{d \alpha} E C E (\hat {\mathcal {C}} _ {\alpha , \beta} ^ {m i x}) | _ {\alpha \rightarrow 0 +} +$$ + +is negative, and monotonically decreasing with respect to $c_{\text{ratio}}$ . + +In Theorem 3.3, the derivative with respect to $\alpha$ is interpreted as follows. Since for any $\beta > 0$ , $Beta(0, \beta)$ is the degenerated distribution at $0$ , $\hat{\theta}^{mix}(0, \beta)$ corresponds to the output without Mixup. Therefore, increasing $\alpha$ from $0$ to some positive value implies applying Mixup. Thus, Theorem 3.3 suggests that in high-dimensions, increasing the interpolation range in Mixup decreases ECE. + +Intuition behind our results. In the high-dimensional regime, especially in the over-parameterized case $(p > n)$ , the models have more flexibility to set the confidence vectors. For instance, for trained neural networks, the entries of the confidence vectors for many data points are all close to zero except for one entry, whose value is close to 1, because the model is trained to memorize the training labels. Mixup mitigates this problem by using linear interpolation that creates one-hot encoding terms with entry values lying between $(0,1)$ , which pushes the value of entries to diverge. This could be partially addressed in our analysis above, as the magnitude of the confidence is closely related to $\|\hat{\theta}\|$ , i.e. when $\|\hat{\theta}\|$ is large, the confidence scores are more likely to be close to 0 or 1. Mixup, as a form of regularization (Zhang et al., 2020), could shrink $\|\hat{\theta}\|$ and avoid too extreme confidence scores. + +Additional supporting experiments. To complement our theory, we further provide more experimental evidence on popular image classification data sets with neural networks. We used the fully-connected neural networks with various values of the width (i.e. the number of neurons per hidden layer) and the depth (i.e., the number of hidden layers). For the experiments on the effect of the width, we fixed the depth to be 8 and varied the width from 10 to 3000. For the experiments on the effect of the depth, the depth was varied from 1 to 24 (i.e., from 3 to 26 layers including input/output layers) by fixing the width to be 400 with data-augmentation and 80 without data-augmentation. We used the following standard data-augmentation operations using torchvisiontransforms for both data sets: random crop (via RandomCrop (32, padding=4) and random horizontal flip (via RandomHorizontalFlip) for each image. In this experiment, we used the standard data sets — CIFAR-10 and CIFAR-100 (Krizhevsky & Hinton, 2009). We used stochastic gradient descent (SGD) with mini-batch size of 64. We set the learning rate to be 0.01 and momentum coefficient to be 0.9. We used the Beta distribution $\beta (\alpha ,\alpha)$ with $\alpha = 1.0$ for Mixup. The results are reported in Figure 1 and 2 with a fully-connected neural network. Consistently across all the experiments, Mixup reduces ECE for larger capacity models and can hurt ECE for small models, which matches our theory. For reasons + +![](images/902a3a7aee571d4fd35e7343341ee7bb4187d2cfa249c4b87f7400a4fa566fcb.jpg) + +![](images/812ae36aa8b445702aae031730ad81d123b0c2fd65eef49b53f1fcb8bda206da.jpg) +(a) Width + +![](images/18b1f2a1ac66e330affb579a6c5c711249cae869734cf42e5d20fc66fef675a8.jpg) +(c) Width +(e) Width +Figure 2. Expected calibration error (ECE). (a), (b): CIFAR-10 without data augmentation; (c), (d): CIFAR-100 with data augmentation; (e), (f): CIFAR-100 without data augmentation. + +![](images/66dafaf18e5e77bff34df9bbd629fad5c873ed33d66e422c2df89fdd08b24e30.jpg) + +![](images/9940006af1e2469c6d8829c2eac79eff907cd5b479d7df4110ae3019c0e57fa5.jpg) +(b) Depth + +![](images/1eef006cac33cc5d0f0bde5815c0d033736cc27600c065dc2e37071881c7f5e5.jpg) +(d) Depth +(f) Depth + +of space, since our focus is mainly on the calibration, the empirical results regarding test accuracy for each figure are deferred to the Appendix. + +# 3.3. Improvement for out-of-domain data + +In this section, we evaluate the quality of predictive uncertainty on out-of-domain inputs. It has been found empirically that in the out-of-domain setting, Mixup can also enhance the reliability of prediction and boost the performance in calibration comparing to the standard training (without Mixup) (Thulasidasan et al., 2019; Tomani & Buettner, 2020). To explain the above phenomenon, using the similar analysis as those for Theorem 3.1, we provide the following theorem. + +Theorem 3.4. Let us consider the ECE evaluated on the out-of-domain Gaussian model with mean parameter $\theta'$ , that is, $\mathbb{P}(y = 1) = \mathbb{P}(y = -1) = 1/2$ , and $x \mid y \sim \mathcal{N}(y \cdot \theta', \sigma^2 I)$ , for $i = 1, 2, \dots, n$ . If we have $(\theta' - \theta^*)^\top \theta^* \leq p/(2n)$ , then when $p$ and $n$ are sufficiently large, with high probability, + +$$ +E C E (\hat {\mathcal {C}} ^ {m i x}; \theta^ {\prime}, \sigma) < E C E (\hat {\mathcal {C}}; \theta^ {\prime}, \sigma), +$$ + +where $ECE(\cdot ;\theta^{\prime},\sigma)$ denotes the expected calibration error calculated with respect to the out-of-domain distribution - the Gaussian model with parameters $\theta^\prime$ and $\sigma$ , while $\hat{C}^{mix}$ + +and $\hat{\mathcal{C}}$ are still obtained via (2) and (4) via the in-domain training data. + +The above theorem states the continuity of the boosting effect of Mixup over the domain shift. As long as the domain shift is not too large, Mixup still helps calibration. + +# 3.4. Gaussian generative model + +Now let us consider a more general class of distributions, the Gaussian generative model, which is a flexible distribution and has been commonly considered in the machine learning literature. For example, many common deep generative models such as Generative Adversarial Nets (GANs) (Goodfellow et al., 2014) are Gaussian generative models, where the input is a Gaussian sample. + +Definition 3.2 (Gaussian generative model). For $\theta^{*} \in \mathbb{R}^{p}$ and $g: \mathbb{R}^{p} \to \mathbb{R}^{d}$ ( $d \geq p$ ), the $(\theta^{*}, g)$ -Gaussian model is defined as the following distribution over $(x, y) \in \mathbb{R}^{d} \times \{1, -1\}$ , $x = g(z)$ , where: + +$$ +z \mid y \sim \mathcal {N} (y \cdot \theta^ {*}, I), f o r i = 1, 2, \dots , n, +$$ + +and $y$ follows the Bernoulli distribution $\mathbb{P}(y = 1) = \mathbb{P}(y = -1) = 1 / 2$ . + +Now suppose we can learn an $h \in \{h : h \circ g$ is an identity mapping in $\mathbb{R}^p\}$ approximately such that the estimator $\hat{h}$ satisfies the following condition. + +Assumption 3.1. For any given $v \in \mathbb{R}^p$ , $k \in \{-1,1\}$ , there exists a $\theta^{*} \in \mathbb{R}^{p}$ such that given $y = k$ , the probability density function of $R_{1} = v^{\top}\hat{h}(x)$ and $R_{2} = v^{\top}h(x) = v^{\top}z \sim N(k \cdot b^{\top}\theta^{*}, \|v\|^{2})$ satisfies that $p_{R_1}(u) = p_{R_2}(u) \cdot (1 + \delta_u)$ for all $u \in \mathbb{R}$ where $\delta_u$ satisfies $\mathbb{E}_{R_1}[|\delta_u|] = o(1)$ when $n \to \infty$ . + +As a special case of Definition 3.2, we consider the Gaussian model with unknown $\sigma$ . Estimating $\sigma$ by + +$$ +\hat {\sigma} = \sqrt {\| \sum_ {i = 1} ^ {n} (x _ {i} - y _ {i} \hat {\theta}) \| ^ {2} / p n} +$$ + +will satisfy Assumption 3.1 when $\| \theta^{*} \| < C$ for some universal constant $C$ . In practice, for more general cases, we can learn such $h$ following the framework of GANs. For example, + +$$ +\hat {h} = \operatorname {a r g m i n} _ {h} \max _ {k \in \{- 1, 1 \}} \mathcal {W} (h (x), z \mid y), +$$ + +where $z$ is the Gaussian mixture defined in Definition 3.2 with $\theta^{*} = 1_{p} / \sqrt{p}$ and $\sigma = 1$ , and $\mathcal{W}(\cdot, \cdot)$ denotes the Wasserstein distance. Due to the flexibility of $h$ , the choice of $\theta^{*}$ and $\sigma$ will not impact the training process. + +Now we consider the following two classifiers: + +$$ +\hat {\mathcal {C}} (x) = \operatorname {s g n} (\hat {\theta} ^ {\top} \hat {h} (x)), +$$ + +where $\hat{\theta} = \sum_{i=1}^{n} \hat{h}(x_i) y_i / n$ , and + +$$ +\hat {\mathcal {C}} ^ {m i x} (x) = \operatorname {s g n} \left(\hat {\theta} ^ {m i x \top} \hat {h} (x)\right) +$$ + +where + +$$ +\hat {\theta} ^ {m i x} = \sum_ {i, j = 1} ^ {n} \mathbb {E} _ {\lambda \sim \mathcal {D} _ {\lambda}} (\lambda \hat {h} (x _ {i}) + (1 - \lambda) \hat {h} (x _ {j})) \cdot \tilde {y} _ {i, j} (\lambda) / n ^ {2}. +$$ + +Similarly, for a generic $\hat{\theta}$ , the confidence scores are given by + +$$ +p _ {k} (x) = 1 / (e ^ {- 2 k \cdot \hat {\theta} ^ {\top} \hat {h} (x)} + 1). +$$ + +We then have the following result showing that under the more general Gaussian generative model, the Mixup method could still provably lead to an improvement on the calibration. + +Theorem 3.5. Under the settings described above with Assumption 3.1, there exists $c_2 > c_1 > 0$ , when $p / n \in (c_1, c_2)$ , $\hat{h}$ is L-Lipschitz, and $\| \theta \|_2 < C$ for some universal constants $L, C > 0$ (not depending on $n$ and $p$ ), then for sufficiently large $p$ and $n$ , there exist $\alpha, \beta > 0$ for the Mixup distribution $\mathcal{D}_{\lambda} = \text{Beta}(\alpha, \beta)$ , such that, with high probability, + +$$ +E C E (\hat {\mathcal {C}} ^ {m i x}) < E C E (\hat {\mathcal {C}}). +$$ + +# 4. Mixup Improves Calibration in Semi-supervised Learning + +Data augmentation by incorporating cheap unlabeled data from multiple domains is a powerful way to improve prediction accuracy especially when there is limited labeled data. One of the commonly used semi-supervised learning algorithms is the pseudo-labeling algorithm (Chapelle et al., 2009), which first trains an initial classifier $\hat{C}_{init}$ on the labeled data, then assigns pseudo-labels to the unlabeled data using the $\hat{C}_{init}$ . Lastly, using the combined labeled and pseudo-labeled data to perform supervised learning and obtain a final classifier $\hat{C}_{final}$ . Previous work has shown that the pseudo-labeling algorithm has many benefits such as improving prediction accuracy and robustness against adversarial attacks (Carmon et al., 2019). However, as we observe from Figure 3c and 3d, incorporating unlabeled data via the pseudo-labeling algorithm does not always improve calibration; sometimes pseudo-labeling even hurts calibration. We find that further applying Mixup at the last step of pseudo-labeling algorithm mitigates this issue and improves calibration as shown in Figure 3. The details of the experimental setup are included in the Appendix + +We justify the empirical findings above by theoretically analyzing the calibration in the semi-supervised learning setting. Specifically, we assume we have $n_l$ labeled data points $\{x_i, y_i\}_{i=1}^{n_l}$ and $n_u$ unlabeled data points $\{x_i^u\}_{i=1}^{n_u}$ . + +![](images/67e9f0dbc122fda31554432be564b4129f44ebc68f426c69b17e52a965d78fd8.jpg) + +![](images/50f73c150939951859b976b452043ef3ca2132db8860c1ca0f64575b2d72d22a.jpg) +(b) Fashion-MNIST + +![](images/4969a0c24c3b37025f9de3d6d7b9d6995673da664c0409e34cec22fd7e5c9bd9.jpg) +(a) Kuzushiji-MNIST +(c) CIFAR-10 + +![](images/3f8dc877f19a9073d66c99dd175d201270ab0370ccec599b46b8c8eb5b5eb316.jpg) +(d) CIFAR-100 +Figure 3. ECE calculated for ResNets on varieties of data sets. In (a) and (b), using only pseudo-label algorithm improves calibration, while in (c) and (d), using only pseudo-label algorithm hurts calibration. Further applying Mixup in the last step of pseudo-label algorithm promotes calibration in both cases. The pseudo-labels (or p-labels in short) are inserted into training at the midpoint of the entire training: i.e., at epoch = 100 for (a), (b) and (d) and epoch = 200 for (c). + +i.i.d. sampled from the $(\theta^{*},\sigma)$ -Gaussian model in Definition 3.1. The pseudo-labeling algorithm is the same as the one considered in Carmon et al. (2019), which is shown in Algorithm 1. + +We then present two theorems. The first theorem demonstrates that when the labeled data is not sufficient, then under some mild conditions, the unlabeled data will help the calibration. The second theorem characterizes settings + +# Algorithm 1 The pseudo-labeling algorithm + +Step 1: Obtain an initial classifier + +$$ +\hat {\mathcal {C}} _ {i n i t} (x) = \operatorname {s g n} \left(\hat {\theta} _ {i n i t} ^ {\top} x\right), +$$ + +where $\hat{\theta}_{init} = \sum_{i=1}^{n_l} x_i y_i / n_l$ . + +Step 2: Apply $\hat{C}_{init}$ on the unlabeled data set $\{x_i^u\}_{i=1}^{n_u}$ , and obtain pseudo-labels $y_i^u = \hat{C}_{init}(x_i^u)$ for $i \in [n_u]$ . + +Step 3: Obtain the final classifier $\hat{C}_{final}(x) = sgn(\hat{\theta}_{final}^{\top}x)$ , where + +$$ +\hat {\theta} _ {f i n a l} = \frac {1}{n _ {l} + n _ {u}} \left(\sum_ {i = 1} ^ {n _ {l}} x _ {i} y _ {i} + \sum_ {i = 1} ^ {n _ {u}} x _ {i} ^ {u} y _ {i} ^ {u}\right) +$$ + +where the standard pseudo-labeling algorithm (Algorithm 1) makes calibration worse and increases ECE. + +Theorem 4.1. Suppose $C_1\sqrt{p / n_l} \leq \| \theta \| \leq C_2\sqrt{p / n_l}$ for some universal constant $C_1 < 1 / 2$ and $C_2 > 2$ , when $p / n_l$ , $\| \theta \|$ , $n_u$ are sufficiently large, we have with high probability, + +$$ +E C E (\hat {\mathcal {C}} _ {f i n a l}) < E C E (\hat {\mathcal {C}} _ {i n i t}). +$$ + +Meanwhile, in some cases, for instance, when the labeled data is sufficient, the pseudo-labeling algorithm may hurt the calibration, as shown in the following theorem. + +Theorem 4.2. If $C_1 \| \theta \| < C_2$ , $p < C_3$ for some constants $C_1, C_2, C_3 > 0$ . Let $n_l$ and $n_u \to \infty$ , then with high probability, + +$$ +E C E (\hat {\mathcal {C}} _ {i n i t}) < E C E (\hat {\mathcal {C}} _ {f i n a l}). +$$ + +The above two theorems suggest that the pseudo-labeling algorithm is not able to robustly guarantee improvement in calibration. In the following, we show that we can mitigate this issue by applying Mixup to the last step in Algorithm 1. Specifically, we consider the following classifier with Mixup: + +$$ +\hat {\mathcal {C}} _ {m i x, f i n a l} (x) = s g n (\hat {\theta} _ {m i x, f i n a l} ^ {\top} x), +$$ + +![](images/6d313200318f1b08ec4021fb4b04e62d388c803a17c5d9ccb0f17a84aa8ec79b.jpg) +(a) CIFAR-10 + +![](images/64d1e651098d77e5558bc27233991544be7e24c34d613bd304b31ec889764273.jpg) +(b) CIFAR-100 +Figure 4. Maximum Calibration Error (MCE) calculated with varying network depth. Mixup augmentation can reduce MCE especially for larger capacity models (deeper networks) compared to these models trained without Mixup. + +where + +$$ +\hat {\theta} _ {f i n a l, m i x} (\lambda) = \mathbb {E} _ {\lambda \sim \mathcal {D} _ {\lambda}} [ \frac {1}{n _ {l} + n _ {u}} \sum_ {i = 1} ^ {n _ {l} + n _ {u}} x _ {i, j} ^ {l, u} (\lambda) y _ {i, j} ^ {l, u} (\lambda) ]. +$$ + +Here $\{x_{i,j}^{l,u}(\lambda),y_{i,j}^{l,u}(\lambda)\}_{i,j = 1}^{n_l + n_u}$ is the data set obtained by applying Mixup to the pooled data set by combining $\{x_i,y_i\}_{i = 1}^{n_l}$ and $\{x_i^u,y_i^u\}_{i = 1}^{n_u}$ . We then have the following result showing Mixup helps the calibration in the semi-supervised setting. + +Theorem 4.3. Under the setup described above, and denote the $ECE$ of $\hat{C}_{final}$ and $\hat{C}_{mix,final}$ by $ECE(\hat{C}_{final})$ and $ECE(\hat{C}_{mix,final})$ respectively. If $C_1 < \| \theta \| < C_2$ for some universal constants $C_1, C_2$ (not depending on $n$ and $p$ ), then for sufficiently large $p$ and $n_l, n_u$ , there exists $\alpha, \beta > 0$ , such that when the Mixup distribution $\lambda \sim Beta(\alpha, \beta)$ , with high probability, we have + +$$ +E C E (\hat {\mathcal {C}} _ {m i x, f i n a l}) < E C E (\hat {\mathcal {C}} _ {f i n a l}). +$$ + +From Theorem 4.3, we can see that even though incorporating unlabeled data can sometimes make the model less calibrated, adding Mixup training consistently (i.e., under the same conditions of either Theorem 4.1 or Theorem 4.2) mitigates this issue and provably improves calibration. + +# 5. Extension to Maximum Calibration Error + +Here we further investigate how Mixup helps calibration under maximum calibration error. Similar conclusions can be reached for MCE as those for ECE in Section 3.2, demonstrating that the effects of Mixup can be found across common calibration metrics. + +Theorem 5.1. Under the settings described in Theorem 3.1, there exists $c_2 > c_1 > 0$ , when $p / n \in (c_1, c_2)$ and $\| \theta \|_2 < C$ for some universal constants $C > 0$ (not depending on $n$ and $p$ ), then for sufficiently large $p$ and $n$ , there exist $\alpha, \beta > 0$ , such that when the distribution $\mathcal{D}_{\lambda}$ is chosen as $\text{Beta}(\alpha, \beta)$ , with high probability, + +$$ +M C E (\hat {\mathcal {C}} ^ {m i x}) < M C E (\hat {\mathcal {C}}). +$$ + +From the above theorem, we can see Mixup can also help decrease the maximum calibration error. Comparing with ECE, from Figure 4, we can similarly observe that when the model capacity is small, Mixup does not really help. We here provide the following theorem to further illustrate that point. + +Theorem 5.2. There exists a threshold $\tau = o(1)$ such that if $p / n\leq \tau$ and $\| \theta \| _2 < C$ for some universal constant $C > 0$ given any constants $\alpha ,\beta >0$ (not depending on $n$ and $p$ when $n$ is sufficiently large, we have, with high probability, + +$$ +M C E (\hat {\mathcal {C}}) < M C E (\hat {\mathcal {C}} ^ {m i x}). +$$ + +Lastly, we provide a similar theorem as Theorem 3.3 to further illustrate that Mixup helps in the high-dimensional (overparametrized) regime. + +Theorem 5.3. For any constant $c_{\mathrm{max}} > 0$ , $p / n \to c_{\mathrm{ratio}} \in (0, c^{\mathrm{max}})$ , when $\theta$ is sufficiently large (still of a constant level), we have for any $\beta > 0$ , with high probability, the change of ECE by using Mixup, characterized by + +$$ +\frac {d}{d \alpha} M C E (\hat {\mathcal {C}} _ {\alpha , \beta} ^ {m i x}) | _ {\alpha \rightarrow 0 +} +$$ + +is negative, and monotonically decreasing with respect to $c_{\text{ratio}}$ . + +# 6. Conclusion and Discussion + +Mixup is a popular data augmentation scheme and it has been empirically shown to improve calibration in machine learning. In this paper, we provide a theoretical point of view on how and when Mixup helps the calibration, by studying data generative models. We identify that the calibration improvement induced by Mixup is a high-dimensional phenomenon, and that such reduction in ECE becomes more substantial when the dimension is compared to the number of samples. This suggests that Mixup can be especially helpful for calibration in low sample regime where post-hoc calibration approaches like Platt-scaling are not commonly used. We further study the relationship between Mixup and calibration in a semi-supervised setting when there is an abundance of unlabeled data. Using unlabeled data alone can hurt calibration in some settings, while combining Mixup with pseudo-labeling can mitigate this issue. + +Our work points to a few promising further directions. Since there are many variants of Mixup (Berthelot et al., 2019; Verma et al., 2019; Roady et al., 2020; Kim et al., 2020), it would be interesting to study how these extensions of Mixup affect calibration. Another interesting direction is to use the analysis and framework developed in this paper to study the semi-supervised setting where the unlabeled data come from a different domain than the target one. It would be interesting to study how the calibration will change by leveraging the out-of-domain unlabeled data. + +# Acknowledgements + +The research of Linjun Zhang is partially supported by NSF DMS-2015378. The research of Zhun Deng is supported by the Sloan Foundation grants, the NSF grant 1763665, and the Simons Foundation Collaboration on the Theory of Algorithmic Fairness. James Zou is supported by funding from NSF CAREER and the Sloan Fellowship. + +# References + +Bahnsen, A. C., Stojanovic, A., Aouada, D., and Ottersten, B. Improving credit card fraud detection with calibrated probabilities. In Proceedings of the 2014 SIAM international conference on data mining, pp. 677-685. SIAM, 2014. +Berthelot, D., Carlini, N., Goodfellow, I., Papernot, N., Oliver, A., and Raffel, C. Mixmatch: A holistic approach to semi-supervised learning. arXiv preprint arXiv:1905.02249, 2019. +Carmon, Y., Raghunathan, A., Schmidt, L., Liang, P., and Duchi, J. C. Unlabeled data improves adversarial robustness. Advances in Neural Information Processing Systems, 2019. +Chan, A., Alaa, A., Qian, Z., and Van Der Schaar, M. Unlabelled data improves bayesian uncertainty calibration under covariate shift. In International Conference on Machine Learning, pp. 1392-1402. PMLR, 2020. +Chapelle, O., Scholkopf, B., and Zien, A. Semi-supervised learning (chapelle, o. et al., eds.; 2006)[book reviews]. IEEE Transactions on Neural Networks, 20(3):542-542, 2009. +Clanuwat, T., Bober-Irizar, M., Kitamoto, A., Lamb, A., Yamamoto, K., and Ha, D. Deep learning for classical japanese literature. In NeurIPS Creativity Workshop 2019, 2019. +Dan, C., Wei, Y., and Ravikumar, P. Sharp statistical guarantees for adversarily robust gaussian classification. In International Conference on Machine Learning, pp. 2345-2355. PMLR, 2020. +Deng, Z., Ding, F., Dwork, C., Hong, R., Parmigiani, G., Patil, P., and Sur, P. Representation via representations: Domain generalization via adversarially learned invariant representations. arXiv preprint arXiv:2006.11478, 2020a. +Deng, Z., He, H., Huang, J., and Su, W. Towards understanding the dynamics of the first-order adversaries. In International Conference on Machine Learning, pp. 2484-2493. PMLR, 2020b. + +Deng, Z., Huang, J., and Kawaguchi, K. How shrinking gradient noise helps the performance of neural networks. In 2021 IEEE International Conference on Big Data (Big Data), pp. 1002-1007. IEEE, 2021a. +Deng, Z., Zhang, L., Ghorbani, A., and Zou, J. Improving adversarial robustness via unlabeled out-of-domain data. International Conference on Artificial Intelligence and Statistics, 2021b. +Deng, Z., Zhang, L., Vodrahalli, K., Kawaguchi, K., and Zou, J. Y. Adversarial training helps transfer learning via better representations. Advances in Neural Information Processing Systems, 34, 2021c. +Foster, D. P. and Stine, R. A. Variable selection in data mining: Building a predictive model for bankruptcy. Journal of the American Statistical Association, 99(466):303-313, 2004. +Foster, D. P. and Vohra, R. V. Calibrated learning and correlated equilibrium. Games and Economic Behavior, 21(1-2):40, 1997. +Gneiting, T. and Raftery, A. E. Weather forecasting with ensemble methods. Science, 310(5746):248-249, 2005. +Goodfellow, I. J., Pouget-Abadie, J., Mirza, M., Xu, B., Warde-Farley, D., Ozair, S., Courville, A., and Bengio, Y. Generative adversarial networks. arXiv preprint arXiv:1406.2661, 2014. +Guo, C., Pleiss, G., Sun, Y., and Weinberger, K. Q. On calibration of modern neural networks. In International Conference on Machine Learning, pp. 1321-1330. PMLR, 2017. +Guo, H., Mao, Y., and Zhang, R. Mixup as locally linear out-of-manifold regularization. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 3714-3722, 2019. +He, K., Zhang, X., Ren, S., and Sun, J. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770-778, 2016a. +He, K., Zhang, X., Ren, S., and Sun, J. Identity mappings in deep residual networks. In European Conference on Computer Vision, pp. 630-645. Springer, 2016b. +Huang, Y., Li, W., Macheret, F., Gabriel, R. A., and Ohno-Machado, L. A tutorial on calibration measurements and calibration models for clinical prediction models. Journal of the American Medical Informatics Association, 27(4): 621-633, 2020. + +Ji, W., Deng, Z., Nakada, R., Zou, J., and Zhang, L. The power of contrast for feature learning: A theoretical analysis. arXiv preprint arXiv:2110.02473, 2021a. +Ji, W., Lu, Y., Zhang, Y., Deng, Z., and Su, W. J. An unconstrained layer-peeled perspective on neural collapse. arXiv preprint arXiv:2110.02796, 2021b. +Jiang, X., Osl, M., Kim, J., and Ohno-Machado, L. Calibrating predictive model estimates to support personalized medicine. Journal of the American Medical Informatics Association, 19(2):263-274, 2012. +Johnson, R. A., Wichern, D. W., et al. Applied multivariate statistical analysis, volume 5. Prentice hall Upper Saddle River, NJ, 2002. +Kawaguchi, K., Zhang, L., and Deng, Z. Understanding dynamics of nonlinear representation learning and its application. Neural Computation, 34(4):991-1018, 2022. +Kim, J.-H., Choo, W., and Song, H. O. Puzzle mix: Exploiting saliency and local statistics for optimal mixup. In International Conference on Machine Learning, pp. 5275-5285. PMLR, 2020. +Krizhevsky, A. and Hinton, G. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009. +Kuleshov, V., Fenner, N., and Ermon, S. Accurate uncertainties for deep learning using calibrated regression. In International Conference on Machine Learning, pp. 2796-2804. PMLR, 2018. +Kumar, A., Liang, P., and Ma, T. Verified uncertainty calibration. In Proceedings of the 33rd International Conference on Neural Information Processing Systems, pp. 3792-3803, 2019. +Lakshminarayanan, B., Pritzel, A., and Blundell, C. Simple and scalable predictive uncertainty estimation using deep ensembles. arXiv preprint arXiv:1612.01474, 2016. +Naeini, M. P., Cooper, G., and Hauskrecht, M. Obtaining well calibrated probabilities using bayesian binning. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 29, 2015. +Nixon, J., Dusenberry, M. W., Zhang, L., Jerfel, G., and Tran, D. Measuring calibration in deep learning. In CVPR Workshops, volume 2, 2019. +Osband, I., Blundell, C., Pritzel, A., and Van Roy, B. Deep exploration via bootstrapped dqn. arXiv preprint arXiv:1602.04621, 2016. + +Ovadia, Y., Fertig, E., Ren, J., Nado, Z., Sculley, D., Nowozin, S., Dillon, J. V., Lakshminarayanan, B., and Snoek, J. Can you trust your model's uncertainty? evaluating predictive uncertainty under dataset shift. arXiv preprint arXiv:1906.02530, 2019. +Platt, J. et al. Probabilistic outputs for support vector machines and comparisons to regularized likelihood methods. Advances in large margin classifiers, 10(3):61-74, 1999. +Roady, R., Hayes, T. L., and Kanan, C. Improved robustness to open set inputs via tempered mixup. In European Conference on Computer Vision, pp. 186-201. Springer, 2020. +Schmidt, L., Santurkar, S., Tsipras, D., Talwar, K., and Madry, A. Adversarily robust generalization requires more data. Advances in neural information processing systems, 31, 2018. +Simonyan, K. and Zisserman, A. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014. +Srivastava, R. K., Greff, K., and Schmidhuber, J. Highway networks. arXiv preprint arXiv:1505.00387, 2015. +Thulasidasan, S., Chennupati, G., Bilmes, J., Bhattacharya, T., and Michalak, S. On mixup training: Improved calibration and predictive uncertainty for deep neural networks. arXiv preprint arXiv:1905.11001, 2019. +Tomani, C. and Buettner, F. Towards trustworthy predictions from deep neural networks with fast adversarial calibration. arXiv preprint arXiv:2012.10923, 2020. +Verma, V., Lamb, A., Beckham, C., Najafi, A., Mitliagkas, I., Lopez-Paz, D., and Bengio, Y. Manifold mixup: Better representations by interpolating hidden states. In International Conference on Machine Learning, pp. 6438-6447. PMLR, 2019. +Wen, Y., Jerfel, G., Muller, R., Dusenberry, M. W., Snoek, J., Lakshminarayanan, B., and Tran, D. Combining ensembles and data augmentation can harm your calibration. arXiv preprint arXiv:2010.09875, 2020. +Xiao, H., Rasul, K., and Vollgraf, R. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms. arXiv preprint arXiv:1708.07747, 2017. +Zhang, H., Cisse, M., Dauphin, Y. N., and Lopez-Paz, D. mixup: Beyond empirical risk minimization. arXiv preprint arXiv:1710.09412, 2017. +Zhang, L., Deng, Z., Kawaguchi, K., Ghorbani, A., and Zou, J. How does mixup help with robustness and generalization? arXiv preprint arXiv:2010.04819, 2020. + +Zhao, S., Ma, T., and Ermon, S. Individual calibration with randomized forecasting. In International Conference on Machine Learning, pp. 11387-11397. PMLR, 2020. +Zhu, X. and Goldberg, A. B. Introduction to semisupervised learning. Synthesis lectures on artificial intelligence and machine learning, 3(1):1-130, 2009. +Zhu, X., Ghahramani, Z., and Lafferty, J. D. Semi-supervised learning using gaussian fields and harmonic functions. In Proceedings of the 20th International conference on Machine learning (ICML-03), pp. 912-919, 2003. + +# Appendix + +# A. Technical Details + +# A.1. Proof of Theorem 3.1 + +Theorem A.1 (Restatement of Theorem 3.1). Under the settings described in the main paper, if $p / n \to c$ and $\| \theta \|_2 < C$ for some universal constants $c, C > 0$ (not depending on $n$ and $p$ ), then for sufficiently large $p$ and $n$ , there exist $\alpha, \beta > 0$ such that when the distribution $\mathcal{D}_{\lambda}$ is chosen as $\text{Beta}(\alpha, \beta)$ , with high probability, + +$$ +E C E (\hat {\mathcal {C}} ^ {m i x}) < E C E (\hat {\mathcal {C}}). +$$ + +Proof. For the clarity of technical proofs, let us write the true parameter $\theta^{*}$ as $\theta$ , and denote $\hat{\theta}(0) = \frac{1}{n} \sum_{i=1}^{n} x_i y_i$ . Additionally, since we assume $\sigma$ is known in the main paper, without loss of generality (otherwise we can consider the data as $x_i / \sigma$ ), we let $\sigma = 1$ throughout the proof. + +For the mixup estimator, we have + +$$ +\begin{array}{l} \hat {\theta} (\lambda) = \frac {1}{n ^ {2}} \sum_ {i, j = 1} ^ {n} (\lambda x _ {i} + (1 - \lambda) x _ {j}) (y _ {i} + (1 - \lambda) y _ {j}) \\ = \frac {1}{n ^ {2}} \sum_ {i, j = 1} ^ {n} \left(\lambda^ {2} x _ {i} y _ {i} + (1 - \lambda) ^ {2} x _ {j} y _ {j} + \lambda (1 - \lambda) x _ {i} y _ {j} + \lambda (1 - \lambda) x _ {j} y _ {i}\right) \\ = [ 1 - 2 \lambda (1 - \lambda) ] \frac {1}{n} \sum_ {i = 1} ^ {n} x _ {i} y _ {i} + 2 \lambda (1 - \lambda) \frac {1}{n} \sum_ {i = 1} ^ {n} x _ {i} \cdot \frac {1}{n} \sum_ {i = 1} ^ {n} y _ {i}. \\ \end{array} +$$ + +Then when $\lambda \sim Beta(\alpha, \beta)$ , we have + +$$ +\hat {\theta} ^ {m i x} = \mathbb {E} _ {\lambda} [ \hat {\theta} (\lambda) ] = \frac {(\alpha^ {2} + \beta^ {2}) (\alpha + \beta + 1) + 2 \alpha \beta}{(\alpha + \beta) ^ {2} (\alpha + \beta + 1)} \hat {\theta} (0) + \frac {2 \alpha \beta (\alpha + \beta)}{(\alpha + \beta) ^ {2} (\alpha + \beta + 1)} \frac {1}{2 n} \sum_ {i = 1} ^ {n} x _ {i} \cdot \frac {1}{n} \sum_ {i = 1} ^ {n} y _ {i} +$$ + +For the ease of presentation, we write + +$$ +\hat {\theta} (t) = (1 - t) \hat {\theta} (0) + t \epsilon , +$$ + +where $\epsilon = \frac{1}{n}\sum_{i = 1}^{n}x_{i}\cdot \frac{1}{n}\sum_{i = 1}^{n}y_{i}$ + +It is easy to see $t \in (0,1]$ when $\alpha \in [0,\infty)$ and $\beta \in (0,\infty)$ . + +Under our model assumption, we have $\| \frac{1}{n} \sum_{i=1}^{n} x_i \| = O_p(\sqrt{\frac{p}{n}})$ , $|\frac{1}{n} \sum_{i=1}^{n} y_i| = O_p(\sqrt{\frac{1}{n}})$ , and therefore $\| \epsilon \| = O_p(\frac{\sqrt{p}}{n})$ . + +Now let us consider the expected calibration error + +$$ +E C E = \underset {v = (\hat {\theta} (t)) ^ {\top} X} {\mathbb {E}} | \mathbb {E} [ Y = 1 | \hat {f} (X) = \frac {1}{e ^ {- 2 v} + 1} ] - \frac {1}{e ^ {- 2 v} + 1} |. +$$ + +We further expand this quantity as + +$$ +\begin{array}{l} \mathbb {E} [ Y = 1 \mid \hat {f} (X) = \frac {1}{e ^ {- 2 v} + 1} ] = \mathbb {E} [ Y = 1 \mid \hat {\theta} (t) ^ {\top} X = v ] \\ = \frac {\mathbb {P} (\hat {\theta} (t) ^ {\top} X = v \mid Y = 1)}{\mathbb {P} (\hat {\theta} ^ {\top} X = v \mid Y = 1) + \mathbb {P} (\hat {\theta} (t) ^ {\top} X = v \mid Y = - 1)} \\ = \frac {e ^ {- \frac {(v - \hat {\theta} (t) ^ {\top} \theta) ^ {2}}{2 \| \hat {\theta} (t) \| ^ {2}}}}{e ^ {- \frac {(v - \hat {\theta} (t) ^ {\top} \theta) ^ {2}}{2 \| \hat {\theta} (t) \| ^ {2}}} + e ^ {- \frac {(v + \hat {\theta} (t) ^ {\top} \theta) ^ {2}}{2 \| \hat {\theta} (t) \| ^ {2}}}} \\ = \frac {1}{e ^ {- \frac {2 \hat {\theta} (t) ^ {\top} \theta}{\| \hat {\theta} (t) \| ^ {2}} \cdot v} + 1}. \\ \end{array} +$$ + +Since $\frac{\hat{\theta}(t)^{\top}\theta}{\|\hat{\theta}(t)\|^{2}} = \frac{((1 - t)\hat{\theta}(0) + t\epsilon)^{\top}\theta}{\|(1 - t)\hat{\theta}(0) + t\epsilon\|_{2}^{2}} = \frac{1}{1 - t}\frac{\hat{\theta}(0)^{\top}\theta}{\|\hat{\theta}(0)\|^{2}} + O_{P}(\frac{\sqrt{p}}{n})$ and $\hat{\theta}(t)^{\top}X = (1 - t)\hat{\theta}(0)^{\top}X + O_{P}(\frac{\sqrt{p}}{n})$ , we then have + +$$ +\begin{array}{l} E C E = \underset {v = (\hat {\theta} (t)) ^ {\top} X} {\mathbb {E}} | \mathbb {E} [ Y = 1 | \hat {f} (X) = \frac {1}{e ^ {- 2 v} + 1} ] - \frac {1}{e ^ {- 2 v} + 1} | \\ = \underset {v = (\hat {\theta} (t)) ^ {\top} X} {\mathbb {E}} [ | \frac {1}{e ^ {- \frac {2 \hat {\theta} (t) ^ {\top} \theta}{\| \hat {\theta} (t) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 v} + 1} | ] \\ = \underset {v = (1 - t) (\hat {\theta} (0)) ^ {\top} X} {\mathbb {E}} \left[ \left| \frac {1}{e ^ {- \frac {2 \hat {\theta} (0) ^ {\top} \theta}{(1 - t) \| \hat {\theta} (0) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 v} + 1} \right| \right] + O _ {P} \left(\frac {\sqrt {p}}{n}\right) \\ = \underset {v = (\hat {\theta} (0)) ^ {\top} X} {\mathbb {E}} [ | \frac {1}{e ^ {- \frac {2 \hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 (1 - t) v} + 1} | ] + O _ {P} (\frac {\sqrt {p}}{n}). \\ \end{array} +$$ + +Now let us consider the quantity $\frac{\hat{\theta}(0)^{\top}\theta}{\|\hat{\theta}(0)\|^{2}}$ . + +Since we have $\hat{\theta}(0) = \theta + \epsilon_n$ with $\epsilon_n = \frac{1}{n} \sum_{i=1}^{n} x_i y_i - \theta$ , this implies + +$$ +\frac {\hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} = \frac {\| \theta \| ^ {2} + \epsilon_ {n} ^ {\top} \theta}{\| \theta \| ^ {2} + \| \epsilon_ {n} \| ^ {2} + 2 \epsilon_ {n} ^ {\top} \theta} \sim \frac {\| \theta \| ^ {2} + \frac {1}{\sqrt {n}} \| \theta \|}{\| \theta \| ^ {2} + \frac {p}{n} + O _ {P} (\frac {\sqrt {p}}{n}) + \frac {1}{\sqrt {n}} \| \theta \|}, +$$ + +where the last equality uses the fact that $\| \epsilon_n\| ^2\stackrel {d}{=}\frac{\chi_p^2}{n} = \frac{p + O_P(\sqrt{p})}{n} = \frac{p}{n} +O_P(\frac{\sqrt{p}}{n}).$ + +By our assumption, we have $p / n \in (c_1, c_2)$ and $\| \theta \| < C$ , implying that there exists a constant $c_0 \in (0, 1)$ , such that with high probability + +$$ +\frac {\hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \leq c _ {0}. +$$ + +Then on the event $\mathcal{E} = \{\frac{\hat{\theta}(0)^{\top}\theta}{\|\hat{\theta}(0)\|^{2}} \leq c_{0}\}$ , if we choose $t = 1 - c_{0}$ , we will then have for any $v \in \mathbb{R}$ + +$$ +\left| \frac {1}{e ^ {- \frac {2 \hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 (1 - t) v}} \right| < \left| \frac {1}{e ^ {- \frac {2 \hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 v} + 1} \right|, +$$ + +and moreover, the difference is lower bounded by $\left| \frac{1}{e^{-2v} + 1} - \frac{1}{e^{-2c_0v} + 1} \right|$ . Use the fact that (since $v$ and $c_0$ does not depend on $n$ ), + +$$ +\underset {v = (\hat {\theta} (t)) ^ {\top} X} {\mathbb {E}} \left| \frac {1}{e ^ {- 2 v} + 1} - \frac {1}{e ^ {- 2 c _ {0} v} + 1} \right| = \Omega (1), +$$ + +we then have the desired result + +$$ +E C E (\hat {\mathcal {C}} ^ {m i x}) < E C E (\hat {\mathcal {C}}). +$$ + +# A.2. Proof of Theorem 3.2 + +Theorem A.2 (Restatement of Theorem 3.2). In the case where $p / n \to 0$ and $\| \theta \|_2 < C$ for some universal constant $C > 0$ , given any constants $\alpha, \beta > 0$ (not depending on $n$ and $p$ ), we have, with high probability, + +$$ +E C E (\hat {\mathcal {C}}) < E C E (\hat {\mathcal {C}} ^ {m i x}). +$$ + +Proof. According to the proof in Theorem 3.1, we have + +$$ +E C E (\hat {\mathcal {C}}) = \underset {v = (\hat {\theta} (0)) ^ {\top} X} {\mathbb {E}} [ | \frac {1}{e ^ {- \frac {2 \hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 v} + 1} | ], +$$ + +and + +$$ +E C E (\hat {\mathcal {C}} ^ {m i x}) = \underset {v = (\hat {\theta} (0)) ^ {\top} X} {\mathbb {E}} [ | \frac {1}{e ^ {- \frac {2 \hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 (1 - t) v} + 1} | ] + O _ {P} (\frac {\sqrt {p}}{n}), +$$ + +where $t\in (0,1)$ is a fixed constant when $\alpha ,\beta >0$ are some fixed constants. + +When $p / n \to 0$ , then + +$$ +\frac {\hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \sim \frac {\| \theta \| ^ {2} + \frac {1}{\sqrt {n}} \| \theta \|}{\| \theta \| ^ {2} + \frac {p}{n} + O _ {P} (\frac {\sqrt {p}}{n}) + \frac {1}{\sqrt {n}} \| \theta \|} = 1 + O _ {P} (\frac {p}{n}) = 1 + o _ {P} (1). +$$ + +Therefore, we have + +$$ +\begin{array}{l} E C E (\hat {\mathcal {C}}) = \underset {v = (\hat {\theta} (0)) ^ {\top} X} {\mathbb {E}} [ | \frac {1}{e ^ {- \frac {2 \hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 v} + 1} | ] \\ = \underset {v = (\hat {\theta} (0)) ^ {\top} X} {\mathbb {E}} [ | \frac {1}{e ^ {- 2 v + 1}} - \frac {1}{e ^ {- 2 v} + 1} | ] + O _ {P} (\frac {p}{n}) \\ = O _ {P} \left(\frac {p}{n}\right) = o _ {P} (1) \\ \end{array} +$$ + +and + +$$ +\begin{array}{l} E C E (\hat {\mathcal {C}} ^ {m i x}) = \underset {v = (\hat {\theta} (0)) ^ {\top} X} {\mathbb {E}} [ | \frac {1}{e ^ {- \frac {2 \hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 (1 - t) v} + 1} | ] + O _ {P} (\frac {\sqrt {p}}{n}) \\ = \underset {v = (\hat {\theta} (0)) ^ {\top} X} {\mathbb {E}} \left[ \left| \frac {1}{e ^ {- 2 v + 1}} - \frac {1}{e ^ {- 2 (1 - t) v} + 1} \right| \right] + O _ {P} (\frac {p}{n}) \\ \end{array} +$$ + +Since $\mathbb{E}_{v = (\hat{\theta} (0))^{\top}X}\left[\left|\frac{1}{e^{-2v + 1}} -\frac{1}{e^{-2(1 - t)v} + 1}\right|\right] = \Omega (1)$ when $t\in (0,1)$ is a fixed constant, we then have the desired result that + +$$ +E C E (\hat {\mathcal {C}}) < E C E (\hat {\mathcal {C}} ^ {m i x}). +$$ + +# A.3. Proof of Theorem 3.3 + +Theorem A.3 (Restatement of Theorem 3.3). For any constant $c_{\mathrm{max}} > 0$ , $p / n \to c_{\mathrm{ratio}} \in (0, c^{\mathrm{max}})$ , when $\theta$ is sufficiently large (still of a constant level), we have for any $\beta > 0$ , with high probability, the change of ECE by using Mixup characterized by + +$$ +\frac {d}{d \alpha} E C E (\hat {\mathcal {C}} _ {\alpha , \beta} ^ {m i x}) | _ {\alpha \rightarrow 0 +} +$$ + +is negative, and monotonically decreasing with respect to $c_{\text{ratio}}$ . + +Proof. Recall that + +$$ +E C E (\hat {\mathcal {C}} ^ {m i x}) = \underset {v = (\hat {\theta} (0)) ^ {\top} X} {\mathbb {E}} [ | \frac {1}{e ^ {- \frac {2 \hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 (1 - t) v} + 1} | ] + O _ {P} (\frac {\sqrt {p}}{n}). +$$ + +The case $\alpha = 0$ corresponds to the case where $t = 0$ . Since $\left|\frac{1}{e^{-\frac{2\hat{\theta}(0)^{\top}\theta}{\|\hat{\theta}(0)\|^{2}}\cdot v} + 1}\right| = \frac{1}{e^{-2(1 - t)v} + 1}$ as a function of $v$ is symmetric around 0, we have that when $t$ is sufficiently small (such that $1 - t > \frac{\hat{\theta}(0)^{\top}\theta}{\|\hat{\theta}(0)\|^{2}}$ with high probability) + +$$ +\begin{array}{l} \underset {v = (\hat {\theta} (0)) ^ {\top} X} {\mathbb {E}} \left[ \left| \frac {1}{e ^ {- \frac {2 \hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 (1 - t) v} + 1} \right| \right] = \underset {v = | (\hat {\theta} (0)) ^ {\top} X |} {\mathbb {E}} \left[ \left| \frac {1}{e ^ {- \frac {2 \hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 (1 - t) v} + 1} \right| \right] \\ = \underset {v = | (\hat {\theta} (0)) ^ {\top} X |} {\mathbb {E}} \left[ \frac {1}{e ^ {- \frac {2 \hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 (1 - t) v} + 1} \right]. \\ \end{array} +$$ + +Then let us take the derivative with respect to $t$ , we get + +$$ +\underset {v = | (\hat {\theta} (0)) ^ {\top} X |} {\mathbb {E}} \left[ - \frac {e ^ {- 2 (1 - t) v} \cdot 2 v}{(e ^ {- 2 (1 - t) v} + 1) ^ {2}} \right]. +$$ + +Therefore, the derivative evaluated at $t = 0$ equals to + +$$ +\underset {v = | (\dot {\theta} (0)) ^ {\top} X |} {\mathbb {E}} \left[ - \frac {e ^ {- 2 v} \cdot 2 v}{(e ^ {- 2 v} + 1) ^ {2}} \right], +$$ + +which is negative. + +We then only need to show it is monotonically decreasing in the rest of this proof. + +Again, by symmetry, we only need to consider the distribution of $X$ as $N(\theta, I)$ . We have $\hat{\theta}(0)^\top X \sim N(\hat{\theta}(0)^\top \theta, \|\hat{\theta}(0)^\top\|^2)$ . Since we have $\hat{\theta}(0) = \theta + \epsilon_n$ with $\epsilon_n = \frac{1}{n} \sum_{i=1}^{n} x_i y_i - \theta$ , we then have $\hat{\theta}(0)^\top \theta = \| \theta\|^2 + O_P\left(\frac{1}{\sqrt{n}}\right)$ , and $\|\hat{\theta}(0)\|^2 = \| \theta\|^2 + p / n + O\left(\frac{1}{\sqrt{n}}\right)$ . In order to show $\mathbb{E}_{v = |(\hat{\theta}(0))^\top X|}\left[-\frac{e^{-2v} \cdot 2v}{(e^{-2v} + 1)^2}\right]$ is monotonically decreasing, it's sufficient to show that + +$$ +\underset {Z \sim N (0, 1)} {\mathbb {E}} \frac {\mu + \sigma Z}{e ^ {- 2 (\mu + \sigma Z)} + e ^ {2 (\mu + \sigma Z)} + 2} +$$ + +is monotonically increasing in $\sigma \in (0, c_{\max})$ when $\mu$ is sufficiently large. Let us then take derivative with respect to $\sigma$ , we have + +$$ +\underset {Z \sim N (0, 1)} {\mathbb {E}} \frac {Z (e ^ {- 2 (\mu + \sigma Z)} + e ^ {2 (\mu + \sigma Z)} + 2) - (\mu + \sigma Z) \cdot 2 Z \cdot (e ^ {2 (\mu + \sigma Z)} - e ^ {- 2 (\mu + \sigma Z)})}{(e ^ {- 2 (\mu + \sigma Z)} + e ^ {2 (\mu + \sigma Z)} + 2) ^ {2}}. +$$ + +It suffices to show when $\mu$ is sufficiently large, this term is positive. + +In fact, when $\mu$ is sufficiently large, it suffices to look at dominating term $\mathbb{E}_{Z\sim N(0,1)}\left[\frac{-2\mu\cdot Z\cdot e^{2(\mu + \sigma Z)}}{e^{4(\mu + \sigma Z)}}\right]$ , for which we have + +$$ +\underset {Z \sim N (0, 1)} {\mathbb {E}} [ \frac {- 2 \mu \cdot Z \cdot e ^ {2 (\mu + \sigma Z)}}{e ^ {4 (\mu + \sigma Z)}} ] = - 2 \mu \cdot \underset {Z \sim N (0, 1)} {\mathbb {E}} [ Z \cdot e ^ {- 2 (\mu + \sigma Z)} ] > 0. +$$ + +We complete the proof. + +# A.4. Proof of Theorem 3.4 + +Theorem A.4 (Restatement of Theorem 3.4). Let us consider the ECE evaluated on the out-of-domain Gaussian model with mean parameter $\theta'$ , that is, $\mathbb{P}(y = 1) = \mathbb{P}(y = -1) = 1/2$ , and + +$$ +x \mid y \sim \mathcal {N} (y \cdot \theta^ {\prime}, \sigma^ {2} I), f o r i = 1, 2, \dots , n, +$$ + +If we have $(\theta' - \theta^*)^\top \theta^* \leq p / (2n)$ , then when $p$ and $n$ are sufficiently large, there exist $\alpha, \beta > 0$ , such that when the distribution $\mathcal{D}_{\lambda}$ is chosen as $\operatorname{Beta}(\alpha, \beta)$ , with high probability, + +$$ +E C E (\hat {\mathcal {C}} ^ {m i x}; \theta^ {\prime}, \sigma) < E C E (\hat {\mathcal {C}}; \theta^ {\prime}, \sigma), +$$ + +Proof. When the distribution has mean $\theta'$ , using the same analysis before, we obtain + +$$ +\begin{array}{l} \mathbb {E} [ Y = 1 \mid \hat {f} (X) = \frac {1}{e ^ {- 2 v} + 1} ] = \mathbb {E} [ Y = 1 \mid \hat {\theta} (t) ^ {\top} X = v ] \\ = \frac {\mathbb {P} (\hat {\theta} (t) ^ {\top} X = v \mid Y = 1)}{\mathbb {P} (\hat {\theta} ^ {\top} X = v \mid Y = 1) + \mathbb {P} (\hat {\theta} (t) ^ {\top} X = v \mid Y = - 1)} \\ = \frac {1}{e ^ {- \frac {2 \hat {\theta} (t) ^ {\top} \theta^ {\prime}}{\| \hat {\theta} (t) \| ^ {2}} \cdot v} + 1}. \\ \end{array} +$$ + +Again, following the same analysis above, it's suffices to show that with high probability, + +$$ +\frac {\hat {\theta} (0) ^ {\top} \theta^ {\prime}}{\| \hat {\theta} (0) \| ^ {2}} < 1. +$$ + +Again, we use $\hat{\theta}(0) = \theta + \epsilon_n$ with $\epsilon_n = \frac{1}{n} \sum_{i=1}^{n} x_i y_i - \theta$ , we then have + +$$ +\frac {\hat {\theta} (0) ^ {\top} \theta^ {\prime}}{\| \hat {\theta} (0) \| ^ {2}} = \frac {\theta^ {\top} \theta^ {\prime}}{\| \theta \| ^ {2} + p / n} + O _ {P} (\frac {1}{\sqrt {n}}) = \frac {\theta^ {\top} (\theta^ {\prime} - \theta) + \| \theta \| ^ {2}}{\| \theta \| ^ {2} + p / n} + O _ {P} (\frac {1}{\sqrt {n}}). +$$ + +If we have $(\theta' - \theta^{*})^{\top} \theta^{*} \leq p / (2n)$ , then when $p$ and $n$ are sufficiently large, there exist $\alpha, \beta > 0$ , such that when the distribution $\mathcal{D}_{\lambda}$ is chosen as $\operatorname{Beta}(\alpha, \beta)$ , with high probability, + +$$ +\frac {\hat {\theta} (0) ^ {\top} \theta^ {\prime}}{\| \hat {\theta} (0) \| ^ {2}} < 1. +$$ + +and therefore + +$$ +E C E (\hat {\mathcal {C}} ^ {m i x}; \theta^ {\prime}, \sigma) < E C E (\hat {\mathcal {C}}; \theta^ {\prime}, \sigma), +$$ + +# A.5. Proof of Theorem 3.5 + +Theorem A.5 (Restatement of Theorem 3.5). Under the settings described above with Assumption 3.1, if $p / n \to c$ , $g, \hat{h}$ is $L$ -Lipschitz, and $\| \theta \|_2 < C$ for some universal constants $c, L, C > 0$ (not depending on $n$ and $p$ ), then for sufficiently large $p$ and $n$ , there exist $\alpha, \beta > 0$ for the Mixup distribution $\mathcal{D}_{\lambda} = \text{Beta}(\alpha, \beta)$ , such that, with high probability, + +$$ +E C E (\hat {\mathcal {C}} ^ {m i x}) < E C E (\hat {\mathcal {C}}). +$$ + +Proof. Let us first recall Assumption 3.1: + +Assumption A.1 (Assumption 3.1 in the main text). For any given $v \in \mathbb{R}^p$ , $k \in \{-1,1\}$ , there exists a $\theta^{*} \in \mathbb{R}^{p}$ , such that given $y = k$ , the probability density function of $R_{1} = v^{\top}\hat{h}(x)$ and $R_{2} = v^{\top}h(x) = v^{\top}z \sim N(k \cdot b^{\top}\theta^{*}, \|v\|^{2})$ satisfies that $p_{R_1}(u) = p_{R_2}(u) \cdot (1 + \delta_u)$ for all $u \in \mathbb{R}$ where $\delta_u$ satisfies $\mathbb{E}_{R_1}[|\delta_u|^2] = o(1)$ when $n \to \infty$ . + +Using the similar analysis from above, we have + +$$ +\begin{array}{l} \mathbb {E} [ Y = 1 \mid \hat {f} (X) = \frac {1}{e ^ {- 2 v} + 1} ] = \mathbb {E} [ Y = 1 \mid \hat {\theta} (t) ^ {\top} \hat {h} (X) = v ] \\ = \frac {\mathbb {P} (\hat {\theta} (t) ^ {\top} \hat {h} (X) = v \mid Y = 1)}{\mathbb {P} (\hat {\theta} ^ {\top} \hat {h} (X) = v \mid Y = 1) + \mathbb {P} (\hat {\theta} (t) ^ {\top} \hat {h} (X) = v \mid Y = - 1)} \\ = \frac {e ^ {- \frac {(v - \hat {\theta} (t) ^ {\top} \theta) ^ {2}}{2 \| \hat {\theta} (t) \| ^ {2}}}}{e ^ {- \frac {(v - \hat {\theta} (t) ^ {\top} \theta) ^ {2}}{2 \| \hat {\theta} (t) \| ^ {2}}} + e ^ {- \frac {(v + \hat {\theta} (t) ^ {\top} \theta) ^ {2}}{2 \| \hat {\theta} (t) \| ^ {2}}}} (1 + \delta_ {v}) \\ = \frac {1}{e ^ {- \frac {2 \hat {\theta} (t) ^ {\top} \theta}{\| \hat {\theta} (t) \| ^ {2}} \cdot v} + 1} (1 + \delta_ {v}). \\ \end{array} +$$ + +Then by Assumption 3.1 and use the fact that $\left| \frac{1}{e^{-\frac{2\hat{\theta}(t)^{\top}\theta}{\|\theta(t)\|^{2}}\cdot v} + 1} \right| \leq 1$ , we have the expected calibration error as + +$$ +\begin{array}{l} E C E = \underset {v = (\hat {\theta} (t)) ^ {\top} X} {\mathbb {E}} | \mathbb {E} [ Y = 1 | \hat {f} (X) = \frac {1}{e ^ {- 2 v} + 1} ] - \frac {1}{e ^ {- 2 v} + 1} | \\ = \underset {v = (\hat {\theta} (t)) ^ {\top} X} {\mathbb {E}} \left[ \left| \frac {1}{e ^ {- \frac {2 \hat {\theta} (t) ^ {\top} \theta}{\| \hat {\theta} (t) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 v} + 1} \right| \right] + o (1) \\ \end{array} +$$ + +Then, by Assumption 3.1, we have $\mathbb{E}[|v^{\top}(\hat{h}(x) - z)|] \to 0$ , where $z \sim \frac{1}{2} N(-\theta, I) + \frac{1}{2} N(\theta, I)$ , which implies $\| \frac{1}{n} \sum_{i=1}^{n} \hat{h}(x_i) - \frac{1}{n} \sum_{i=1}^{n} z_i \| = o(\sqrt{p})$ . Since $\| \frac{1}{n} \sum_{i=1}^{n} z_i \| = O_P(\frac{\sqrt{p}}{n})$ , and $|\frac{1}{n} \sum_{i=1}^{n} y_i| = O_p(\sqrt{\frac{1}{n}})$ , we have + +$$ +\| \frac {1}{n} \sum_ {i = 1} ^ {n} \hat {h} (x _ {i}) \cdot \frac {1}{n} \sum_ {i = 1} ^ {n} y _ {i} \| = o _ {p} (\sqrt {\frac {p}{n}}) = o _ {p} (1). +$$ + +As a result, using the same analysis as those in Section A.1, we have + +$$ +\hat {\theta} ^ {m i x} = \sum_ {i, j = 1} ^ {n} \mathbb {E} _ {\lambda \sim \mathcal {D} _ {\lambda}} (\lambda \hat {h} (x _ {i}) + (1 - \lambda) \hat {h} (x _ {j})) \cdot \tilde {y} _ {i, j} (\lambda) / n ^ {2} = (1 - t) \hat {\theta} (0) + o _ {p} (1), +$$ + +and therefore $\frac{\hat{\theta}(t)^{\top}\theta}{\|\hat{\theta}(t)\|^{2}} = \frac{((1 - t)\hat{\theta}(0) + t\epsilon)^{\top}\theta}{\|(1 - t)\hat{\theta}(0) + t\epsilon)\|_{2}^{2}} = \frac{1}{1 - t}\frac{\hat{\theta}(0)^{\top}\theta}{\|\hat{\theta}(0)\|^{2}} + o_{P}(1)$ and $\hat{\theta}(t)^{\top}X = (1 - t)\hat{\theta}(0)^{\top}X + o_{P}(1)$ , we then have + +$$ +\begin{array}{l} E C E = \underset {v = (\hat {\theta} (t)) ^ {\top} X} {\mathbb {E}} | \mathbb {E} [ Y = 1 | \hat {f} (X) = \frac {1}{e ^ {- 2 v} + 1} ] - \frac {1}{e ^ {- 2 v} + 1} | \\ = \underset {v = (\hat {\theta} (t)) ^ {\top} X} {\mathbb {E}} [ | \frac {1}{e ^ {- \frac {2 \hat {\theta} (t) ^ {\top} \theta}{\| \hat {\theta} (t) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 v} + 1} | ] \\ = \underset {v = (1 - t) (\hat {\theta} (0)) ^ {\top} X} {\mathbb {E}} [ | \frac {1}{e ^ {- \frac {2 \hat {\theta} (0) ^ {\top} \theta}{(1 - t) \| \hat {\theta} (0) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 v} + 1} | ] + o _ {P} (1) \\ = \underset {v = (\hat {\theta} (0)) ^ {\top} X} {\mathbb {E}} \left[ \left| \frac {1}{e ^ {- \frac {2 \hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 (1 - t) v} + 1} \right| \right] + o _ {P} (1). \\ \end{array} +$$ + +Again, it boils down to studying the quantity $\frac{\hat{\theta}(0)^{\top}\theta}{\|\hat{\theta}(0)\|^{2}}$ , and it suffices to show this quantity is smaller than 1 with high probability. + +Using the same analysis above, recall that we have $\mathbb{E}[|v^{\top}(\hat{h}(x) - z)|] \to 0$ for any $\pmb{v}$ with $\|\pmb{v}\| < C$ . Let $\tilde{\theta} = \mathbb{E}_x[\hat{h}(x)]$ and plugging in $v = \tilde{\theta}$ , we then obtain $|\tilde{\theta}^{\top}(\tilde{\theta} - \theta)| = o(1)$ . Also, plugging in $v = \theta$ , we obtain $|\theta^{\top}(\tilde{\theta} - \theta)| = o(1)$ . Combining these two pieces, we obtain + +$$ +\left\| \tilde {\theta} - \theta \right\| = o (1). +$$ + +As a result, we have + +$$ +\| \hat {\theta} (0) \| ^ {2} = \| \frac {1}{2 n} \sum_ {i = 1} ^ {n} \hat {y} _ {i} h (x _ {i}) \| \geq \| \frac {1}{2 n} \sum_ {i = 1} ^ {n} y _ {i} \hat {h} (x _ {i}) - \mathbb {E} [ \hat {h} (x) ] \| + \| \mathbb {E} [ \hat {h} (x) ] \| = \Omega_ {P} (\sqrt {\frac {p}{n}}) + \| \theta \| + o (1), +$$ + +where the term $\Omega_P\left(\sqrt{\frac{p}{n}}\right)$ is derived as follows. + +First of all, we write + +$$ +\| \frac {1}{2 n} \sum_ {i = 1} ^ {n} \hat {y} _ {i} h (x _ {i}) - \mathbb {E} [ \hat {h} (x) ] \| ^ {2} = \sum_ {j = 1} ^ {p} (\frac {1}{2 n} \sum_ {i = 1} ^ {n} \hat {y} _ {i} h _ {j} (x _ {i}) - \mathbb {E} [ \hat {h} _ {j} (x) ]) ^ {2}. +$$ + +For each coordinate, we have $Var(z_{j}) = 1$ and + +$$ +\left| \operatorname {V a r} \left(\hat {h} _ {j} \left(x _ {i}\right)\right) - 1 \right| = o (1). \tag {5} +$$ + +Additionally, since $\hat{h}(x)$ is sub-gaussian, combining with the inequality (5), we have that $\hat{h}_j(x_i)$ has subgaussian norm lower bounded by some constant, which implies + +$$ +\| \frac {1}{n} \sum_ {i = 1} ^ {n} \hat {y} _ {i} h (x _ {i}) - \mathbb {E} [ \hat {h} (x) ] \| ^ {2} = \sum_ {j = 1} ^ {p} (\frac {1}{n} \sum_ {i = 1} ^ {n} \hat {y} _ {i} h _ {j} (x _ {i}) - \mathbb {E} [ \hat {h} _ {j} (x) ]) ^ {2} = \Omega_ {P} (\frac {p}{n}). +$$ + +Additionally, we have + +$$ +\| \hat {\theta} (0) ^ {\top} \theta \| \leq \| \theta \| + o (1). +$$ + +Therefore, we have with high probability, + +$$ +\frac {\hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} < 1. +$$ + +Verification of the unknown $\sigma$ case When $\sigma$ is unknown, we estimate $\sigma$ by $\hat{\sigma} = \sqrt{\|\sum_{i=1}^{n}(x_i - y_i\hat{\theta})\|^2 / pn}$ . It's easy to see $|\hat{\sigma} - \sigma| = O_P(1 / \sqrt{n})$ . We then let $\hat{h}(x) = x / \hat{\sigma}$ , and verify for any $v \in \mathbb{R}^p$ with $\|v\| \leq C$ , $R_1 = v^\top \hat{h}(x) = v^\top x / \hat{\sigma}$ and $R_2 = v^\top x / \sigma$ satisfies that $p_{R_1}(u) = p_{R_2}(u) \cdot (1 + \delta_u)$ for all $u \in \mathbb{R}$ where $\delta_u$ satisfies $\mathbb{E}_{R_1}[|\delta_u|^2] = o(1)$ when $n \to \infty$ . We have $\hat{h}$ and $g$ are all Lipschitz with constant $2\sigma$ . + +When $y = 1$ , we have + +$$ +p _ {R _ {1}} (u) = \frac {1}{\sqrt {2 \pi} \sigma / \hat {\sigma}} \exp \{- \frac {(u - v ^ {\top} \theta) ^ {2}}{2 \sigma^ {2} / \hat {\sigma} ^ {2}} \}, p _ {R _ {2}} (u) = \frac {1}{\sqrt {2 \pi}} \exp \{- \frac {(u - v ^ {\top} \theta) ^ {2}}{2} \} +$$ + +Denote $g(a) = \frac{1}{\sqrt{2\pi}a}\exp \{-\frac{(u - v^{\top}\theta)^{2}}{2a^{2}}\}$ , we then have $g^{\prime}(a) = -\frac{1}{\sqrt{2\pi}a^{2}}\exp \{-\frac{(u - v^{\top}\theta)^{2}}{2a^{2}}\} +\frac{1}{\sqrt{2\pi}a}\exp \{-\frac{(u - v^{\top}\theta)^{2}}{2a^{2}}\} \cdot \frac{(u - v^{\top}\theta)^{2}}{a^{3}}$ and therefore $g^{\prime}(1) = -\frac{1}{\sqrt{2\pi}}\exp \{-\frac{(u - v^{\top}\theta)^{2}}{2}\} +\frac{1}{\sqrt{2\pi}}\exp \{-\frac{(u - v^{\top}\theta)^{2}}{2}\} \cdot (u - v^{\top}\theta)^{2}$ . + +We then have + +$$ +\delta_ {u} = \frac {p _ {R _ {1}} (u) - p _ {R _ {2}} (u)}{p _ {R _ {2}} (u)} = [ (u - v ^ {\top} \theta) ^ {2} - 1 ] \cdot (\frac {\sigma^ {2}}{\hat {\sigma} ^ {2}} - 1) = O _ {P} (\frac {(u - v ^ {\top} \theta) ^ {2} - 1}{\sqrt {n}}). +$$ + +Since $\mathbb{E}_{u\sim R_1}[(u - v^\top \theta)^2 -1)^2 ] = O(1)$ , we have $\mathbb{E}_{R_1}[|\delta_u|^2 ] = o(1)$ when $n\to \infty$ + +![](images/e1c079c37358f983c218aeb0b4258316bd0a9779b2121007633bb2c8364f51e6.jpg) + +# A.6. Proof of Theorem 4.1 + +Theorem A.6 (Restatement of Theorem 4.1). Suppose $C_1\sqrt{p / n_l} \leq \| \theta \| \leq C_2\sqrt{p / n_l}$ for some universal constant $C_1 < 1/2$ and $C_2 > 2$ , when $p / n_l, \| \theta \|, n_u$ are sufficiently large, we have with high probability, + +$$ +E C E (\hat {\mathcal {C}} _ {f i n a l}) < E C E (\hat {\mathcal {C}} _ {i n i t}). +$$ + +Proof. According to the proof in the above section, we have + +$$ +E C E (\hat {C} _ {f i n a l}) = \underset {v = (\hat {\theta} _ {f i n a l}) ^ {\top} X} {\mathbb {E}} [ | \frac {1}{e ^ {- \frac {2 \hat {\theta} _ {f i n a l} ^ {\top} \theta}{\| \hat {\theta} _ {f i n a l} \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 v} + 1} | ], +$$ + +and + +$$ +E C E (\hat {C} _ {i n i t}) = \underset {v = (\hat {\theta} _ {i n i t}) ^ {\top} X} {\mathbb {E}} [ | \frac {1}{e ^ {- \frac {2 \hat {\theta} _ {i n i t} ^ {\top} \theta}{\| \hat {\theta} _ {i n i t} \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 v} + 1} | ]. +$$ + +For the initial estimator, we use $\hat{\theta}_{init} = \hat{\theta}(0) = \theta + \epsilon_n$ with $\epsilon_n = \frac{1}{n} \sum_{i=1}^{n} x_i y_i - \theta$ , we then have + +$$ +\frac {\hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} = \frac {\| \theta \| ^ {2}}{\| \theta \| ^ {2} + p / n _ {l}} + O _ {P} (\frac {1}{\sqrt {n} _ {l}}). +$$ + +When $C_1\sqrt{p / n_l}\leq \| \theta \| \leq C_2\sqrt{p / n_l}$ , we have + +$$ +\frac {\hat {\theta} _ {i n i t} ^ {\top} \theta}{\| \hat {\theta} _ {i n i t} \| ^ {2}} = \frac {\hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \leq \frac {C _ {2} ^ {2}}{C _ {2} ^ {2} + 1}. +$$ + +In the case where we combine the unlabeled data, we follow the similar analysis of Carmon et al. (2019) to study the property of $y_{i}^{u}$ . Let $b_{i}$ be the indicator that the $i$ -th pseudo-label is incorrect, so that $x_{i}^{u} \sim N((1 - 2b_{i})y_{i}^{u}\theta ,I) \coloneqq (1 - 2b_{i})y_{i}^{u}\theta +\epsilon_{i}^{u}$ . Then we can write + +$$ +\hat {\theta} _ {f i n a l} = \gamma \theta + \tilde {\delta}, +$$ + +where $\gamma = \frac{1}{n_u}\sum_{i = 1}^{n_u}(1 - 2b_i)$ and $\tilde{\delta} = \frac{1}{n_u}\sum_{i = 1}^{n_u}\epsilon_i^u y_i^u$ + +We then derive concentration bounds for $\| \tilde{\delta} \|^2$ and $\theta^\top \tilde{\delta}$ . Recall that $y_i^u = \operatorname{sgn}(\hat{\theta}_{init}^\top x_i^u)$ , we choose a coordinate system such that the first coordinate is in the direction of $\hat{\theta}_{init}$ , and let $v^{(i)}$ denote the $i$ -th entry of vector $v$ in this coordinate system. Then $y_i^u = \operatorname{sgn}(x_i^{u(1)}) = \operatorname{sgn}(\theta^\top \hat{\theta}_{init} + \epsilon_i^{u(1)})$ . + +Under this coordinate system, for $j \geq 2$ , we have $\epsilon_i^{u(j)}$ are independent with $y_i^u$ and therefore $\epsilon_i^{u(j)}y_i^u \sim N(0,1)$ for all $j \geq 2$ . For the first coordinate, since $\theta^\top \hat{\theta}_{init} = \Omega_P(1)$ , we have $|\mathbb{E}[\epsilon_i^{u(1)}y_i^u]| = |\mathbb{E}[\epsilon_i^{u(1)}sgn(\theta^\top\hat{\theta}_{init} + \epsilon_i^{u(1)})]| = \Omega_P(1)$ . Then we have + +$$ +\sum_ {j = 1} ^ {p} (\frac {1}{n _ {u}} \sum_ {i = 1} ^ {n _ {u}} \epsilon_ {i} ^ {u (j)} y _ {i} ^ {u}) ^ {2} = (\frac {1}{n _ {u}} \sum_ {i = 1} ^ {n _ {u}} \epsilon_ {i} ^ {u (1)} y _ {i} ^ {u}) ^ {2} + \sum_ {j = 2} ^ {p} (\frac {1}{n _ {u}} \sum_ {i = 1} ^ {n _ {u}} \epsilon_ {i} ^ {u (j)} y _ {i} ^ {u}) ^ {2} = \Omega_ {P} (1) + \frac {p + O _ {p} (\sqrt {p})}{n _ {u}}. +$$ + +The same analysis also yields + +$$ +| \tilde {\delta} ^ {\top} \theta | = | \frac {1}{n _ {u}} \sum_ {i = 1} ^ {n _ {u}} \epsilon_ {i} ^ {u (1)} y _ {i} ^ {u} \theta_ {1} + \sum_ {j = 2} ^ {p} \frac {1}{n _ {u}} \sum_ {i = 1} ^ {n _ {u}} \epsilon_ {i} ^ {u (j)} y _ {i} ^ {u} \theta_ {j} | = \Omega_ {P} (| \theta_ {1} |) + O _ {P} (\| \theta \| _ {2} / \sqrt {n}). +$$ + +Moreover, the proportion of misclassified samples converge the misclassification error produced by $\hat{C}_{init}$ : + +$$ +\gamma = \frac {1}{n _ {u}} \sum_ {i = 1} ^ {n _ {u}} (1 - 2 b _ {i}) \rightarrow 1 - \exp (- c \| \theta \| ^ {2}) + O _ {P} (\frac {1}{n}). +$$ + +This implies + +$$ +\frac {\hat {\theta} _ {f i n a l} ^ {\top} \theta}{\| \hat {\theta} _ {f i n a l} \| ^ {2}} = \frac {\gamma \| \theta \| ^ {2} + \tilde {\delta} ^ {\top} \theta}{\gamma^ {2} \| \theta \| ^ {2} + \| \tilde {\delta} \| ^ {2} + 2 \tilde {\delta} ^ {\top} \theta} \sim \frac {\gamma \| \theta \| ^ {2} + \Omega_ {P} (| \theta_ {1} |)}{\gamma^ {2} \| \theta \| ^ {2} + \Omega_ {P} (\frac {n _ {u} + p}{n _ {u}}) + \Omega_ {P} (| \theta_ {1} |)}. +$$ + +When $\| \theta \|$ is sufficiently large (which implies $p / n_l$ is sufficiently large), we have + +$$ +\frac {C _ {2} ^ {2}}{C _ {2} ^ {2} + 1} < \frac {\hat {\theta} _ {f i n a l} ^ {\top} \theta}{\| \hat {\theta} _ {f i n a l} \| ^ {2}} < 1, +$$ + +implying + +$$ +\frac {\hat {\theta} _ {i n i t} ^ {\top} \theta}{\| \hat {\theta} _ {i n i t} \| ^ {2}} < \frac {\hat {\theta} _ {f i n a l} ^ {\top} \theta}{\| \hat {\theta} _ {f i n a l} \| ^ {2}} < 1, +$$ + +and therefore + +$$ +E C E (\hat {\mathcal {C}} _ {f i n a l}) < E C E (\hat {\mathcal {C}} _ {i n i t}). +$$ + +# A.7. Proof of Theorem 4.2 + +Theorem A.7 (Restatement of Theorem 4.2). If $\| \theta \| < C$ for some constant $C > 2$ , given fixed $p$ and let $n_l$ and $n_u \to \infty$ with $p$ fixed, then with high probability probability, + +$$ +E C E (\hat {\mathcal {C}} _ {i n i t}) < E C E (\hat {\mathcal {C}} _ {f i n a l}). +$$ + +Proof. Using the same analysis as in the above section, we have + +$$ +E C E (\hat {\mathcal {C}} _ {f i n a l}) = \underset {v = (\hat {\theta} _ {f i n a l}) ^ {\top} X} {\mathbb {E}} [ | \frac {1}{e ^ {- \frac {2 \hat {\theta} _ {f i n a l} ^ {\top} \theta}{\| \hat {\theta} _ {f i n a l} \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 v} + 1} | ], +$$ + +and + +$$ +E C E (\hat {\mathcal {C}} _ {i n i t}) = \underset {v = (\hat {\theta} _ {i n i t}) ^ {\top} X} {\mathbb {E}} [ | \frac {1}{e ^ {- \frac {2 \hat {\theta} _ {i n i t} ^ {\top} \theta}{\| \hat {\theta} _ {i n i t} \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 v} + 1} | ]. +$$ + +For the initial estimator, we use $\hat{\theta}_{init} = \hat{\theta}(0) = \theta + \epsilon_n$ with $\epsilon_n = \frac{1}{n} \sum_{i=1}^{n} x_i y_i - \theta$ , we then have + +$$ +\frac {\hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} = \frac {\| \theta \| ^ {2}}{\| \theta \| ^ {2} + p / n _ {l}} + O _ {P} (\frac {1}{\sqrt {n _ {l}}}). +$$ + +When $\| \theta \| < C$ for some constant $C > 2$ , given $p$ fixed and $n_l \to \infty$ , we have + +$$ +\frac {\hat {\theta} _ {i n i t} ^ {\top} \theta}{\| \hat {\theta} _ {i n i t} \| ^ {2}} = \frac {\hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \rightarrow 1. +$$ + +For the semi-supervised classifier, when $\| \theta \| < C$ and $n_u \to \infty$ , we have + +$$ +\frac {\hat {\theta} _ {f i n a l} ^ {\top} \theta}{\| \hat {\theta} _ {f i n a l} \| ^ {2}} = \frac {\gamma \| \theta \| ^ {2} + \tilde {\delta} ^ {\top} \theta}{\gamma^ {2} \| \theta \| ^ {2} + \| \tilde {\delta} \| ^ {2} + 2 \tilde {\delta} ^ {\top} \theta} \sim \frac {\gamma \| \theta \| ^ {2} + \Omega_ {P} (| \theta_ {1} |)}{\gamma^ {2} \| \theta \| ^ {2} + \Omega_ {P} (\frac {n _ {u} + p}{n _ {u}}) + \Omega_ {P} (| \theta_ {1} |)} < 1. +$$ + +As a result, + +$$ +\frac {\hat {\theta} _ {f i n a l} ^ {\top} \theta}{\| \hat {\theta} _ {f i n a l} \| ^ {2}} < \frac {\hat {\theta} _ {i n i t} ^ {\top} \theta}{\| \hat {\theta} _ {i n i t} \| ^ {2}} \leq 1, +$$ + +and therefore + +$$ +E C E (\hat {\mathcal {C}} _ {i n i t}) < E C E (\hat {\mathcal {C}} _ {f i n a l}). +$$ + +# A.8. Proof of Theorem 4.3 + +Theorem A.8 (Restatement of Theorem 4.3). Under the setup described above, and denote the $ECE$ of $\hat{C}_{final}$ and $\hat{C}_{mix,final}$ by $ECE(\hat{C}_{final})$ and $ECE(\hat{C}_{mix,final})$ respectively. If $C_1 < \| \theta \|_2 < C_2$ for some universal constants $C_1, C_2$ (not depending on $n$ and $p$ ), then for sufficiently large $p$ and $n_l, n_u$ , there exists $\alpha, \beta > 0$ , such that when the Mixup distribution $\lambda \sim Beta(\alpha, \beta)$ , with high probability, we have + +$$ +E C E (\hat {\mathcal {C}} _ {m i x, f i n a l}) < E C E (\hat {\mathcal {C}} _ {f i n a l}). +$$ + +Proof. Using the same analysis as those in Section A.1, we have + +Using the similar analysis from above, we have + +$$ +\begin{array}{l} \mathbb {E} [ Y = 1 \mid \hat {f} (X) = \frac {1}{e ^ {- 2 v} + 1} ] = \mathbb {E} [ Y = 1 \mid \hat {\theta} ^ {\top} X = v ] \\ = \frac {\mathbb {P} (\hat {\theta} ^ {\top} X = v \mid Y = 1)}{\mathbb {P} (\hat {\theta} ^ {\top} X = v \mid Y = 1) + \mathbb {P} (\hat {\theta} ^ {\top} X = v \mid Y = - 1)} \\ = \frac {1}{e ^ {- \frac {2 \dot {\theta} ^ {\top} \theta}{\| \dot {\theta} \| ^ {2}} \cdot v} + 1}. \\ \end{array} +$$ + +Then we have the expected calibration error as + +$$ +\begin{array}{l} E C E = \underset {v = (\hat {\theta} (t)) ^ {\top} X} {\mathbb {E}} | \mathbb {E} [ Y = 1 | \hat {f} (X) = \frac {1}{e ^ {- 2 v} + 1} ] - \frac {1}{e ^ {- 2 v} + 1} | \\ = \underset {v = (\hat {\theta} (t)) ^ {\top} X} {\mathbb {E}} [ | \frac {1}{e ^ {- \frac {2 \hat {\theta} (t) ^ {\top} \theta}{\| \hat {\theta} (t) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 v} + 1} | ] + o (1) \\ \end{array} +$$ + +Then, since $\left\| \frac{1}{n_u} \sum_{i=1}^{n_u} x_i^u \right\| = O_P(\frac{\sqrt{p}}{n_u})$ , and $\left| \frac{1}{n} \sum_{i=1}^{n} y_i^u \right| = O_p(\sqrt{\frac{1}{n_u}})$ , we have + +$$ +\| \frac {1}{n _ {u}} \sum_ {i = 1} ^ {n _ {u}} x _ {i} ^ {u} \cdot \frac {1}{n _ {u}} \sum_ {i = 1} ^ {n _ {u}} y _ {i} ^ {u} \| = O _ {p} (\frac {\sqrt {p}}{n _ {u}}) = o _ {p} (1). +$$ + +As a result, using the same analysis as those in Section A.1, and denote $\hat{\theta}(0) = \hat{\theta}_{final}$ we have + +$$ +\hat {\theta} _ {f i n a l, m i x} = \sum_ {i, j = 1} ^ {n} \mathbb {E} _ {\lambda \sim \mathcal {D} _ {\lambda}} (\lambda \hat {h} (x _ {i}) + (1 - \lambda) \hat {h} (x _ {j})) \cdot \tilde {y} _ {i, j} (\lambda) / n ^ {2} = (1 - t) \hat {\theta} (0) + o _ {p} (1), +$$ + +and therefore $\frac{\hat{\theta}(t)^\top\theta}{\|\hat{\theta}(t)\|^2} = \frac{1}{1 - t}\frac{\hat{\theta}(0)^\top\theta}{\|\hat{\theta}(0)\|^2} + o_P(1)$ and $\hat{\theta}(t)^\top X = (1 - t)\hat{\theta}(0)^\top X + o_P(1)$ , we then have + +$$ +\begin{array}{l} E C E = \underset {v = (\hat {\theta} (t)) ^ {\top} X} {\mathbb {E}} | \mathbb {E} [ Y = 1 | \hat {f} (X) = \frac {1}{e ^ {- 2 v} + 1} ] - \frac {1}{e ^ {- 2 v} + 1} | \\ = \underset {v = (\hat {\theta} (t)) ^ {\top} X} {\mathbb {E}} [ | \frac {1}{e ^ {- \frac {2 \hat {\theta} (t) ^ {\top} \theta}{\| \hat {\theta} (t) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 v} + 1} | ] \\ = \underset {v = (1 - t) (\hat {\theta} (0)) ^ {\top} X} {\mathbb {E}} \left[ \left| \frac {1}{e ^ {- \frac {2 \hat {\theta} (0) ^ {\top} \theta}{(1 - t) \| \hat {\theta} (0) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 v} + 1} \right| \right] + o _ {P} (1) \\ = \underset {v = (\hat {\theta} (0)) ^ {\top} X} {\mathbb {E}} \left[ \left| \frac {1}{e ^ {- \frac {2 \hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 (1 - t) v} + 1} \right| \right] + o _ {P} (1). \\ \end{array} +$$ + +Again, it boils down to studying the quantity $\frac{\hat{\theta}(0)^{\top}\theta}{\|\hat{\theta}(0)\|^{2}}$ , and it suffices to show this quantity is smaller than 1 with high probability. + +To see this, when $C_1 < \| \theta \|_2 < C_2$ and $n_u, p$ sufficiently large, we have with high probability, + +$$ +\frac {\hat {\theta} _ {f i n a l} ^ {\top} \theta}{\| \hat {\theta} _ {f i n a l} \| ^ {2}} = \frac {\gamma \| \theta \| ^ {2} + \tilde {\delta} ^ {\top} \theta}{\gamma^ {2} \| \theta \| ^ {2} + \| \tilde {\delta} \| ^ {2} + 2 \tilde {\delta} ^ {\top} \theta} \sim \frac {\gamma \| \theta \| ^ {2} + \Omega_ {P} (| \theta_ {1} |)}{\gamma^ {2} \| \theta \| ^ {2} + \Omega_ {P} (\frac {n _ {u} + p}{n _ {u}}) + \Omega_ {P} (| \theta_ {1} |)} < 1. +$$ + +Therefore, there exists $\alpha, \beta > 0$ , such that when the Mixup distribution $\lambda \sim Beta(\alpha, \beta)$ , with high probability, we have + +$$ +E C E (\hat {\mathcal {C}} _ {m i x, f i n a l}) < E C E (\hat {\mathcal {C}} _ {f i n a l}). +$$ + +# A.9. Proof of Theorem 5.1 + +Theorem A.9 (Restatement of Theorem 5.1). Under the settings described in Theorem 3.1, there exists $c_2 > c_1 > 0$ , when $p / n \in (c_1, c_2)$ and $\| \theta \|_2 < C$ for some universal constants $C > 0$ (not depending on $n$ and $p$ ), then for sufficiently large $p$ and $n$ , there exist $\alpha, \beta > 0$ , such that when the distribution $\mathcal{D}_{\lambda}$ is chosen as $\text{Beta}(\alpha, \beta)$ , with high probability, + +$$ +M C E (\hat {\mathcal {C}} ^ {m i x}) < M C E (\hat {\mathcal {C}}). +$$ + +Proof. Following the calculation of Theorem 3.1, we consider the maximum calibration error, + +$$ +M C E = \max _ {v} | \mathbb {E} [ Y = 1 | \hat {f} (X) = \frac {1}{e ^ {- 2 v} + 1} ] - \frac {1}{e ^ {- 2 v} + 1} |. +$$ + +In addition, we have + +$$ +\mathbb {E} [ Y = 1 \mid \hat {f} (X) = \frac {1}{e ^ {- 2 v} + 1} ] = \frac {1}{e ^ {- \frac {2 \hat {\theta} (t) ^ {\top} \theta}{\| \hat {\theta} (t) \| ^ {2}} \cdot v} + 1}, +$$ + +where + +$$ +t = \frac {2 \alpha \beta (\alpha + \beta)}{(\alpha + \beta) ^ {2} (\alpha + \beta + 1)}. +$$ + +Let us denote $\rho = \frac{\hat{\theta}(t)^{\top}\theta}{\|\hat{\theta}(t)\|^{2}}$ . Since $\frac{\hat{\theta}(t)^{\top}\theta}{\|\hat{\theta}(t)\|^{2}} = \frac{((1 - t)\hat{\theta}(0) + t\epsilon)^{\top}\theta}{\|(1 - t)\hat{\theta}(0) + t\epsilon\|_{2}^{2}} = \frac{1}{1 - t}\frac{\hat{\theta}(0)^{\top}\theta}{\|\hat{\theta}(0)\|^{2}} + O_{P}\left(\frac{\sqrt{p}}{n}\right)$ . As a result, + +![](images/2cd3bcda7fa6606d2c7883c466d31861d25f8a926ea0425d64ef84d7c853f785.jpg) + +$$ +\begin{array}{l} M C E = \max _ {v} | \mathbb {E} [ Y = 1 | \hat {f} (X) = \frac {1}{e ^ {- 2 v} + 1} ] - \frac {1}{e ^ {- 2 v} + 1} | \\ = \max _ {v} | \frac {1}{e ^ {- \frac {2 \hat {\theta} (t) ^ {\top} \theta}{\| \hat {\theta} (t) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 v} + 1} | \\ = \max _ {v} | \frac {1}{e ^ {- \frac {2 \hat {\theta} (0) ^ {\top} \theta}{(1 - t) \| \hat {\theta} (0) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 v} + 1} | + O _ {P} (\frac {\sqrt {p}}{n}) \\ = \max _ {v} | \frac {1}{e ^ {- \frac {2 \hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 (1 - t) v} + 1} | + O _ {P} (\frac {\sqrt {p}}{n}). \\ \end{array} +$$ + +Now let us consider the quantity $\frac{\hat{\theta}(0)^{\top}\theta}{\|\hat{\theta}(0)\|^{2}}$ . + +Since we have $\hat{\theta}(0) = \theta + \epsilon_n$ with $\epsilon_n = \frac{1}{n} \sum_{i=1}^{n} x_i y_i - \theta$ , this implies + +$$ +\frac {\hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} = \frac {\| \theta \| ^ {2} + \epsilon_ {n} ^ {\top} \theta}{\| \theta \| ^ {2} + \| \epsilon_ {n} \| ^ {2} + 2 \epsilon_ {n} ^ {\top} \theta} \sim \frac {\| \theta \| ^ {2} + \frac {1}{\sqrt {n}} \| \theta \|}{\| \theta \| ^ {2} + \frac {p}{n} + O _ {P} (\frac {\sqrt {p}}{n}) + \frac {1}{\sqrt {n}} \| \theta \|}, +$$ + +where the last equality uses the fact that $\| \epsilon_n\| ^2\stackrel {d}{=}\frac{\chi_p^2}{n} = \frac{p + O_P(\sqrt{p})}{n} = \frac{p}{n} +O_P(\frac{\sqrt{p}}{n}).$ + +By our assumption, we have $p / n \in (c_1, c_2)$ and $\| \theta \| < C$ , implying that there exists a constant $c_0 \in (0, 1)$ , such that with high probability + +$$ +\frac {\hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \leq c _ {0}. +$$ + +Then on the event $\mathcal{E} = \{\frac{\hat{\theta}(0)^{\top}\theta}{\|\hat{\theta}(0)\|^{2}}\leq c_{0}\}$ , if we choose $t = 1 - c_0$ , we will then have for any $v\in \mathbb{R}$ + +$$ +| \frac {1}{e ^ {- \frac {2 \hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 (1 - t) v}} | < | \frac {1}{e ^ {- \frac {2 \hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 v} + 1} |, +$$ + +and moreover, the difference between LHS and RHS is lower bounded by $\left| \frac{1}{e^{-2v} + 1} - \frac{1}{e^{-2c_0v} + 1} \right|$ . Thus, we have + +$$ +M C E (\hat {\mathcal {C}} ^ {m i x}) < M C E (\hat {\mathcal {C}}). +$$ + +# A.10. Proof of Theorem 5.2 + +Theorem A.10 (Restatement of Theorem 5.2). There exists a threshold $\tau = o(1)$ such that if $p / n\leq \tau$ and $\| \theta \| _2 < C$ for some universal constant $C > 0$ , given any constants $\alpha, \beta > 0$ (not depending on $n$ and $p$ ), when $n$ is sufficiently large, we have, with high probability, + +$$ +M C E (\hat {\mathcal {C}}) < M C E (\hat {\mathcal {C}} ^ {m i x}). +$$ + +Proof. According to the proof in Theorem 5.1, we have + +$$ +M C E (\hat {\mathcal {C}}) = \max _ {v} | \frac {1}{e ^ {- \frac {2 \hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 v} + 1} |, +$$ + +and + +$$ +M C E (\hat {\mathcal {C}} ^ {m i x}) = \max _ {v} | \frac {1}{e ^ {- \frac {2 \hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 (1 - t) v} + 1} | + O _ {P} (\frac {\sqrt {p}}{n}), +$$ + +where $t\in (0,1)$ is a fixed constant when $\alpha ,\beta >0$ are some fixed constants. + +When $p / n \to 0$ , then + +$$ +\frac {\hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \sim \frac {\| \theta \| ^ {2} + \frac {1}{\sqrt {n}} \| \theta \|}{\| \theta \| ^ {2} + \frac {p}{n} + O _ {P} (\frac {\sqrt {p}}{n}) + \frac {1}{\sqrt {n}} \| \theta \|} = 1 + O _ {P} (\frac {p}{n}) = 1 + o _ {P} (1). +$$ + +Therefore, we have + +$$ +\begin{array}{l} M C E (\hat {\mathcal {C}}) = \max _ {v} [ | \frac {1}{e ^ {- \frac {2 \hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 v} + 1} | ] \\ = \max _ {v} \left[ \left| \frac {1}{e ^ {- 2 v + 1}} - \frac {1}{e ^ {- 2 v} + 1} \right| \right] + O _ {P} \left(\frac {p}{n}\right) \\ = O _ {P} \left(\frac {p}{n}\right) = o _ {P} (1) \\ \end{array} +$$ + +and + +$$ +\begin{array}{l} M C E (\hat {\mathcal {C}} ^ {m i x}) = \max _ {v} | \frac {1}{e ^ {- \frac {2 \hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 (1 - t) v} + 1} | + O _ {P} (\frac {\sqrt {p}}{n}) \\ = \left| \frac {1}{e ^ {- 2 v + 1}} - \frac {1}{e ^ {- 2 (1 - t) v} + 1} \right| + O _ {P} \left(\frac {p}{n}\right) \\ \end{array} +$$ + +Since $\max_v\left|\frac{1}{e^{-2v + 1}} -\frac{1}{e^{-2(1 - t)v} + 1}\right| = \Omega (1)$ when $t\in (0,1)$ is a fixed constant, we then have the desired result that + +$$ +M C E (\hat {\mathcal {C}}) < M C E (\hat {\mathcal {C}} ^ {m i x}). +$$ + +# A.11. Proof of Theorem 5.3 + +Theorem A.11 (Restatement of Theorem 5.3). For any constant $c_{\mathrm{max}} > 0$ , $p / n \to c_{\mathrm{ratio}} \in (0, c_{\mathrm{max}}^{\mathrm{max}})$ , when $\theta$ is sufficiently large (still of a constant level), we have for any $\beta > 0$ , with high probability, the change of ECE by using Mixup characterized by + +$$ +\frac {d}{d \alpha} M C E (\hat {\mathcal {C}} _ {\alpha , \beta} ^ {m i x}) | _ {\alpha \rightarrow 0 +} +$$ + +is negative, and monotonically decreasing with respect to $c_{\text{ratio}}$ . + +Proof. Recall that + +$$ +M C E (\hat {\mathcal {C}} ^ {m i x}) = \max _ {v} | \frac {1}{e ^ {- \frac {2 \hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 (1 - t) v} + 1} | + O _ {P} (\frac {\sqrt {p}}{n}). +$$ + +The case $\alpha = 0$ corresponds to the case where $t = 0$ . Since $\left|\frac{1}{e^{-\frac{2\hat{\theta}(0)^{\top}\theta}{\|\hat{\theta}(0)\|^{2}}\cdot v} + 1}\right|$ as a function of $v$ is symmetric around 0, we have that when $t$ is sufficiently small (such that $1 - t > \frac{\hat{\theta}(0)^{\top}\theta}{\|\hat{\theta}(0)\|^{2}}$ with high probability) + +$$ +\begin{array}{l} \max _ {v} \left| \frac {1}{e ^ {- \frac {2 \dot {\theta} (0) ^ {\top} \theta}{\| \dot {\theta} (0) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 (1 - t) v} + 1} \right| = \max _ {v > 0} \left| \frac {1}{e ^ {- \frac {2 \dot {\theta} (0) ^ {\top} \theta}{\| \dot {\theta} (0) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 (1 - t) v} + 1} \right| \\ = \max _ {v > 0} [ \frac {1}{e ^ {- \frac {2 \hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 (1 - t) v} + 1} ]. \\ \end{array} +$$ + +Let us denote + +$$ +v ^ {*} = \operatorname {a r g m a x} _ {v > 0} [ \frac {1}{e ^ {- \frac {2 \hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \cdot v} + 1} - \frac {1}{e ^ {- 2 (1 - t) v} + 1} ]. +$$ + +For the term + +$$ +\xi (t) = \frac {1}{e ^ {- \frac {2 \hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \cdot v ^ {*}} + 1} - \frac {1}{e ^ {- 2 (1 - t) v ^ {*}} + 1}, +$$ + +let us take the derivative with respect to $t$ , we get + +$$ +\frac {d}{d t} \xi (t) = - \frac {e ^ {- 2 (1 - t) v ^ {*}} \cdot 2 v ^ {*}}{(e ^ {- 2 (1 - t) v ^ {*}} + 1) ^ {2}}. +$$ + +Therefore, the derivative evaluated at $t = 0$ equals to + +$$ +- \frac {e ^ {- 2 v ^ {*}} \cdot 2 v ^ {*}}{(e ^ {- 2 v *} + 1) ^ {2}}, +$$ + +for $v^{*} > 0$ , which is negative. + +Recall that we have $\hat{\theta}(0) = \theta + \epsilon_n$ with $\epsilon_n = \frac{1}{n} \sum_{i=1}^{n} x_i y_i - \theta$ , this implies + +$$ +\frac {\hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} = \frac {\| \theta \| ^ {2} + \epsilon_ {n} ^ {\top} \theta}{\| \theta \| ^ {2} + \| \epsilon_ {n} \| ^ {2} + 2 \epsilon_ {n} ^ {\top} \theta} \sim \frac {\| \theta \| ^ {2} + \frac {1}{\sqrt {n}} \| \theta \|}{\| \theta \| ^ {2} + \frac {p}{n} + O _ {P} (\frac {\sqrt {p}}{n}) + \frac {1}{\sqrt {n}} \| \theta \|}, +$$ + +where the last equality uses the fact that $\| \epsilon_n\| ^2\stackrel {d}{=}\frac{\chi_p^2}{n} = \frac{p + O_P(\sqrt{p})}{n} = \frac{p}{n} +O_P(\frac{\sqrt{p}}{n}).$ + +Consider the case when $c_{\text{ratio}} = c_1$ and $c_{\text{ratio}} = c_2$ , where $0 < c_1 < c_2$ , we want to prove that, + +$$ +- \frac {e ^ {- 2 v ^ {*} (c _ {1})} \cdot 2 v ^ {*} (c _ {1})}{(e ^ {- 2 v ^ {*} (c _ {1})} + 1) ^ {2}} > - \frac {e ^ {- 2 v ^ {*} (c _ {2})} \cdot 2 v ^ {*} (c _ {2})}{(e ^ {- 2 v ^ {*} (c _ {2})} + 1) ^ {2}}, +$$ + +where $v^{*}(c_{1}) > 0$ and $v^{*}(c_{2}) > 0$ are the maximizers of $\frac{1}{e^{-\frac{2\hat{\theta}(0)^{\top}\theta}{\|\hat{\theta}(0)\|^{2}}\cdot v} + 1} - \frac{1}{e^{-2(1 - t)v} + 1}$ when $c_{ratio} = c_{1}$ and $c_{ratio} = c_{2}$ respectively. + +Since + +$$ +- \frac {e ^ {- 2 v ^ {*}} \cdot 2 v ^ {*}}{(e ^ {- 2 v *} + 1) ^ {2}} +$$ + +is a decreasing function of $v^{*}$ , and with high probability + +$$ +\frac {\hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \Big | _ {c _ {r a t i o} = c _ {1}} > \frac {\hat {\theta} (0) ^ {\top} \theta}{\| \hat {\theta} (0) \| ^ {2}} \Big | _ {c _ {r a t i o} = c _ {2}}. +$$ + +Thus, we only need to show that the maximizer $v^{*}(\rho)$ defined by + +$$ +v ^ {*} (\rho) = \operatorname * {a r g m a x} _ {v > 0} [ \frac {1}{e ^ {- 2 \rho \cdot v} + 1} - \frac {1}{e ^ {- 2 (1 - t) v} + 1} ] \Big | _ {t \to 0 ^ {+}} +$$ + +is an decreasing function of $\rho$ for $\rho \in [0,1)$ (since $\frac{\hat{\theta}(0)^{\top}\theta}{\|\hat{\theta}(0)\|^{2}} \in [0,1)$ ). + +As we know that $v^{*}(\rho)$ is the solution of the following equation: + +$$ +\frac {2 \rho v ^ {*} (\rho)}{e ^ {2 \rho v ^ {*} (\rho)} + e ^ {- 2 \rho v ^ {*} (\rho)} + 2} = \frac {2 v ^ {*} (\rho)}{e ^ {2 v ^ {*} (\rho)} + e ^ {- 2 v ^ {*} (\rho)} + 2}. +$$ + +From Figure 5, we can directly see that $v^{*}(\rho)$ increases as $\rho$ decreases. We complete the proof. + +![](images/1bf441af7319af3376b74fa805af0d2cc8a4e7c95e22a8b12b51f857db984092.jpg) +Figure 5. Illustration plot for the function $2x / (e^{2} + e^{-2x} + 2)$ . + +# B. Experimental setup and additional numerical results + +To complement our theory, we further provide more experimental evidence on popular image classification data sets with neural networks. In Figures 1 and 2, we used fully-connected neural networks and ResNets with various values of the width (i.e., the number of neurons per hidden layer) and the depth (i.e., the number of hidden layers). For the experiments on the effect of the width, we fixed the depth to be 8 and varied the width from 10 to 3000. For the experiments on the effect of the depth, the depth was varied from 1 to 24 (i.e., from 3 to 26 layers including input/output layers) by fixing the width to be 400 with data-augmentation and 80 without data-augmentation. We used the following standard data-augmentation operations using torchvisiontransforms for both data sets: random crop (via RandomCrop(32, padding=4)) and random horizontal flip (via RandomHorizontalFlip) for each image. We used the standard data sets — CIFAR-10 and CIFAR-100 (Krizhevsky & Hinton, 2009). We employed SGD with mini-batch size of 64. We set the learning rate to be 0.01 and momentum coefficient to be 0.9. We used the Beta distribution $\text{Beta}(\alpha, \alpha)$ with $\alpha = 1.0$ for Mixup. + +In Figure 3, we adopted the standard data sets, Kuzushiji-MNIST (Clanuwat et al., 2019), Fashion-MNIST (Xiao et al., 2017), and CIFAR-10 and CIFAR-100 (Krizhevsky & Hinton, 2009). We used SGD with mini-batch size of 64 and the learning rate of 0.01. The Beta distribution $\text{Beta}(\alpha, \alpha)$ with $\alpha = 1.0$ was used for Mixup. We used the standard pre-activation ResNet with 18 layers and ReLU activations (He et al., 2016b). For each data set, we randomly divided each training data (100%) into a labeled training data (50%) and a unlabeled training data (50%) with the 50-50 split. Following the theoretical analysis, we first trained the ResNet with labeled data until the half of the last epoch in each figure. Then, the pseudo-labels were generated by the ResNet and used for the final half of the training. + +We run experiments with a machine with 10-Core 3.30 GHz Intel Core i9-9820X and four NVIDIA RTX 2080 Ti GPUs with 11 GB GPU memory. + +Figure 6 shows that Mixup also tend to reduce test loss for larger capacity models. The experimental setting of Figure 6 is the exactly same as that of Figures 1 and 2. Here, relative test loss of a particular case is defined by $\frac{\text{test loss of a particular case}}{\text{test loss of no mixup base case}}$ . + +Figures 7-8 show that Mixup can reduce $\mathrm{ECE}_2$ particularly for larger capacity models. + +Figure 4 uses the same setting as that of Figures 1 and 2. Similarly to Figure 4, Figure 9 below shows that Mixup can reduce MCE particularly for larger capacity models with varying degrees of depth and width. The setting of Figure 9 is the same as that of Figures 1 and 2 with the data-augmentation. + +![](images/73c3c610663117a855494e7b4652b2e9879402b3436dcee707773f2f58798c66.jpg) +(a) CIFAR-10: width + +![](images/6b115e52dc49fc47deaa6d75586ddc591ce80af6544c5d1205922733971e74d1.jpg) +(b) CIFAR-10: depth + +![](images/e0d089fd8b0bc295744a3c3f3dbd0eddfb9a9f4e205cdfd6081ad2dc27b3c3bb.jpg) +(c) CIFAR-100: width + +![](images/129500e85c880b1227f4b38beb6e9ca283082a972dfaec2e678879f97646d0cf.jpg) +(d) CIFAR-100: depth +Figure 8. $\mathrm{ECE}_2$ without data-augmentation + +![](images/ef67c94967e5ea4719f80604cd21084119df7945e66e489b220a790f2f9a48ce.jpg) + +![](images/cd1e2534e9054be6d64df7fd7712a6a901b10af14f176e904810582a3c63c20d.jpg) + +![](images/bf4c8649e3b7f5d1e2b2450b973ad688555181ce47b7a8370929b42a6f4ff891.jpg) + +![](images/f0c2ebe8f8e791f40524f9d021efd15fc32fe89390c2e61cfe6f593b795a1c9d.jpg) + +![](images/efde828c6c29ea5ea8d1ea6b69f131aeb7b654ecfd9205b5b2afb49a7207d048.jpg) +(a) Width +(e) Width + +![](images/c85cbd926aa66892cbf8aa7bc6ae88b00e423554a1cb4cf797b83ab5b83cf194.jpg) +(b) Depth +(f) Depth + +![](images/c3c2a20e0ec6a6280a02348080bd730ca425753775d2efeb87a72000d856396f.jpg) +(c) Width +(g) Width + +![](images/38db42791776330f5aa4835c6d6d961244e3ea43b1a439e784f294bedcb54a8e.jpg) +(d) Depth +(h) Depth + +![](images/caaf8ab9a1253165eeff23ba7a3169bba7b746cc71977b7980c435d9571613ed.jpg) +Figure 6. Relative test loss: (a), (b): CIFAR-10 without data augmentation; (c), (d): CIFAR-10 with data augmentation; (e), (f): CIFAR-100 without data augmentation; (g), (h): CIFAR-100 with data augmentation. +(a) CIFAR-10: width + +![](images/08659b2946da6e67acd2ba07c92e55b4672e3ced40a2f5e229be7b0f5c68983b.jpg) +(b) CIFAR-10: depth + +![](images/76ab6c39dfa5b927128b7368983cdb38a8934225068b28573ec18335bd4b28a0.jpg) +(c) CIFAR-100: width + +![](images/653984faa9a065c70bff64dcf41e05435b71c2b2936920981668ad49bdf5d099.jpg) +(d) CIFAR-100: depth + +![](images/0eddba4cfb79d618ec52cb3404352268787b5829d1de4fc16f441121e6f95927.jpg) +(a) CIFAR-10: width + +![](images/ee592b862008634dfdfbe49ee6cc67cb9c4a446b559bab523da37b1f764c8216.jpg) +Figure 7. $\mathrm{ECE}_2$ with data-augmentation +(b) CIFAR-10: depth +Figure 9. Maximum Calibration Error (MCE) + +![](images/ee459d912fb131cbee3562ccd1cf1aa45679a95236ec3bc0c0cbc814cd691774.jpg) +(c) CIFAR-100: width + +![](images/314a091ac7485df80cfb21c3cb93d2682a786012bd1e211809b72ba42a9a0279.jpg) +(d) CIFAR-100: depth \ No newline at end of file diff --git a/whenandhowmixupimprovescalibration/images.zip b/whenandhowmixupimprovescalibration/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..6fc8509a6efb02748b073002b4c08f046101aa56 --- /dev/null +++ b/whenandhowmixupimprovescalibration/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d405b4897ba96e74e78d74dfb832d213a2539dd45877ee7c720168cba437fbc8 +size 1446676 diff --git a/whenandhowmixupimprovescalibration/layout.json b/whenandhowmixupimprovescalibration/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..950d7a9168603679afc35f6d2c35b584dacf015e --- /dev/null +++ b/whenandhowmixupimprovescalibration/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c514ac7487058261a2d3e674bc292289b2c83ba50a482460f42561d552965c31 +size 1344486 diff --git a/whenarelinearstochasticbanditsattackable/339ca0f1-5562-4bd0-aa8c-8be6f29fb07e_content_list.json b/whenarelinearstochasticbanditsattackable/339ca0f1-5562-4bd0-aa8c-8be6f29fb07e_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..d5725825e55302ec5d53867379ceb3e7cd695f85 --- /dev/null +++ b/whenarelinearstochasticbanditsattackable/339ca0f1-5562-4bd0-aa8c-8be6f29fb07e_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:21316577b652133bbbe70e6178394f641bee2ff8c8c0ed7dc88601abe6ebfa81 +size 151964 diff --git a/whenarelinearstochasticbanditsattackable/339ca0f1-5562-4bd0-aa8c-8be6f29fb07e_model.json b/whenarelinearstochasticbanditsattackable/339ca0f1-5562-4bd0-aa8c-8be6f29fb07e_model.json new file mode 100644 index 0000000000000000000000000000000000000000..b6fe0f2d736a4958603b28bd5b5bb163ec43cea2 --- /dev/null +++ b/whenarelinearstochasticbanditsattackable/339ca0f1-5562-4bd0-aa8c-8be6f29fb07e_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ee61ea6ebfea2675523a93f6cc65f593c23c0023eee785718f903d3d76a930ec +size 172725 diff --git a/whenarelinearstochasticbanditsattackable/339ca0f1-5562-4bd0-aa8c-8be6f29fb07e_origin.pdf b/whenarelinearstochasticbanditsattackable/339ca0f1-5562-4bd0-aa8c-8be6f29fb07e_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..f1af3710468c9f557c7ce72bbdbd0fe7ed9e5b26 --- /dev/null +++ b/whenarelinearstochasticbanditsattackable/339ca0f1-5562-4bd0-aa8c-8be6f29fb07e_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0d40640bd75add65ae715715c009fe6b9904abb979ecad46786d6dcdf38efefa +size 655124 diff --git a/whenarelinearstochasticbanditsattackable/full.md b/whenarelinearstochasticbanditsattackable/full.md new file mode 100644 index 0000000000000000000000000000000000000000..05ba85a369107327f8a890085c9c80cca711de9c --- /dev/null +++ b/whenarelinearstochasticbanditsattackable/full.md @@ -0,0 +1,693 @@ +# Huazheng Wang *1 Haifeng Xu² Hongning Wang² + +# Abstract + +We study adversarial attacks on linear stochastic bandits: by manipulating the rewards, an adversary aims to control the behaviour of the bandit algorithm. Perhaps surprisingly, we first show that some attack goals can never be achieved. This is in a sharp contrast to context-free stochastic bandits, and is intrinsically due to the correlation among arms in linear stochastic bandits. Motivated by this finding, this paper studies the attackability of a $k$ -armed linear bandit environment. We first provide a complete necessity and sufficiency characterization of attackability based on the geometry of the arms' context vectors. We then propose a two-stage attack method against LinUCB and Robust Phase Elimination. The method first asserts whether the given environment is attackable; and if yes, it poisons the rewards to force the algorithm to pull a target arm linear times using only a sublinear cost. Numerical experiments further validate the effectiveness and cost-efficiency of the proposed attack method. + +# 1. Introduction + +In a contextual bandit problem, a learner takes sequential actions to interact with an environment to maximize its received cumulative reward. As a natural and important variant, linear stochastic bandits (Auer, 2002; Li et al., 2010; Abbasi-yadkori et al., 2011) assume the expected reward of an arm $a$ is a linear function of its feature vector $x_{a}$ and an unknown bandit parameter $\theta^{*}$ . A linear bandit algorithm thus adaptively improves its estimation of $\theta^{*}$ based on the reward feedback on its pulled arms. Thanks to their sound theoretical guarantees and promising empirical performance, linear stochastic bandits have become a reference solution to many real-world problems, such as content recommendation and online advertisement (Li et al., 2010; Chapelle & Li, + +*Most work was done while with University of Virginia. +1Princeton University 2University of Virginia. Correspondence to: Huazheng Wang . + +Proceedings of the $39^{th}$ International Conference on Machine Learning, Baltimore, Maryland, USA, PMLR 162, 2022. Copyright 2022 by the author(s). + +2011;Durand et al.,2018). + +Since bandit algorithms adapt their behavior according to its received feedback, such algorithms are susceptible to adversarial attacks, especially poisoning attacks. Under such an attack, a malicious adversary observes the pulled arm and its reward feedback, and then modifies the reward to misguide the bandit algorithm to pull a target arm, which is of the adversary's interest. Due to the wide applicability of bandit algorithms in practice as mentioned before, understanding the robustness of such algorithms under poisoning attacks becomes increasingly important (Jun et al., 2018; Liu & Shroff, 2019; Garcelon et al., 2020). + +Most existing studies on adversarial attacks in bandits focused on the context-free stochastic multi-armed bandit (MAB) settings. Jun et al. (2018) and Liu & Shroff (2019) showed that an adversary can force any MAB algorithm to pull a target arm linear times only using a logarithmic cost. Garcelon et al. (2020) showed the vulnerability of $k$ -armed linear contextual bandits under poisoning attacks. Linear stochastic bandits are related to context-free stochastic bandits and linear contextual bandits. Interestingly, however, there is no known result about attacks on linear stochastic bandit until now. This paper shall provide a formal explanation for this gap — the analysis of attacks to linear stochastic bandits turns out to be significantly more challenging due to the correlation among arms; in fact, some learning environment is provably unattackable. + +Specifically, we fill the aforementioned gap by studying poisoning attacks on $k$ -armed linear stochastic bandits, where an adversary modifies the reward using a sublinear attack cost to misguide the bandit algorithm to pull a target arm $\tilde{x}$ linear times. We first show that a linear stochastic bandit environment is not always efficiently attackable1, and its attackability is governed by the feasibility of finding a parameter vector $\tilde{\theta}$ , under which the rewards of all nontarget arms are smaller than the reward of target arm $\tilde{x}$ and the reward of $\tilde{x}$ remains the same as that in the original environment specified by $\theta^{*}$ . Intuitively, to promote the target arm $\tilde{x}$ , an adversary needs to lower the rewards of + +non-target arms in the null space of $\tilde{x}$ by $\tilde{\theta}$ , which might not be always feasible. We prove the feasibility of the resulting convex quadratic program is both sufficient and necessary for attacking a linear stochastic bandit environment. + +Inspired by our attackability analysis, we propose a two-stage attack framework against linear stochastic bandit algorithms and demonstrate its application against LinUCB (Li et al., 2010) and Robust Phase Elimination (Bogunovic et al., 2021): the former is one of the most widely used linear contextual bandit algorithms, and the latter is a robust version designed for settings with adversarial corruptions. In the first stage, our method collects a carefully calibrated amount of rewards on the target arm to assess whether the given environment is attackable. The decision is based on an "empirical" version of our feasibility characterization. If attackable, i.e., there exists a feasible solution $\tilde{\theta}$ , in the second stage the method depresses the rewards the bandit algorithm receives on non-target arms based on $\tilde{\theta}$ , to fool the bandit algorithm to recognize the target arm as optimal. We prove that in an attackable environment, both algorithms can be successfully manipulated with only a sublinear cost. + +Our main contributions can be summarized as follows: + +- We characterize the sufficient and necessary conditions about when a stochastic linear bandit environment is attackable as the feasibility of a convex quadratic program. En route to proving the sufficiency, we also provide an oracle attack method that can attack any no-regret learning algorithm given the knowledge of ground-truth bandit parameter $\theta^{*}$ . If the environment is unattackable, i.e., the program is infeasible, our necessity proof implies that even the vanilla LinUCB algorithm cannot be efficiently attacked. A direct corollary of our characterization is that context-free stochastic MAB is always attackable, resonating the findings in (Jun et al., 2018; Liu & Shroff, 2019). +- We propose a two-stage attack method that works without the knowledge of ground-truth bandit parameter. In the first stage, the algorithm detects the attackability of the environment and estimates the model parameter. In the second stage, it solves for a working solution $\tilde{\theta}$ and attacks accordingly. Our theoretical analysis shows this attack method is effective against LinUCB (Li et al., 2010) and Robust Phase Elimination (Bogunovic et al., 2021), i.e., pulling the target arm $T - o(T)$ times using $o(T)$ cost when the environment is attackable. + +# 2. Preliminaries + +Linear stochastic bandit. We study poisoning attacks to the fundamental $k$ -armed linear stochastic bandit problem (Auer, 2002), where a bandit algorithm sequentially interacts with an environment for $T$ rounds. In each round $t$ , + +the algorithm pulls an arm $a_{t} \in [k] = \{1, \dots, k\}$ from a set $\mathcal{A} = \{x_{i}\}_{i=1}^{k}$ with $k$ arms, and receives reward $r_{a_{t}}$ from the environment. Each arm $a$ is associated with a $d$ -dimensional context vector $x_{a} \in \mathbb{R}^{d}$ ; and the observed reward follows a linear mapping $r_{a_{t}} = x_{a_{t}}^{\top} \pmb{\theta}^{*} + \eta_{t}$ , where $\pmb{\theta}^{*} \in \mathbb{R}^{d}$ is a common unknown bandit parameter vector and $\eta_{t}$ is an $R$ -sub-Gaussian noise term. We assume context vectors and parameters are all bounded; and for convenience and without loss of generality, we assume $\| x_{i}\|_{2} \leq 1$ and $\|\pmb{\theta}^{*}\|_{2} \leq 1$ . The performance of a bandit algorithm is evaluated by its pseudo-regret, which is defined as $R_{T}(\pmb{\theta}^{*}) = \sum_{t=1}^{T} (x_{a_{t}}^{\top} \pmb{\theta}^{*} - x_{a_{t}}^{\top} \pmb{\theta}^{*})$ , where $a^{*}$ is the best arm according to $\pmb{\theta}^{*}$ , i.e., $a^{*} = \arg \max_{a \in [k]} [x_{a}^{\top} \pmb{\theta}^{*}]$ . + +LinUCB. LinUCB (Li et al., 2010; Abbasi-yadkori et al., 2011) is a classical algorithm for linear stochastic bandit. It estimates a bandit model parameter $\hat{\theta}$ using ridge regression, i.e., $\hat{\theta}_t = \mathbf{A}_t^{-1} \sum_{i=1}^t x_{a_i} r_i$ , where $\mathbf{A}_t = \sum_{i=1}^t x_{a_i} x_{a_i}^\top + \lambda \mathbf{I}$ and $\lambda$ is the L2-regularization coefficient. We use $\|x\|_{\mathbf{A}} = \sqrt{x^\top \mathbf{A}x}$ to denote the matrix norm of vector $x$ . The confidence bound about reward estimation on arm $x$ is defined as $\mathrm{CB}_t(x) = \alpha_t \|x\|_{\mathbf{A}_t^{-1}}$ , where $\alpha_t$ is a high probability bound of $\|\pmb{\theta}^* - \hat{\pmb{\theta}}_t\|_{\mathbf{A}_t}$ . In each round $t$ , LinUCB pulls an arm with the highest upper confidence bound, i.e., $a_t = \arg \max_{a \in [k]} [x_a^\top \hat{\pmb{\theta}}_t + \mathrm{CB}_t(x_a)]$ to balance the exploration-exploitation trade-off. LinUCB algorithm achieves a sublinear upper regret bound, i.e., $R_T = \tilde{O}(\sqrt{T})$ ignoring the logarithmic term. + +Threat model. The goal of an adversary is to fool a linear stochastic bandit algorithm to pull the target arm $\tilde{x} \in \mathcal{A}$ for $T - o(T)$ times. Like most recent works in this space (Jun et al., 2018; Liu & Shroff, 2019; Garcelon et al., 2020; Zhang et al., 2020), we also consider the widely studied poisoning attack on the rewards: after arm $a_{t}$ is pulled by the bandit algorithm, the adversary modifies the realized reward $r_{a_{t}}$ from the environment by $\Delta r_{t}$ into $\tilde{r}_{a_{t}}$ , i.e., $\tilde{r}_{a_{t}} = r_{a_{t}} + \Delta r_{t}$ , and feeds the manipulated reward $\tilde{r}_{a_{t}}$ to the algorithm. Naturally, the adversary aims to achieve its attack goal with minimum attack cost, defined as $C(T) = \sum_{t=1}^{T} |\Delta r_{t}|$ . By convention, an attack strategy is said to be efficient if it uses only a sublinear total cost, i.e., $C(T) = o(T)$ . + +We conclude the preliminaries with an important remark about a key difference between attacking linear stochastic bandit studied in this paper and attacking $k$ -armed linear contextual bandit setting recently studied in (Garcelon et al., 2020). In linear contextual bandits, all arms share a context vector at each round but each arm has its own (to-be-estimated) bandit parameter. Therefore, the reward manipulation at a round $t$ will only affect the parameter estimation of the pulled arm $a_{t}$ , but not any other arms'. This "isolates" the attack's impact in different arms. In contrast, in linear stochastic bandit, all arms share the same + +bandit parameter but have different context vectors. And thus manipulating the reward of any arm will alter the shared bandit parameter estimation, which will then affect the reward estimation of all arms due to the correlation among their context vectors. Such coupled effect of adversarial manipulation from the pulled arm $a_{t}$ to all other arms is unique in linear stochastic bandits, and makes its analysis of attack much more challenging. This is also the fundamental reason that some linear stochastic bandit environment may not be attackable (see our illustration in Example 1). + +# 3. The Attackability of A Linear Stochastic Bandit Environment + +We study the attackability of a linear stochastic bandit environment. At the first glance, one might wonder whether attackability is the property of a bandit algorithm rather than a property of the environment, since if an algorithm can be attacked, we should have "blamed" the algorithm for not being robust. A key finding of this work is attackability is also a property of the learning environment; and in other words, not all environments are attackable. + +Definition 1 (Attackability of a $k$ -Armed Linear Stochastic Bandit Environment). A $k$ -armed linear stochastic bandit environment $\langle \mathcal{A} = \{x_i\}_{i=1}^k, \boldsymbol{\theta}^*\rangle$ is attackable with respect to the target arm $\tilde{x} \in \mathcal{A}$ if for any no-regret learning algorithm, there exists an attack method that uses $o(T)$ attack cost and fools the algorithm to pull arm $\tilde{x}$ at least $T - o(T)$ times with high probability for any $T$ large enough, i.e., $T$ larger than a constant $T_0$ . + +We make a few remarks about the above definition of attackability. First, this definition is all about the bandit environment $\langle \mathcal{A},\pmb{\theta}^*\rangle$ and the target arm $\tilde{x}$ , but independent of any specific bandit algorithm. Second, if an attack method can only fool a bandit algorithm to pull the target arm $\tilde{x}$ under a few different time horizons $T$ , it does not count as a successful attack – it has to succeed for infinitely many time horizons. Third, by reversing the order of quantifiers, we obtain the assertion that a bandit environment is not attackable w.r.t. the target arm $\tilde{x}$ if there exists some no-regret learning algorithm such that no attack method can use $o(T)$ attack cost to fool the algorithm to pull arm $\tilde{x}$ at least $T - o(T)$ times with high probability for any $T$ large enough. + +The following simple yet insightful example illustrates that there are indeed linear stochastic bandit environment setups where some no-regret learning algorithm cannot be attacked. + +Example 1 (An unattackable environment). Figure 1 shows a three-arm environment with $\mathcal{A} = \{x_1 = (0,1), x_2 = (1,2), x_3 = (-1,2)\}$ . Suppose the target arm $\tilde{x} = x_1$ + +![](images/4f0ebd6bbab8cf5340da3b3cc95fa9596fd3dc66dfacad1956a7294e79e55d88.jpg) +Figure 1. Illustration of attackability of a linear stochastic bandit environment. + +and the ground-truth bandit parameter $\pmb{\theta}^{*} = (1,1)^{3}$ . The expected true rewards of the arms are $r_1^* = 1$ , $r_2^* = 3$ , $r_3^* = 1$ and $x_{2}$ is the best arm in this environment. Based on Definition 1, we will need to identify a no-regret learning algorithm that cannot be attacked in this environment, and we argue that LinUCB is such an algorithm. Suppose, for the sake of contradiction, that there exists an efficient attack which fools LinUCB to pull $x_{1}T - o(T)$ times. LinUCB then must estimate $\pmb{\theta}^{*}$ in the $x_{1}$ 's direction almost accurately as $T$ becomes large, since the $\Omega (T)$ amount of true reward feedback in $x_{1}$ direction will ultimately dominate the $o(T)$ adversarial manipulations. This suggests that the estimated parameter $\hat{\pmb{\theta}}_t$ will be close to $(\alpha ,1)$ for some $\alpha$ . Since $(\alpha ,1)^{\mathsf{T}}(x_{2} + x_{3}) = 4$ , implying that either $x_{2}$ or $x_{3}$ will have its estimated reward larger than 2 (i.e., strictly larger than $x_{1}$ 's estimated reward) for any $\alpha$ . This shows that for large $T$ , $x_{1}$ cannot be the arm with the highest UCB during the execution of LinUCB, which causes a contradiction. Therefore, this environment cannot be efficiently attacked with $o(T)$ cost. Here we give an intuitive argument about this environment with target arm $\tilde{x}$ is not attackable, while its formal proof is an instantiation of our Theorem 1. + +Note that when $\mathcal{A} = \{x_1, x_2\}$ , the environment becomes attackable: as shown in Figure 1, a feasible attack strategy is to perturb reward according to $\tilde{\theta} = (-2, 1)$ . The key idea is that in the null space of $x_1$ , $\tilde{\theta}_{\perp}$ reduces the reward of $x_2$ to make $x_1$ the best arm without changing the actual reward of $x_1$ from the environment. The presence of arm $x_3$ prevents the existence of such a $\tilde{\theta}_{\perp}$ (and therefore $\tilde{\theta}$ ) and makes the environment unattackable. + +The above example motivates us to study when a linear stochastic bandit environment is attackable. After all, only when facing an unattackable environment, we can ensure the existence of a no-regret algorithm that will be robust to any $o(T)$ poisoning attacks. + +Next we show that there indeed exists a complete character + +ization about when a linear stochastic bandit environment is attackable. As Example 1 shows, the attackability of a bandit environment depends on the arm set $\mathcal{A} = \{x_i\}_{i=1}^k$ , the target arm $\tilde{x}$ , and the underlying bandit parameter $\theta^*$ . For clarity of presentation, in this section, we shall always assume that the adversary knows exactly the ground-truth bandit parameter $\theta^*$ and thus the true expected reward of each arm. This is also called the oracle attack in previous works (Jun et al., 2018; Rakhsha et al., 2020). But in the next section, we will show that this assumption is not necessary: when the bandit environment is indeed attackable, we can design provably successful attacks even if the adversary does not know the underlying bandit parameter $\theta^*$ . + +We need the following convenient notation to state our results. Let + +$$ +\boldsymbol {\theta} _ {\parallel} ^ {*} = \frac {\tilde {x} ^ {\top} \boldsymbol {\theta} ^ {*}}{\| \tilde {x} \| _ {2} ^ {2}} \tilde {x} \tag {1} +$$ + +denote the projection of ground-truth bandit parameter $\theta^{*}$ onto the targeted $\tilde{x}$ direction. Since the attackability depends on the target arm $\tilde{x}$ as well, we shall include the target arm $\tilde{x}$ as part of the bandit environment. The following theorem provides a clean characterization about the attackability of a linear stochastic bandit environment. + +Theorem 1 (Characterization of Attackability). A bandit environment $\langle \mathcal{A} = \{x_i\}_{i=1}^k, \pmb{\theta}^*, \tilde{x} \rangle$ is attackable if and only if the optimal objective $\epsilon^*$ of the following convex quadratic program (CQP) satisfies $\epsilon^* > 0$ . + +maximize $\epsilon$ + +subject to $\tilde{x}^{\mathsf{T}}\pmb{\theta}_{\parallel}^{*}\geq \epsilon +x_{a}^{\mathsf{T}}(\pmb{\theta}_{\parallel}^{*} + \tilde{\pmb{\theta}}_{\perp}),$ for $x_{a}\neq \tilde{x}$ + +$$ +\begin{array}{l} \tilde {x} ^ {\mathrm {T}} \tilde {\theta} _ {\perp} = 0 \\ \left\| \boldsymbol {\theta} _ {\parallel} ^ {*} + \tilde {\boldsymbol {\theta}} _ {\perp} \right\| _ {2} \leq 1 \tag {2} \\ \end{array} +$$ + +where $\epsilon \in \mathbb{R}$ and $\tilde{\theta}_{\perp} \in \mathbb{R}^d$ are variables. + +Since the conceptual message of Theorem 1 significantly differs from previous studies on adversarial attacks in bandit algorithms, we would like to elaborate on its implications. + +First of all, we, for the first time, point out some learning environment is intrinsically robust. Even the vanilla LinUCB algorithm, as we will analyze in the proof of Theorem 1, cannot be efficiently attacked when CQP (2) is not satisfied. Notably, although almost all previous works have focused on the vulnerability of bandit algorithms, e.g., by designing attacks against UCB, $\epsilon$ -Greedy (Jun et al., 2018), LinUCB (Garcelon et al., 2020), it just so happens that they were already studied under an attackable environment (see our Corollary 2). To our best knowledge, the problem about the intrinsic robustness of a linear bandit environment has not been studied before and can be viewed as a complement to these previous works. Second, as we will show next, our proof techniques are also significantly different from + +existing ones, since what is central to our proof is to demonstrate that when CQP (2) is not satisfied, there will exist a robust algorithm that cannot be efficiently attacked by any adversary. This can be viewed as analyzing the robustness of certain bandit algorithms when $\epsilon^{*} \leq 0$ in CQP (2). + +Since CQP (2) and its solutions will show up very often in our later analysis, we provide the following definition for reference convenience. + +Definition 2 (Attackability Index and Certificate). The optimal objective $\epsilon^{*}$ of CQP (2) is called the attackability index and the optimal solution $\tilde{\theta}_{\perp}$ to CQP (2) is called the attackability certificate. + +We should note both the index $\epsilon^{*}$ and certificate $\tilde{\theta}_{\perp}$ are intrinsic to the bandit environment $\langle \mathcal{A} = \{x_i\}_{i=1}^k, \boldsymbol{\theta}^*, \tilde{x} \rangle$ and are irrelevant to any bandit algorithms used. As we will see in the next section when designing attack algorithms without the knowledge of $\boldsymbol{\theta}^{*}$ , the index $\epsilon^{*}$ will determine how difficult it is to attack the environment. + +Proof Sketch of Theorem 1. Proof of sufficiency. This direction is relatively straightforward. Suppose the attackability index $\epsilon^{*} > 0$ and let $\tilde{\theta}_{\perp}$ be a certificate. We design the oracle null space attack based on the knowledge of bandit parameter $\theta^{*}$ . Let target parameter $\tilde{\theta} = \theta_{\parallel}^{*} + \tilde{\theta}_{\perp}$ where $\theta_{\parallel}^{*}$ is defined in Eq (1). The adversary perturbs the reward of any non-target arm $x_{a} \neq \tilde{x}$ by $\tilde{r}_{a,t} = x_{a}^{\mathrm{T}}\tilde{\theta} + \tilde{\eta}_{t}$ , whereas the reward of the target arm $\tilde{x}$ is not touched. To make attack appear less "suspicious", a sub-Gaussian noise $\tilde{\eta}_{t}$ is added to the perturbed reward to make it stochastic. The first constraint in CQP (2) ensures the non-target arms' rewards are smaller than the target arm's, and thus any no-regret bandit algorithm will only pull the non-target arms $o(T)$ times. The resulting cost is also $o(T)$ since the expected cost on each attack is bounded by a constant. Hence, such an attack is successful. Importantly, we note that this argument only relies on the definition of "no regret" but does not depend on what the algorithm is. This is crucial for proving the sufficiency of attackability. + +Proof of necessity. This is the more difficult direction. We shall prove that if $\epsilon^{*} \leq 0$ , the bandit environment is not attackable. To do so, we need to identify at least one no-regret bandit algorithm such that no attack strategy can successfully attack it. We argue that even the vanilla LinUCB is already robust to any attack strategy with $o(T)$ cost when $\epsilon^{*} \leq 0$ . Recall that LinUCB maintains an estimate $\hat{\theta}_{t}$ at round $t$ using the attacked rewards $\{\tilde{r}_{1:t}\}$ . We consider LinUCB with the choice of L2-regularization parameter $\lambda$ that guarantees $\|\hat{\theta}_{t}\|_{2} < 1$ in order to satisfy the last constraint in CQP (2). Consider the decomposition $\hat{\theta}_{t} = \hat{\theta}_{t,\parallel} + \hat{\theta}_{t,\perp}$ , + +where $\tilde{x} \perp \hat{\theta}_{t,\perp}$ and $\tilde{x} \parallel \hat{\theta}_{t,\parallel}$ . + +Suppose, for the sake of contradiction, that LinUCB is attackable when $\epsilon^{*} \leq 0$ . According to Definition 1, the target arm $\tilde{x}$ will be pulled $T - o(T)$ times with high probability for infinitely many different time horizons $T$ . Fix any large $T$ ; we know that $\tilde{x}$ must have the largest UCB score whenever it is pulled at some round $t \in [T]$ , or formally, for any $x_{a} \neq \tilde{x}$ we must have the following: + +$$ +\tilde {x} ^ {\mathsf {T}} \hat {\boldsymbol {\theta}} _ {t, \parallel} + \mathrm {C B} _ {t} (\tilde {x}) \geq x _ {a} ^ {\mathsf {T}} \hat {\boldsymbol {\theta}} _ {t, \parallel} + x _ {a} ^ {\mathsf {T}} \hat {\boldsymbol {\theta}} _ {t, \perp} + \mathrm {C B} _ {t} (x _ {a}). \quad (3) +$$ + +By attackability, we know that the above inequality will hold for infinitely many $ts$ . Our main idea to construct the proof is that as $t \to \infty$ , we have $\mathrm{CB}_t(\tilde{x}) \to 0$ and $\mathrm{CB}_t(x_a) > 0$ . Moreover, the estimation of $\hat{\theta}_{t,\parallel}$ will converge to $\pmb{\theta}_{\parallel}^{*}$ , since $\tilde{x}$ will be pulled for $t - o(t)$ times. The key challenge is to show $\mathrm{CB}_t(x_a) - \mathrm{CB}_t(\tilde{x})$ , due to Inequality (3), is strictly greater than 0 for all large $t$ . To do so, we prove a $\Theta \left( \sqrt{\frac{\log(t / \delta)}{o(t)}} \right)$ lower bound for $\mathrm{CB}_t(x_a)$ (Lemma 3 in Appendix B) and an $O\left( \sqrt{\frac{\log(t / \delta)}{t}} \right)$ upper bound for $\mathrm{CB}_t(\tilde{x})$ (Lemma 2). The main technical barrier we overcome is the lower bound proof for the confidence bound term, which employs non-standard arguments since most (if not all) of the bandit algorithm analysis only needs the upper bound of the confidence bound terms. Due to this reason, we believe this technical proof is of independent interest, particularly for the analysis of robust properties of linear bandit algorithms. + +By letting $t\to \infty$ , we obtain the following condition: + +$$ +\tilde {x} ^ {\mathsf {T}} \boldsymbol {\theta} _ {\parallel} ^ {*} > x _ {a} ^ {\mathsf {T}} \boldsymbol {\theta} _ {\parallel} ^ {*} + x _ {a} ^ {\mathsf {T}} \hat {\boldsymbol {\theta}} _ {t, \perp}, \forall x _ {a} \neq \tilde {x}. \tag {4} +$$ + +This implies that for any sufficiently large $t$ , there must exist a $\hat{\pmb{\theta}}_{t,\perp}$ that and makes the optimal objective of CQP (2) $\epsilon^{*}$ positive. But this contradicts the starting assumption of $\epsilon^{*} \leq 0$ ; hence, the bandit environment is not attackable. + +We now provide an intuitive explanation about Theorem 1. CQP (2) is to find $\tilde{\pmb{\theta}}_{\perp}$ such that: 1) it is orthogonal to $\tilde{x}$ (hence its subscript); and 2) it maximizes the gap $\epsilon$ between $\tilde{x}^{\mathsf{T}}\pmb{\theta}_{\parallel}^{*}$ and the largest $x_{a}^{\mathsf{T}}(\pmb{\theta}_{\parallel}^{*} + \tilde{\pmb{\theta}}_{\perp})$ among all $x_{a}\neq \tilde{x}$ . Theorem 1 states that the bandit environment is attackable if and only if such a gap is strictly larger than 0, i.e., when the geometry of context vectors allows the adversary to lower non-target arms' rewards in the null space of $\tilde{x}$ . The constraint $\| \pmb {\theta}_\parallel^* +\tilde{\pmb{\theta}}_\perp \| _2\leq 1$ ensures the attacked rewards are in the same scale as the unattacked rewards. + +Recent works have shown that any no-regret algorithm for the context-free $k$ -armed setting (where arm set $\mathcal{A}$ is orthonormal) can always be attacked (Liu & Shroff, 2019). This finding turns out to be a corollary of Theorem 1. + +Corollary 2. For standard stochastic multi-armed bandit setting where arm set $\mathcal{A}$ is orthonormal, the environment $\langle \mathcal{A} = \{x_a\}, \theta^*, \tilde{x} \rangle$ is attackable for any target arm $\tilde{x}$ . + +Proof. Since arms are orthogonal to each other, it is easy to see that $\tilde{\pmb{\theta}}_{\perp} = -C[\sum_{x_a:x_a\neq \tilde{x}}x_a]$ achieves objective value $C - \tilde{x}^T\pmb{\theta}_{\parallel}^*$ in CQP (2). Let $C$ be a large enough positive constant such that the objective value is positive gives us a feasible $\tilde{\pmb{\theta}}_{\perp}$ to CQP (2), which yields the corollary. + +The intuition behind this corollary is that arms in context-free stochastic multi-armed bandits are independent, and an adversary can arbitrarily lower the rewards of non-target arms to make the target arm optimal. This is also the attack strategy in (Jun et al., 2018; Liu & Shroff, 2019). Garcelon et al. (2020) showed that similar idea works for $k$ -armed linear contextual bandits where each arm is associated with an unknown bandit parameter and the reward estimations are independent among different arms. + +We should point an important distinction between poisoning attacks to $k$ -armed bandits and another line of research on stochastic bandits under adversarial corruption initiated by Lykouris et al. (2018). For poisoning attacks considered in this paper, the adversary manipulates the realized rewards after the algorithm selects an action, whereas in (Lykouris et al., 2018), the adversary manipulates the entire reward vector before the algorithm selects any action. Obviously, the later threat model is strictly weaker and has led to various bandit algorithms that can have sublinear regret so long as the total manipulation is sublinear in $T$ (Lykouris et al., 2018; Zimmert & Seldin, 2021). + +# 4. Effective Attacks without Knowledge of True Model Parameters + +In the previous section, we characterized the attackability of a linear stochastic bandit environment by assuming the knowledge of ground-truth bandit parameter $\theta^{*}$ . We now show that such prior knowledge is not needed when designing practical attacks. Towards this end, we propose provably effective attacks against two representative bandit algorithms: the most well-known LinUCB and a state-of-the-art robust linear stochastic bandit algorithm, Robust Phase Elimination (Bogunovic et al., 2021). We remark that the optimal attacks to these algorithms depend on the characteristics of algorithms themselves and are generally different, due to their different levels of robustness. This also resonates the important message mentioned in the introduction, i.e., the attackability analysis often goes hand-in-hand with the understanding of robustness of different algorithms, as reflected in various parts of our analysis. However, we point out that it is an intriguing open question to understand whether there is a single attack strategy that can manipulate any no-regret algorithm in an attackable environment. + +Two-stage Null Space Attack. Our proposed attack method is presented in Algorithm 1. The method spends + +the first $T_{1}$ rounds as the first stage to attack rewards on all arms by imitating a bandit environment $\theta_0$ , in which $\tilde{x}$ is the best arm such that arm $\tilde{x}$ will be pulled most often by the bandit algorithm. This stage is for the adversary to observe the true rewards of $\tilde{x}$ from the environment, which helps it estimate the parameter $\pmb{\theta}_{\parallel}^{*}$ . At round $T_{1}$ , the method uses the estimate of $\pmb{\theta}_{\parallel}^{*}$ , denoted as $\tilde{\pmb{\theta}}_{\parallel}$ , to perform the "attackability test" by solving CQP (2) using $\tilde{\pmb{\theta}}_{\parallel}$ to obtain an estimated index $\tilde{\epsilon}^*$ and certificate $\tilde{\pmb{\theta}}_{\perp}$ . If $\tilde{\epsilon}^{*} > 0$ , the method asserts the environment is attackable and starts the second stage of attack. From $T_{1}$ to $T$ , the method perturbs the reward of non-target arms by $\tilde{r}_t = x_{a_t}^\top (\tilde{\pmb{\theta}}_{\parallel} + \tilde{\pmb{\theta}}_{\perp}) + \tilde{\eta}_t$ (just like the oracle attack but using the estimated $\tilde{\pmb{\theta}}_{\parallel}$ ). When the bandit algorithm pulls the target arm $\tilde{x}$ for the first time in the second stage, the method will compensate the reward of $\tilde{x}$ as shown in line 20, where $n(\tilde{x})$ is the number of times target arm is pulled before $T_{1}$ . The goal is to correct the rewards on $\tilde{x}$ collected in the first stage to follow $\tilde{\pmb{\theta}}$ instead of $\pmb{\theta}_0$ . Note that a larger $T_{1}$ brings in more observations on $\tilde{x}$ to improve the estimate of $\pmb{\theta}_{\parallel}^{*}$ ; but it also means a higher attack cost. The optimal choice of $T_{1}$ depends on the "robustness" of the bandit algorithm to be attacked. Consequently, it also leads to different attack cost for different algorithms. For example, as we will show next, the attack to Robust Phase Elimination will be more costly than the attack to LinUCB. + +Note that our attackability test might make both false positive and false negative assertions due to the estimation error in $\tilde{\theta}_{\parallel}$ . But as $T$ becomes larger, the estimate gets more accurate and the assertion is correct with high probability. + +Remark 1. We acknowledge that the rewards from the two stages follow different reward distributions and could be detected, e.g., using some homogeneity test (Li et al., 2021). Thus a bandit player could realize the attack if equipped with some change detector. However, attacking such a cautious bandit algorithm is beyond the scope of this paper. Moreover, it is very difficult (if not impossible) to attack with a stationary reward distribution or undetectable perturbations (e.g., using a fixed target parameter $\tilde{\theta}$ ). We could easily find cases where the adversary's parameter $\tilde{\theta}$ is limited to extremely few choices and it is almost impossible to directly start the attack with a valid $\tilde{\theta}$ without knowing $\theta^{*}$ . For example, if we change the third arm in Example 1 to $x_{3} = (-1 + \epsilon, 0)$ with a small $\epsilon$ , we can see that the valid parameters are only in a small range around $\tilde{\theta} = (-1 - \epsilon, 1)$ . Therefore, in order to attack with a stationary reward distribution, the adversary needs to start from somewhere very close to $\tilde{\theta} = (-1 - \epsilon, 1)$ , which we believe is extremely difficult without knowing $\theta^{*}$ . Overall, we think designing an attack strategy against a bandit algorithm with reward change detector or showing the inability to attack such cautious algorithms is an important future work of ours. + +Algorithm 1 Two-stage Null Space Attack +1: Inputs: $T, T_1$ +2: $\pmb{\theta}_0 = \arg \max_{\|\pmb{\theta}\|_2 \leq 1} \left[\tilde{x}^{\mathsf{T}}\pmb{\theta} - \max_{x_a \neq \tilde{x}} x_a^{\mathsf{T}}\pmb{\theta}\right]$ , let $\epsilon_0^*$ be its optimal objective +3: if $\epsilon_0^* \leq 0$ then // Initial attackability test +4: return Not attackable +5: end if +6: for $t = 1$ to $T_1$ do +7: Set $\tilde{r}_t = x_{a_t}^{\mathsf{T}}\pmb{\theta}_0 + \tilde{\eta}_t$ // Attack as if $\tilde{x}$ is the best +8: Bandit algorithm observes modified reward $\tilde{r}_t$ +9: end for +10: Estimate $\tilde{\pmb{\theta}}_{\parallel} = \frac{\sum_{i=1}^{n(\tilde{x})} r_i(\tilde{x})}{n(\tilde{x})\|\tilde{x}\|_2^2} \tilde{x}$ +11: Solve CQP (2) using $\tilde{\pmb{\theta}}_{\parallel}$ to obtain the estimated attackability index $\tilde{\epsilon}^*$ and certificate $\tilde{\pmb{\theta}}_\perp$ +12: if $\tilde{\epsilon}^* \leq 0$ then // Attackability test +13: return Not attackable +14: else // Attack stage +15: Set $\tilde{\pmb{\theta}} = \tilde{\pmb{\theta}}_{\parallel} + \tilde{\pmb{\theta}}_\perp$ +16: for $t = T_1 + 1$ to $T$ do +17: if $x_{a_t} \neq \tilde{x}$ then +18: Set $\tilde{r}_t = x_{a_t}^{\mathsf{T}}\tilde{\pmb{\theta}} + \tilde{\eta}_t$ +19: else if $x_{a_t} = \tilde{x}$ for the first time then +20: Set $\tilde{r}_t = n(\tilde{x}) \times \tilde{x}^{\mathsf{T}}(\tilde{\pmb{\theta}} - \pmb{\theta}_0) + \tilde{x}^{\mathsf{T}}\tilde{\pmb{\theta}} + \tilde{\eta}_t$ +21: else +22: Set $\tilde{r}_t = r_t$ +23: end if +24: Bandit algorithm observes modified reward $\tilde{r}_t$ +25: end for +26: end if + +Attack against LinUCB. We now show how LinUCB algorithm can be attacked by Algorithm 1. + +Theorem 3. For large enough $T_{1}$ , the attack strategy in Algorithm 1 will correctly assert the attackability with probability at least $1 - \delta$ . Moreover, when the environment is attackable, with probability at least $1 - 3\delta$ the attack strategy will fool LinUCB to pull non-target arms at most + +$$ +\begin{array}{l} O \left(d \left(\sqrt {\log (T / \delta)} + \sqrt {T _ {1}} \log \left(T _ {1} / \delta\right) \right. \right. \\ \left. + \sqrt {T \log (1 / \delta)} / \sqrt {T _ {1}}\right) \sqrt {T \log (T / \delta)} / \epsilon^ {*}) \\ \end{array} +$$ + +rounds. And with probability at least $1 - 4\delta$ , the adversary's cost is at most + +$$ +\begin{array}{l} O \left(T _ {1} + d \left(\sqrt {\log (T / \delta)} + \sqrt {T _ {1}} \log \left(T _ {1} / \delta\right) \right. \right. \\ \left. + \sqrt {T \log (1 / \delta)} / \sqrt {T _ {1}}\right) \sqrt {T \log (T / \delta)} / \epsilon^ {*}). \\ \end{array} +$$ + +Specifically, when $T_{1} = T^{1 / 2}$ , the strategy gives the minimum attack cost in the order of $\tilde{O}(T^{3 / 4})$ , and the non-target arms are pulled at most $\tilde{O}(T^{3 / 4})$ rounds. + +Proof Sketch. To prove the assertion is correct with high probability, the key idea is that the estimated $\tilde{\pmb{\theta}}_{\parallel}$ is close to the true parameter $\pmb{\theta}_{\parallel}^{*}$ . We first note that in the first stage, the bandit algorithm will pull the target arm $\tilde{x}$ $T_{1} - O(\sqrt{T_{1}})$ times, since $\tilde{x}$ is the best arm according to $\pmb{\theta}_0$ . According to the Hoeffding's inequality, the estimation error $\| \tilde{\pmb{\theta}}_{\parallel} - \pmb{\theta}_{\parallel}^{*}\|_{2}\leq \sqrt{\frac{2\log(2 / \delta)}{T_{1} - O(\sqrt{T_{1}})}}$ . Therefore, with a large enough $T_{1}$ , the error on $\tilde{x}$ 's reward estimation is smaller than $\epsilon^{*}$ . Thus solving CQP (2) with $\tilde{\pmb{\theta}}_{\parallel}$ and we can correctly assert attackability with positive estimated index $\tilde{\epsilon}^{*}$ when the environment is attackable with index $\epsilon^{*}$ . + +To prove the success and the cost of the attack, we need to analyze the behavior of LinUCB under the reward discrepancy between the two stages. Our proof crucially hinges on the following robustness result of LinUCB. + +Lemma 1. Consider LinUCB with ridge regression under poisoning attack. Let $S_{t}^{\prime} = \sum_{\tau \in \{1\dots t\}, x_{a_{\tau}} \neq \tilde{x}} |\Delta_{\tau}|$ be the total corruption on non-target arms until time $t$ and assume every corruption on target arm is bounded by $\gamma$ . For any $t = 1\dots T$ , with probability at least $1 - \delta$ we have + +$$ +\left\| \tilde {\boldsymbol {\theta}} - \hat {\boldsymbol {\theta}} _ {t} \right\| _ {A _ {t}} \leq \alpha_ {t} + S _ {t} ^ {\prime} / \sqrt {\lambda} + \gamma \sqrt {t} \tag {5} +$$ + +where $\alpha_{t} = \sqrt{d\log\left(\frac{1 + t / \lambda}{\delta}\right)} +\sqrt{\lambda}.$ + +Based on this lemma, we can derive the regret $R_{T}(\tilde{\theta})$ of LinUCB with $\tilde{\theta}$ as the true parameter. The total corruption on non-target arms is $O\left(d\sqrt{T_1}\log (T_1 / \delta)\right)$ given the rewards are generated by $\theta_0$ (the rewards of target arm in the first stage are compensated in line 20). Because the target arm's rewards are not attacked in the second stage and follows $\theta^{*}$ , we have $\gamma = \tilde{O}(1 / \sqrt{T_1})$ . Since the non-target arms are pulled at most $R_{T}(\tilde{\theta}) / \epsilon^{*}$ rounds, substitute the total corruption back and we have the resulting bound. + +The attack cost has two sources: attacks in the first stage for $T_{1}$ times, and attacks on the non-target arms in the second stage. The second term has the same order as the number of rounds where the non-target arms are pulled by LinUCB. Each attack cost can be decomposed as 1) the change of mean reward $|x_{a}^{\mathsf{T}}(\tilde{\boldsymbol{\theta}} -\boldsymbol{\theta}^{*})|$ , and 2) the sub-Gaussian noise $|\tilde{\eta}_t|$ , the sum of which increases linearly with high probability. By setting $T_{1} = T^{1 / 2}$ , the total cost achieves $\hat{O}(T^{3 / 4})$ . + +Remark 2. Lemma 1 shows that LinUCB still enjoys sublinear regret for any corruption amount $S = o(\sqrt{T})$ . This tolerance of $o(\sqrt{T})$ attack turns out to be the same as the recently proposed robust linear contextual bandit algorithm based on phase elimination in (Bogunovic et al., 2021) (which we examine next). However, the regret term $S\sqrt{T}$ in LinUCB has a worse dependence on $S$ within the + +$S = o(\sqrt{T})$ regime compared to the $O(S^2)$ regret dependence of the robust algorithm in (Bogunovic et al., 2021). + +Attack against Robust Phase Elimination. We now show that Robust Phase Elimination (RobustPhE) (Bogunovic et al., 2021) can also be attacked by Algorithm 1. Comparing to attacking LinUCB, the robustness of Robust-PhE brings challenge to the first stage attack, as the attack cost is more sensitive to the length of this stage. + +Corollary 4. For any large enough $T_{1}$ , the attack strategy in Algorithm 1 will correctly assert the attackability with high probability. Moreover, when the environment is attackable, with probability at least $1 - 2\delta$ the attack strategy will fool RobustPhE to pull non-target arms at most + +$$ +O \left(\left(d \sqrt {T} \log (T / \delta) + \sqrt {d} T \log (T) \log (1 / \delta) / \sqrt {T _ {1}} + T _ {1} ^ {2}\right) / \epsilon^ {*}\right) +$$ + +rounds. And with probability at least $1 - 3\delta$ , the adversary's cost is at most + +$$ +O \left(T _ {1} + \left(d \sqrt {T} \log (T / \delta) + \sqrt {d} T \log (T) \log (1 / \delta) / \sqrt {T _ {1}} + T _ {1} ^ {2}\right) / \epsilon^ {*}\right) +$$ + +Specifically, setting $T_{1} = T^{2/5}$ gives the minimum attack cost order $\tilde{O}(T^{4/5})$ and the non-target arms are pulled at most $\tilde{O}(T^{4/5})$ rounds. + +RobustPhE has an additional regret term $O(S^2)$ for total corruption $S$ (assuming $S$ is unknown to the bandit algorithm). If we view the second stage attack model $\tilde{\theta}$ as the underlying environment bandit model, rewards generated by $\theta_0$ in the first stage should be considered as corrupted rewards. The $T_1$ amount of rewards from the first stage means $T_1$ amount of corruption, which leads to the additional $T_1^2$ term compared with the results in Theorem 3. Hence, the adversary can only run fewer iterations in the first stage but spend more attack cost there. On the other hand, this also facilitates the design of attack such that line 19-20 in Algorithm 1 is not necessary: the corruption in the first stage can be handled by the robustness of RobustPhE. The unattacked rewards in second stage are viewed as misspecification from $\tilde{\theta}$ with error $\gamma$ , which leads to the $\tilde{O}(\gamma T)$ term (the second term) in the bound. Our success in attacking RobustPhE does not violate the robustness claim in the original paper (Bogunovic et al., 2021): RobustPhE could tolerate $o(\sqrt{T})$ corruption and our attack cost is $\tilde{O}(T^{4/5})$ . + +# 5. Experiments + +We use simulation-based experiments to validate the effectiveness and cost-efficiency of our proposed attack methods. In our simulations, we generate a size- $k$ arm pool $\mathcal{A}$ , in which each arm $a$ is associated with a context vector $x_{a} \in \mathbb{R}^{d}$ . Each dimension of $x_{a}$ is drawn from a set of zero-mean Gaussian distributions with variances sampled from a uniform distribution $U(0,1)$ . Each $x_{a}$ is then normalized + +![](images/7780d8ff9d2bbf279e46a8dc87c998be112dab56cef3b5aa58329e0bf03f4eb2.jpg) +Figure 2. Total cost of attack under different attack methods. We report averaged cost and its variance of 10 runs. + +![](images/6c04d0d51c0700aec5057e41c7e47c296c54e30c78acabfdab54e915b1e4492c.jpg) +Figure 3. Target arm pulls under different attack methods. + +to $\| x_{a}\|_{2} = 1$ . The bandit model parameter $\pmb{\theta}^{*}$ is sampled from $N(0,1)$ and normalized to $\| \pmb{\theta}^{*}\|_{2} = 1$ . We set $d$ to 10, the standard derivation $\sigma$ of Gaussian noise $\eta_t$ and $\tilde{\eta}_t$ to 0.1, and the arm pool size $k$ to 30 in our simulations. We run the experiment for $T = 10,000$ iterations. To create an attackable environment, we will re-sample the environment $\langle \mathcal{A},\pmb{\theta}^{*},\tilde{x}\rangle$ until it is attackable, following Theorem 1. + +We compared the two proposed attack methods, oracle null space attack and two-stage null space attack, against LinUCB (Li et al., 2010) and Robust Phase Elimination (RobustPhE) (Bogunovic et al., 2021). We report average results of 10 runs where in each run we randomly sample an attackable environment. Both oracle attack and two-stage attack can effectively fool the two bandit algorithms to pull the target arm linear times as shown in Figure 3, and the total cost of the attack is shown in Figure 2. We observe that both attack methods are cost-efficient with a sublinear total cost, while the two-stage attack requires higher attack cost when attacking the same bandit algorithm. Specifically, we notice that the adversary spends almost linear cost in the first stage. This is because in the first stage the adversary attacks according to parameter $\theta_0$ , which leads to an almost constant cost at every round. This is to help the adversary to estimate bandit model parameter in order to construct + +target parameter $\tilde{\theta}$ . In the second stage, the cost gets much smaller since the adversary only attacks the non-target arms. We also notice that for the same attack method, attacking RobustPhE requires a higher cost and the number of target arm pull is also smaller comparing with attacking LinUCB, due to the robustness of the algorithm. + +# 6. Related Work + +Adversarial attacks to bandit algorithms was first studied in the stochastic multi-armed bandit setting (Jun et al., 2018; Liu & Shroff, 2019) and recently in linear contextual bandits (Garcelon et al., 2020). These works share a similar attack idea: lowering the rewards of non-target arms while not modifying the reward of target arm. However, as our attackability analysis revealed, this idea can fail in a linear stochastic bandit environment where one cannot lower the rewards of non-target arms without modifying the reward of target arm, due to their correlation. This insight is a key reason that gives rise to unattackable environments. Ma et al. (2018) also considered the attackability issue of linear bandits, but under the setting of offline data poisoning attack where the adversary has the power to modify the rewards in history. There are also several recent works on reward poisoning attacks against reinforcement learning (Yu & Sra, 2019; Zhang et al., 2020; Rakhsha et al., 2021; 2020), but with quite different focus as ours. Besides reward poisoning attacks, recent works also studied other threat model such as action poisoning attacks (Liu & Lai, 2020; 2021). + +A parallel line of works focused on improving the robustness of bandit algorithms. Lykouris et al. (2018) proposed a robust MAB algorithm and Gupta et al. (2019) further improved the solution with additive regret dependency on attack cost. Zimmert & Seldin (2021); Masoudian & Seldin (2021) proposed best-of both-world solutions for both stochastic and adversarial bandits which also solved stochastic bandits with adversarial corruption. Ito (2021) further proposed optimal robust algorithm to adversarial corruption. These work assumed a weaker oblivious adversary who determines the manipulation before the bandit algorithm pulls an arm. Hajiesmaili et al. (2020) studied robust adversarial bandit algorithm. Guan et al. (2020) proposed a median-based robust bandit algorithm for probabilistic unbounded attack. Bogunovic et al. (2021) proposed robust phase elimination algorithm for linear stochastic bandits under a stronger adversary (same as ours), which could tolerate $o(\sqrt{T})$ corruption when the total corruption is unknown to the algorithm. We showed that our two-stage null space attack could effectively attack this algorithm with $\tilde{O}(T^{4/5})$ cost. Recently, Zhao et al. (2021) proposed an OFUL style robust algorithm that can handle infinite action set, but only tolerates $o(T^{1/4})$ corruption. + +# 7. Conclusion + +In this paper, we studied the problem of poisoning attacks in $k$ -armed linear stochastic bandits. Different from context-free stochastic bandits and $k$ -armed linear contextual bandits where the environment is always attackable, we showed that some linear stochastic bandit environments are not attackable due to the correlation among arms. We characterized the attackability condition as the feasibility of a CQP based on the geometry of the arms' context vectors. Our key insight is that given the ground-truth parameter $\theta^{*}$ , the adversary should perform oracle attack that lowers the reward of non-target arms in the null space of the target arm's convex vector $\tilde{x}$ . Based on this insight, we proposed a two-stage null space attack without the knowledge of $\theta^{*}$ and applied it against LinUCB and Robust Phase Elimination. We showed that the proposed attack methods are effective and cost-efficient, both theoretically and empirically. + +As our future work, it is interesting to study the lower bound of attack cost in linear stochastic bandits and also design cost-optimal attack method with a matching upper bound. One idea is to design a multi-stage attack method following the doubling trick idea, which was brief discussed in Appendix C.3. Although the analysis could be much more challenging than our two-stage attack, it may lead to a lower attack cost as well as handling unknown time horizon $T$ . Another intriguing direction is to study algorithm-oblivious choice of the length of the first stage $T_{1}$ — or more generally, algorithm-oblivious attack strategies — that can achieve sublinear cost for arbitrary no-regret algorithm without the knowledge of $\theta^{*}$ . + +# Acknowledgements + +This work is based upon work supported by National Science Foundation under grant IIS-2128019, IIS-2007492 and IIS-1838615, Bloomberg Data Science Ph.D. Fellowship, and a Google Faculty Research Award. + +# References + +Abbasi-yadkori, Y., Pál, D., and Szepesvári, C. Improved algorithms for linear stochastic bandits. In NIPS, pp. 2312-2320. 2011. +Auer, P. Using confidence bounds for exploitation-exploration trade-offs. Journal of Machine Learning Research, 3:397-422, 2002. +Bogunovic, I., Losalka, A., Krause, A., and Scarlett, J. Stochastic linear bandits robust to adversarial attacks. In International Conference on Artificial Intelligence and Statistics, pp. 991-999. PMLR, 2021. +Chapelle, O. and Li, L. An empirical evaluation of thompson + +sampling. In Advances in neural information processing systems, pp. 2249-2257, 2011. +Durand, A., Achilleos, C., Iacovides, D., Strati, K., Mitsis, G. D., and Pineau, J. Contextual bandits for adapting treatment in a mouse model of de novo carcinogenesis. In Machine Learning for Healthcare Conference, pp. 67-82, 2018. +Garcelon, E., Roziere, B., Meunier, L., Tarbouriech, J., Teytaud, O., Lazaric, A., and Pirotta, M. Adversarial attacks on linear contextual bandits. Advances in Neural Information Processing Systems, 33, 2020. +Guan, Z., Ji, K., Bucci Jr, D. J., Hu, T. Y., Palombo, J., Liston, M., and Liang, Y. Robust stochastic bandit algorithms under probabilistic unbounded adversarial attack. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pp. 4036-4043, 2020. +Gupta, A., Koren, T., and Talwar, K. Better algorithms for stochastic bandits with adversarial corruptions. In Conference on Learning Theory, pp. 1562-1578. PMLR, 2019. +Hajiesmaili, M., Talebi, M. S., Lui, J., Wong, W. S., et al. Adversarial bandits with corruptions: Regret lower bound and no-regret algorithm. Advances in Neural Information Processing Systems, 33, 2020. +Ito, S. On optimal robustness to adversarial corruption in online decision problems. Advances in Neural Information Processing Systems, 34:7409-7420, 2021. +Jun, K.-S., Li, L., Ma, Y., and Zhu, J. Adversarial attacks on stochastic bandits. In Advances in Neural Information Processing Systems, pp. 3640-3649, 2018. +Lattimore, T., Szepesvari, C., and Weisz, G. Learning with good feature representations in bandits and in rl with a generative model. In International Conference on Machine Learning, pp. 5662-5670. PMLR, 2020. +Li, C., Wu, Q., and Wang, H. Unifying clustered and nonstationary bandits. In International Conference on Artificial Intelligence and Statistics, pp. 1063-1071. PMLR, 2021. +Li, L., Chu, W., Langford, J., and Schapire, R. E. A contextual-bandit approach to personalized news article recommendation. In Proceedings of the 19th international conference on World wide web, pp. 661-670. ACM, 2010. +Liu, F. and Shroff, N. Data poisoning attacks on stochastic bandits. In International Conference on Machine Learning, pp. 4042-4050, 2019. + +Liu, G. and Lai, L. Action-manipulation attacks on stochastic bandits. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 3112-3116. IEEE, 2020. +Liu, G. and Lai, L. Provably efficient black-box action poisoning attacks against reinforcement learning. Advances in Neural Information Processing Systems, 34, 2021. +Lykouris, T., Mirrokni, V., and Paes Leme, R. Stochastic bandits robust to adversarial corruptions. In Proceedings of the 50th Annual ACM SIGACT Symposium on Theory of Computing, pp. 114-122. ACM, 2018. +Ma, Y., Jun, K.-S., Li, L., and Zhu, X. Data poisoning attacks in contextual bandits. In International Conference on Decision and Game Theory for Security, pp. 186-204. Springer, 2018. +Masoudian, S. and Seldin, Y. Improved analysis of the tsallis-inf algorithm in stochastically constrained adversarial bandits and stochastic bandits with adversarial corruptions. In Conference on Learning Theory, pp. 3330-3350. PMLR, 2021. +Rakhsha, A., Radanovic, G., Devidze, R., Zhu, X., and Singla, A. Policy teaching via environment poisoning: Training-time adversarial attacks against reinforcement learning. In International Conference on Machine Learning, pp. 7974-7984. PMLR, 2020. +Rakhsha, A., Zhang, X., Zhu, X., and Singla, A. Reward poisoning in reinforcement learning: Attacks against unknown learners in unknown environments. arXiv preprint arXiv:2102.08492, 2021. +Vershynin, R. High-dimensional probability: An introduction with applications in data science, volume 47. Cambridge university press, 2018. +Yu, T. and Sra, S. Efficient policy learning for non-stationary mdps under adversarial manipulation. arXiv preprint arXiv:1907.09350, 2019. +Zhang, X., Ma, Y., Singla, A., and Zhu, X. Adaptive reward-poisoning attacks against reinforcement learning. arXiv preprint arXiv:2003.12613, 2020. +Zhao, H., Zhou, D., and Gu, Q. Linear contextual bandits with adversarial corruptions. arXiv preprint arXiv:2110.12615, 2021. +Zimmert, J. and Seldin, Y. Tsallis-inf: An optimal algorithm for stochastic and adversarial bandits. *J. Mach. Learn.* Res., 22:28-1, 2021. + +# A. Notations + +For clarity, we collect the notations used in the paper below. + +$\tilde{x}$ Context vector of target arm + $x_{a}$ Context vector of arm $a$ $\pmb{\theta}^{*}$ Unknown bandit model parameter of the environment + $\pmb{\theta}_{\parallel}^{*}$ Projection of $\pmb{\theta}^{*}$ on $\tilde{x}$ $r_t$ Unattacked reward feedback at time $t$ $\eta_t$ Sub-Gaussian noise in reward, i.e., $r_t = x_t^\top \pmb{\theta}^* +\eta_t$ $\tilde{r}_t$ Attacked reward + $\hat{\pmb{\theta}}_t$ Parameter estimated by the victim bandit algorithm with attacked rewards $\{\tilde{r}_{1:t}\}$ $\tilde{\pmb{\theta}}_{\parallel}$ Parameter parallel to $\tilde{x}$ , estimated by adversary with unattacked rewards + $\tilde{\pmb{\theta}}$ Parameter of adversary's attack strategy + $\tilde{\pmb{\theta}}_{\perp}$ Attackability certificate, the parameter orthogonal to $\tilde{x}$ solved by CQP (2) + $\epsilon^{*}$ Attackability index, optimal objective of CQP (2) + $\tilde{\epsilon}^{*}$ Estimated index, optimal objective of CQP (2) with $\tilde{\theta}_{\parallel}$ replacing $\pmb{\theta}_{\parallel}^{*}$ + +# B. Details on Attackability of Linear Stochastic Bandits + +We illustrate the details of oracle null space attack in Algorithm 2, which is constructed for the sufficiency proof of Theorem 1. + +Algorithm 2 Oracle Null Space Attack +1: Inputs: $T, \theta^{*}$ +2: Initialize: +3: if Optimal objective $\epsilon^{*}$ of CQP $(2) > 0$ then // Attackability Test +4: Find the optimal solution $\tilde{\theta}_{\perp}$ +5: Set $\tilde{\theta} = \theta_{\parallel}^{*} + \tilde{\theta}_{\perp}$ +6: else +7: return Not attackable +8: end if +9: for $t = 1$ to $T$ do +10: Bandit algorithm pulls arm $a_t$ +11: Attacker observes the corresponding reward $r_t = x_{a_t}^{\top} \theta^{*} + \eta_t$ from the environment +12: if $x_{a_t} \neq \tilde{x}$ then +13: Set $\tilde{r}_t = x_{a_t}^{\top} \tilde{\theta} + \tilde{\eta}_t$ // Attack +14: else +15: Set $\tilde{r}_t = r_t$ +16: end if +17: Bandit algorithm observes modified reward $\tilde{r}_t$ +18: end for + +# B.1. Sufficiency Proof of Theorem 1 + +Proof. For sufficiency proof, we show that there exists an efficient attack strategy if CQP (2) holds. + +Suppose the attackability index $\epsilon^{*} > 0$ and let $\tilde{\theta}_{\perp}$ be a certificate. In Algorithm 2, we design the oracle null space attack based on the knowledge of bandit parameter $\pmb{\theta}^{*}$ . Let $\tilde{\pmb{\theta}} = \pmb{\theta}_{\parallel}^{*} + \tilde{\pmb{\theta}}_{\perp}$ where $\pmb{\theta}_{\parallel}^{*}$ is defined in Eq (1). The adversary perturbs the reward of any non-target arm $x_{a} \neq \tilde{x}$ by $\tilde{r}_{a,t} = x_{a}^{\mathsf{T}}\tilde{\pmb{\theta}} + \tilde{\eta}_{t}$ , whereas the reward of the target arm $\tilde{x}$ is not touched. In other words, the adversary misleads the algorithm to believe that $\tilde{\pmb{\theta}}$ is the ground-truth parameter. We should note both $\tilde{\pmb{\theta}}$ and $\pmb{\theta}^{*}$ generate the same expected reward on $\tilde{x}$ , i.e., $\tilde{x}^{\mathsf{T}}\tilde{\pmb{\theta}} = \tilde{x}^{\mathsf{T}}\pmb{\theta}_{\parallel}^{*} = \tilde{x}^{\mathsf{T}}\pmb{\theta}^{*}$ . To make the attack appear less "suspicious", a sub-Gaussian noise term $\tilde{\eta}_t$ is added to the perturbed reward to make it stochastic. The key idea is that the attacker does not need to perturb the reward of the target arm because the original reward is the same as perturbed reward in expectation. + +Instead, the attacker only perturbs the reward in the null space of $\tilde{x}$ according to $\tilde{\theta}_{\perp}$ , which guarantees the cost-efficiency of the attack. + +Since the perturbed rewards observed by the bandit algorithm are generated by $\tilde{\theta}$ , the target arm $\tilde{x}$ is the optimal arm in this environment due to the attackability index $\epsilon^{*}$ being strictly positive. According to the definition, any no-regret bandit algorithm will only pull suboptimal arms, i.e., the non-target arms, $o(T)$ times and pull target arm $T - o(T)$ times with high probability. Thus the attack is successful. Moreover, the cost of oracle attack is $o(T)$ because the attacker only perturbs rewards on the non-target arms for $o(T)$ times, and the cost on each attack is bounded by a constant (because of the finite norm of $x_{a}$ and $\theta^{*}$ ). + +# B.2. Necessity Proof of Theorem 1 + +To prove its necessity, we will rely on the following results. + +Lemma 2. Suppose arm $x$ is pulled $n$ times till round $t$ by LinUCB. Its confidence bound $CB_{t}(x)$ in LinUCB satisfies + +$$ +C B _ {t} (x) \leq \frac {\alpha_ {t}}{\sqrt {n}}. \tag {6} +$$ + +with probability at least $1 - \delta$ , where $\alpha_{t} = \sqrt{d\log\left(\frac{1 + t / \lambda}{\delta}\right)} + \sqrt{\lambda}$ . Furthermore, we have + +$$ +C B _ {t} (x) \leq O \left(\sqrt {\frac {\log (t / \delta)}{n}}\right) \tag {7} +$$ + +with probability at least $1 - \delta$ . + +Proof. In (Abbasi-yadkori et al., 2011), the exploration bonus term is computed as $\mathrm{CB}_t(x) = \alpha_t\| x\|_{\mathbf{A}_t^{-1}}$ . Denote $\mathbf{A}_t^\prime = n\times xx^{\top} + \lambda \mathbf{I}$ . Since $\mathbf{A}_t = \sum_{i = 1}^{t}x_{a_i}x_{a_i}^{\top} + \lambda \mathbf{I}$ , we have $\mathbf{A}_t\succ \mathbf{A}_t^\prime$ . We can thus bound $\| x\|_{\mathbf{A}_t^{-1}}$ by + +$$ +\left\| x \right\| _ {\mathbf {A} _ {t} ^ {- 1}} \leq \left\| x \right\| _ {\mathbf {A} _ {t} ^ {\prime - 1}} \leq \frac {1}{\sqrt {n}} \tag {8} +$$ + +According to Theorem 2 in (Abbasi-yadkori et al., 2011), + +$$ +\alpha_ {t} = \sqrt {d \log \left(\frac {1 + t / \lambda}{\delta}\right)} + \sqrt {\lambda} = \Theta (\sqrt {\log (t / \delta)}). \tag {9} +$$ + +Combining $\alpha_{t}$ and (8) finishes the proof. + +Claim 1. Target arm $\tilde{x}$ is pulled $n = T - o(T)$ times till round $T$ . According to Lemma 2, we have + +$$ +C B _ {t} (\tilde {x}) \leq O \left(\sqrt {\frac {\log (T / \delta)}{T - o (T)}}\right) \tag {10} +$$ + +Lemma 3. Suppose arm $x$ is pulled $t - m$ times till round $t$ by LinUCB, and other arms are pulled $m$ times in total. Confidence bound $CB_{t}(x_{a})$ of any arm $x_{a}$ that is not parallel to $x$ satisfies + +$$ +C B _ {t} \left(x _ {a}\right) \geq \alpha_ {t} \left(\frac {1}{\sqrt {m + \lambda}} - \frac {b}{\sqrt {t - m + \lambda}}\right) \tag {11} +$$ + +with probability at least $1 - \delta$ , where $\alpha_{t} = \sqrt{d\log\left(\frac{1 + t / \lambda}{\delta}\right)} + \sqrt{\lambda} S$ and constant $b = \frac{x_a^\top x}{x^\top x}$ . Furthermore, we have + +$$ +C B _ {t} \left(x _ {a}\right) \geq \Theta \left(\sqrt {\log (t / \delta)} \left(\frac {1}{\sqrt {m}} - \frac {1}{\sqrt {t - m}}\right)\right) \tag {12} +$$ + +with probability at least $1 - \delta$ + +Proof. Since $\mathrm{CB}_t(x) = \alpha_t\| x\|_{\mathbf{A}_t^{-1}}$ , we need to show a lower bound of $\| x_a\|_{\mathbf{A}_t^{-1}}$ . Since $x_{a}\nVdash x$ , we decompose $x_{a} = x_{a}^{\parallel} + x_{a}^{\perp}$ , where $x_{a}^{\parallel}\parallel x$ . By the reverse triangle inequality we have + +$$ +\left\| x _ {a} \right\| _ {\mathbf {A} _ {t} ^ {- 1}} \geq \left\| x _ {a} ^ {\perp} \right\| _ {\mathbf {A} _ {t} ^ {- 1}} - \left\| x _ {a} ^ {\parallel} \right\| _ {\mathbf {A} _ {t} ^ {- 1}} \tag {13} +$$ + +First we analyze the term $\| x_{a}^{\perp}\|_{\mathbf{A}_{t}^{-1}}$ . Decompose $\mathbf{A}_t = (t - m)\times xx^\top +\sum_{i,x_{a_i}\neq x}x_{a_i}x_{a_i}^\top +\lambda \mathbf{I}$ and let $\mathbf{A}_t^\prime = \sum_{i,x_{a_i}\neq x}x_{a_i}x_{a_i}^\top +\lambda \mathbf{I}$ . Since $x_{a}^{\perp}\perp x$ , we have + +$$ +x _ {a} ^ {\perp} ^ {\mathsf {T}} \mathbf {A} _ {t} x _ {a} ^ {\perp} = x _ {a} ^ {\perp} ^ {\mathsf {T}} \mathbf {A} _ {t} ^ {\prime} x _ {a} ^ {\perp}. +$$ + +There are at most $m$ terms in the summation of $\mathbf{A}_t^\prime = \sum_{i,x_{a_i}\neq x}x_{a_i}x_{a_i}^{\top} + \lambda I$ , thus + +$$ +x _ {a} ^ {\perp} ^ {\mathsf {T}} \mathbf {A} _ {t} ^ {\prime} x _ {a} ^ {\perp} \leq x _ {a} ^ {\perp} ^ {\mathsf {T}} \left(\frac {m}{\| x _ {a} ^ {\perp} \| _ {2} ^ {2}} \times x _ {a} ^ {\perp} x _ {a} ^ {\perp} ^ {\mathsf {T}} + \lambda \mathbf {I}\right) x _ {a} ^ {\perp} \leq m + \lambda +$$ + +Then we have + +$$ +\left\| x _ {a} ^ {\perp} \right\| _ {\mathbf {A} _ {t} ^ {- 1}} = \sqrt {x _ {a} ^ {\perp} {} ^ {\mathsf {T}} \mathbf {A} _ {t} ^ {- 1} x _ {a} ^ {\perp}} = \sqrt {x _ {a} ^ {\perp} {} ^ {\mathsf {T}} \mathbf {A} _ {t} ^ {\prime - 1} x _ {a} ^ {\perp}} = \frac {1}{\sqrt {x _ {a} ^ {\perp} {} ^ {\mathsf {T}} \mathbf {A} _ {t} ^ {\prime} x _ {a} ^ {\perp}}} \geq \frac {1}{\sqrt {m + \lambda}} \tag {14} +$$ + +Similar to Eq (8), we have + +$$ +\left\| x _ {a} ^ {\parallel} \right\| _ {\mathbf {A} _ {t} ^ {- 1}} \leq \frac {\left\| x _ {a} ^ {\parallel} \right\| _ {2}}{\| x \| _ {2}} \frac {1}{\sqrt {t - m + \lambda}} \tag {15} +$$ + +Let constant $b = \frac{\|x_a\|_2}{\|x\|_2} = \frac{x_a^\top x}{x^\top x}$ . Substitute the terms and we have + +$$ +\mathrm {C B} _ {t} (x) = \alpha_ {t} \| x \| _ {\mathbf {A} _ {t} ^ {- 1}} \geq \alpha_ {t} \left(\| x _ {a} ^ {\perp} \| _ {\mathbf {A} _ {t} ^ {- 1}} - \| x _ {a} ^ {\parallel} \| _ {\mathbf {A} _ {t} ^ {- 1}}\right) \geq \alpha_ {t} \left(\frac {1}{\sqrt {m + \lambda}} - \frac {b}{\sqrt {t - m + \lambda}}\right). \tag {16} +$$ + +Claim 2. Non-target arms are pulled $m = o(T)$ times till round $T$ . According to Lemma 3, any arm $x_{a} \nVdash \tilde{x}$ satisfies + +$$ +C B _ {t} \left(x _ {a}\right) \geq \Theta \left(\sqrt {\log (T / \delta)} \left(\frac {1}{\sqrt {o (T)}} - \frac {1}{\sqrt {T - o (T)}}\right)\right) \tag {17} +$$ + +with probability at least $1 - \delta$ . + +Lemma 4. Suppose the non-target arms $\{x_{a} \neq \tilde{x}\}$ are pulled $o(T)$ times, the arm $\tilde{x}$ is pulled $T - o(T)$ times, and the total manipulation is $C_{T}$ . With probability at least $1 - \delta$ , reward estimation error satisfies + +$$ +\left| x ^ {\mathsf {T}} \hat {\boldsymbol {\theta}} _ {T, \parallel} - x ^ {\mathsf {T}} \boldsymbol {\theta} _ {\parallel} ^ {*} \right| \leq \frac {C _ {T}}{T - o (T)} + \frac {\alpha_ {t}}{\sqrt {T - o (T)}}, \quad \forall x \in \mathcal {A}. \tag {18} +$$ + +Proof. + +$$ +\begin{array}{l} \| \hat {\boldsymbol {\theta}} _ {T, \|} - \boldsymbol {\theta} _ {\|} ^ {*} \| _ {2} = \left\| \frac {\tilde {x} ^ {\mathsf {T}} (\hat {\boldsymbol {\theta}} _ {T} - \boldsymbol {\theta} ^ {*})}{\| \tilde {x} \| _ {2} ^ {2}} \tilde {x} \right\| _ {2} \\ = \frac {1}{\| \tilde {x} \| _ {2} ^ {2}} \left\| \tilde {x} ^ {\mathsf {T}} \mathbf {A} _ {t} ^ {- 1} \left(\sum_ {t = 1} ^ {T} x _ {t} \tilde {r} _ {t} (x _ {t}) - \mathbf {A} _ {t} \boldsymbol {\theta} ^ {*}\right) \tilde {x} \right\| _ {2} \\ = \frac {1}{\| \tilde {x} \| _ {2} ^ {2}} \left\| \tilde {x} ^ {\mathsf {T}} \mathbf {A} _ {t} ^ {- 1} \left(\sum_ {t = 1} ^ {T} x _ {t} \left(\tilde {r} _ {t} \left(x _ {t}\right) - x _ {t} ^ {\mathsf {T}} \boldsymbol {\theta} ^ {*}\right) - \lambda \boldsymbol {\theta} ^ {*}\right) \tilde {x} \right\| _ {2} \\ \leq \frac {1}{\| \tilde {\boldsymbol {x}} \| _ {2} ^ {2}} \left\| \tilde {\boldsymbol {x}} ^ {\mathsf {T}} \mathbf {A} _ {t} ^ {- 1} \left(\sum_ {t = 1} ^ {T} x _ {t} \Delta_ {t} + \sum_ {t = 1} ^ {T} x _ {t} \eta_ {t} - \lambda \boldsymbol {\theta} ^ {*}\right) \tilde {\boldsymbol {x}} \right\| _ {2} \\ \leq \frac {1}{\| \tilde {x} \| _ {2} ^ {2}} \left\| \tilde {x} ^ {\mathsf {T}} \mathbf {A} _ {t} ^ {- 1} \left(\sum_ {t = 1} ^ {T} x _ {t} \Delta_ {t}\right) \tilde {x} \right\| _ {2} + \frac {1}{\| \tilde {x} \| _ {2} ^ {2}} \left\| \tilde {x} ^ {\mathsf {T}} \mathbf {A} _ {t} ^ {- 1 / 2} \mathbf {A} _ {t} ^ {- 1 / 2} \left(\sum_ {t = 1} ^ {T} x _ {t} \eta_ {t} - \lambda \boldsymbol {\theta} ^ {*}\right) \tilde {x} \right\| _ {2} \\ \leq \frac {C _ {T}}{T - o (T)} + \frac {\alpha_ {t}}{\sqrt {T - o (T)}} \\ \end{array} +$$ + +Note that $\| \tilde{x}\| _2\leq 1$ . In the last step, the first term is because there are $T - o(T)$ number of $\tilde{x}\tilde{x}^{\top}$ in $A_{t}$ and $\| \tilde{x}^{\mathsf{T}}\mathbf{A}_{t}^{-1}\|_{2}\leq \frac{1}{T - o(T)}$ , and $\| \sum_{t = 1}^{T}x_{t}\Delta_{t}\|_{2}$ is bounded by total manipulation $C_T$ . Similarly, in the second term we have $\| \tilde{x}^{\mathsf{T}}\mathbf{A}_{t}^{-1 / 2}\|_{2}\leq \frac{1}{\sqrt{T - o(T)}}$ , and $\| \mathbf{A}_t^{-1 / 2}\left(\sum_{t = 1}^T x_t\eta_t - \lambda \pmb {\theta}^*\right)\|_2\leq \| \mathbf{A}_t^{-1 / 2}\left(\sum_{t = 1}^T x_t\eta_t\right)\|_2 + \| \mathbf{A}_t^{-1 / 2}\lambda \pmb {\theta}^*\|_2 =$ $\| \sum_{t = 1}^{T}x_{t}\eta_{t}\|_{\mathbf{A}_{t}^{-1}} + \| \lambda \pmb{\theta}^{*}\|_{\mathbf{A}_{t}^{-1}}\leq \alpha_{t}$ is the self-normalized bound for vector-valued martingales following Theorem 1 in (Abbasi-yadkori et al., 2011). + +Now we are ready to prove that the index $\epsilon^{*}$ in CQP (2) being positive is the necessary condition of an attachable environment. + +Proof of Necessity of Theorem 1. We prove if $\epsilon^{*} \leq 0$ , the bandit environment is not attackable. To prove this, we show that there exists some no-regret bandit algorithm (LinUCB in particular) such that no attacking strategy can succeed. In particular, we will show that LinUCB (with a specific choice of its L2-regularization parameter $\lambda$ ) is robust under any attacking strategy with $o(T)$ cost when $\epsilon^{*} \leq 0$ . We prove it by contradiction: assume LinUCB is attackable with $o(T)$ cost when $\epsilon^{*} \leq 0$ . According to Definition 1, the target arm $\tilde{x}$ will be pulled $T - o(T)$ times for infinitely many different time horizons $T$ , and the following inequalities hold when arm $\tilde{x}$ is pulled by LinUCB: + +$$ +\tilde {x} ^ {\mathsf {T}} \hat {\boldsymbol {\theta}} _ {T, \parallel} + \mathrm {C B} _ {T} (\tilde {x}) > x _ {a} ^ {\mathsf {T}} \hat {\boldsymbol {\theta}} _ {T, \parallel} + x _ {a} ^ {\mathsf {T}} \hat {\boldsymbol {\theta}} _ {T, \perp} + \mathrm {C B} _ {T} (x _ {a}), \forall x _ {a} \neq \tilde {x} \tag {19} +$$ + +where $\hat{\pmb{\theta}}_t$ is LinUCB's estimated parameter at round $t$ based on the attacked rewards. We decompose $\hat{\pmb{\theta}}_T = \hat{\pmb{\theta}}_{T,\parallel} + \hat{\pmb{\theta}}_{T,\perp}$ where $\tilde{x} \perp \hat{\pmb{\theta}}_{t,\perp}$ and $\tilde{x} \parallel \hat{\pmb{\theta}}_{T,\parallel}$ . We will now show that the above inequalities lead to + +$$ +\tilde {x} ^ {\mathsf {T}} \boldsymbol {\theta} _ {\parallel} ^ {*} > x _ {a} ^ {\mathsf {T}} \boldsymbol {\theta} _ {\parallel} ^ {*} + x _ {a} ^ {\mathsf {T}} \hat {\boldsymbol {\theta}} _ {T, \perp}, \forall x _ {a} \neq \tilde {x} +$$ + +when $T\to \infty$ + +By Lemma 4 we have + +$$ +x _ {a} ^ {\top} \hat {\boldsymbol {\theta}} _ {T, \parallel} \geq x _ {a} ^ {\top} \boldsymbol {\theta} _ {\parallel} ^ {*} - \frac {C _ {T}}{T - o (T)} - \frac {\alpha_ {T}}{\sqrt {T - o (T)}} +$$ + +$$ +\tilde {x} ^ {\mathsf {T}} \hat {\boldsymbol {\theta}} _ {T, \parallel} \leq \tilde {x} ^ {\mathsf {T}} \boldsymbol {\theta} _ {\parallel} ^ {*} + \frac {C _ {T}}{T - o (T)} + \frac {\alpha_ {T}}{\sqrt {T - o (T)}} +$$ + +Substitute them back and we have that with probability at least $1 - 2\delta$ + +$$ +\tilde {x} ^ {\mathsf {T}} \boldsymbol {\theta} _ {\parallel} ^ {*} > x _ {a} ^ {\mathsf {T}} \boldsymbol {\theta} _ {\parallel} ^ {*} + x _ {a} ^ {\mathsf {T}} \hat {\boldsymbol {\theta}} _ {T, \perp} + \mathrm {C B} _ {T} (x _ {a}) - \mathrm {C B} _ {T} (\tilde {x}) - \frac {2 C _ {T}}{T - o (T)} - \frac {2 \alpha_ {T}}{\sqrt {T - o (T)}}, \forall x _ {a} \neq \tilde {x} \tag {20} +$$ + +Let us first consider the case of $x_{a} \nVdash \tilde{x}$ . Substitute Claim 1 and Claim 2 back and we have with probability at least $1 - 4\delta$ + +$$ +\begin{array}{l} \tilde {x} ^ {\mathsf {T}} \boldsymbol {\theta} _ {\parallel} ^ {*} > x _ {a} ^ {\mathsf {T}} \boldsymbol {\theta} _ {\parallel} ^ {*} + x _ {a} ^ {\mathsf {T}} \hat {\boldsymbol {\theta}} _ {T, \perp} + \Theta \left(\sqrt {\log (T / \delta)} \left(\frac {1}{\sqrt {o (T)}} - \frac {1}{\sqrt {T - o (T)}}\right)\right) \\ - O \left(\sqrt {\frac {\log (T / \delta)}{T - o (T)}}\right) - \frac {2 C _ {T}}{T - o (T)} - \frac {2 \alpha_ {T}}{\sqrt {T - o (T)}}, \forall x _ {a} \nVdash \tilde {x} \\ \end{array} +$$ + +Taking $T \to \infty$ and noticing that the last three terms diminish to 0 faster than the third term, there must exists a $T_0$ such that for any $T > T_0$ , + +$$ +\tilde {x} ^ {\mathsf {T}} \boldsymbol {\theta} _ {\parallel} ^ {*} > x _ {a} ^ {\mathsf {T}} \boldsymbol {\theta} _ {\parallel} ^ {*} + x _ {a} ^ {\mathsf {T}} \hat {\boldsymbol {\theta}} _ {T, \perp}, \forall x _ {a} \neq \tilde {x} \tag {21} +$$ + +satisfies when $x_{a}\nmid \tilde{x}$ + +Now we consider the special case that some $x_{a} \parallel \tilde{x}$ and show that the above inequality is still strict. Let $x_{a} = c\tilde{x}$ . If $|c| > 1$ , we have $\mathbf{CB}_T(x_a) - \mathbf{CB}_T(\tilde{x}) = (c - 1)\mathbf{CB}_T(\tilde{x}) > 0$ . If $|c| < 1$ , since $\tilde{x}$ is pulled linear times for any large $t$ with sublinear cost, then $\tilde{x}^{\mathsf{T}}\hat{\theta}_{t,\parallel} > 0$ ; otherwise the cost would be linear. We directly have $\tilde{x}^{\mathsf{T}}\hat{\theta}_{t,\parallel} = x_{a}^{\mathsf{T}}\hat{\theta}_{t,\parallel} + (1 - c)\tilde{x}^{\mathsf{T}}\hat{\theta}_{t,\parallel} > x_{a}^{\mathsf{T}}\hat{\theta}_{t,\parallel}$ . This leads to $\tilde{x}^{\mathsf{T}}\theta_{\parallel}^{*} > x_{a}^{\mathsf{T}}\theta_{\parallel}^{*}$ (inequality (21)) since $x_{a} \perp \hat{\theta}_{T,\perp}$ . + +Combining the two cases, we know there must exist a $\hat{\pmb{\theta}}_{T,\perp}$ that satisfies inequality (21) (the first constraint of CQP (2)), $\tilde{x} \perp \hat{\pmb{\theta}}_{T,\perp}$ (the second constraint of CQP (2)), and makes the objective of CQP (2) larger than 0. To satisfy the last constraint, we consider LinUCB with the choice of L2-regularization parameter $\lambda$ that guarantees $\| \hat{\pmb{\theta}}_t\| _2 < 1$ given the data for large enough $T$ and any $t < T$ . Note that ridge regression is equivalent to minimizing square loss under some constraint $\| \hat{\pmb{\theta}}_t\| _2 \leq c$ , and there always exists a one-to-one correspondence between $\lambda$ and $c$ (one simple way to show the correspondence is using KKT conditions). Therefore, we are guaranteed to find a $\lambda$ that gives us $c = 1 - \zeta$ where $\zeta$ is an arbitrarily small constant. Then we know that $\hat{\pmb{\theta}}_{T,\perp}$ satisfies $\| \hat{\pmb{\theta}}_T = \hat{\pmb{\theta}}_{T,\parallel} + \hat{\pmb{\theta}}_{T,\perp}\| _2 \leq c < 1$ . We prove the last constraint $\| \tilde{\pmb{\theta}} = \pmb{\theta}_{\parallel}^{*} + \hat{\pmb{\theta}}_{T,\perp}\| _2 \leq 1$ by the fact that $\| \hat{\pmb{\theta}}_{T,\parallel} + \hat{\pmb{\theta}}_{T,\perp}\| _2 < 1$ and $\| \pmb{\theta}_{\parallel}^{*} - \hat{\pmb{\theta}}_{T,\parallel}\| _2$ is arbitrarily small for large enough $T$ according to Lemma 4. + +Now we proved that there exists a $\hat{\theta}_{T,\perp}$ that satisfies all the constraints in CQP (2) with positive objective, which means the optimal objective $\epsilon^{*}$ must also be positive. This however contradicts our assumption $\epsilon^{*} \leq 0$ , implying that such LinUCB is not attackable by any attack strategy. + +# C. Details on Effective Attacks Without Knowledge of Model Parameters + +We now prove the theorems of using Two-stage Null Space Attack (Algorithm 1) against LinUCB and Robust Phase Elimination. + +# C.1. Proof of Theorem 3 + +Proof of Theorem 3. We first prove that for a large enough $T$ , Algorithm 1 will correctly assert the attackability with probability at least $1 - \delta$ . We rely on the following lemma to show $\tilde{\theta}_{\parallel}$ estimated in step 11 of Algorithm 1 is close to the true parameter $\theta_{\parallel}^{*}$ . + +Lemma 5 (Estimation error of $\tilde{\pmb{\theta}}_{\parallel}$ ). Algorithm 1 estimates $\pmb{\theta}_{\parallel}^{*}$ by + +$$ +\tilde {\boldsymbol {\theta}} _ {\parallel} = \frac {\sum_ {i = 1} ^ {n (\tilde {x})} r _ {i} (\tilde {x})}{n (\tilde {x}) \| \tilde {x} \| _ {2} ^ {2}} \tilde {x}. \tag {22} +$$ + +With probability at least $1 - \delta$ , the estimation error is bounded by + +$$ +\left\| \tilde {\boldsymbol {\theta}} _ {\parallel} - \boldsymbol {\theta} _ {\parallel} ^ {*} \right\| _ {2} \leq \sqrt {\frac {2 R ^ {2} \log (1 / \delta)}{n}} \tag {23} +$$ + +where the rewards have $R$ -sub-Gaussian noise. + +Proof. $\pmb{\theta}_{\parallel}^{*}$ is the projected vector of $\pmb{\theta}^{*}$ onto $\tilde{x}$ , which is + +$$ +\boldsymbol {\theta} _ {\parallel} ^ {*} = \frac {\tilde {\boldsymbol {x}} ^ {\mathsf {T}} \boldsymbol {\theta} ^ {*}}{\| \tilde {\boldsymbol {x}} \| _ {2} ^ {2}} \tilde {\boldsymbol {x}} +$$ + +as defined in Eq (1). Though we need to estimate the vector $\tilde{\theta}_{\parallel} \in \mathbb{R}^d$ , we actually only need to estimate the scale of it by $\hat{l} = \frac{\sum_{i=1}^{n(\tilde{x})} r_i(\tilde{x})}{n(\tilde{x})\|\tilde{x}\|_2^2}$ , since the direction is known to be $\tilde{x}$ . Based on Hoeffding's inequality, the estimation error of averaged rewards on $\tilde{x}$ is bounded by + +$$ +P \left(\left| \frac {\sum_ {i = 1} ^ {n (\tilde {x})} r _ {i} (\tilde {x})}{n (\tilde {x})} - r ^ {*} (\tilde {x}) \right| \geq \sqrt {\frac {2 R ^ {2} \log (1 / \delta)}{n (\tilde {x})}}\right) \leq \delta \tag {24} +$$ + +where $r^* (\tilde{x}) = \tilde{x}^\top \pmb{\theta}^*$ . Considering $\| \tilde{x}\| _2^2 = 1$ and we finish the proof. + +In the first stage, the bandit algorithm will pull the target arm $\tilde{x}$ for $T_{1} - O(\sqrt{T_{1}})$ times, since $\tilde{x}$ is the best arm according to $\theta_{0}$ . According to Lemma 5, with probability at least $1 - \delta$ the estimation error is bounded as + +$$ +\left\| \tilde {\boldsymbol {\theta}} _ {\parallel} - \boldsymbol {\theta} _ {\parallel} ^ {*} \right\| _ {2} \leq \sqrt {\frac {2 R ^ {2} \log (1 / \delta)}{T _ {1} - O (\sqrt {T _ {1}})}}. +$$ + +As a result, with a large enough $T_{1}$ , the error of $\tilde{x}$ 's reward estimation satisfies + +$$ +| \tilde {x} ^ {\mathsf {T}} \tilde {\boldsymbol {\theta}} _ {\parallel} - \tilde {x} ^ {\mathsf {T}} \boldsymbol {\theta} _ {\parallel} ^ {*} | \leq \| \tilde {x} \| _ {2} \| \tilde {\boldsymbol {\theta}} _ {\parallel} - \boldsymbol {\theta} _ {\parallel} ^ {*} \| _ {2} \leq \sqrt {\frac {2 R ^ {2} \log (1 / \delta)}{T _ {1} - O (\sqrt {T _ {1}})}} \leq \epsilon^ {*}. +$$ + +Thus solving CQP (2) with $\tilde{\theta}_{\parallel}$ replacing $\pmb{\theta}_{\parallel}^{*}$ and we could correctly assert attackability with an estimated positive index $\tilde{\epsilon}^*$ when the environment is attackable with index $\epsilon^{*}$ . + +Remark 3. From the analysis above, we notice that the adversary requires sufficiently large $T_{1}$ to collect enough rewards on the target arm, in order to make the correct attackability assertion. When $T_{1}$ is not large enough, the attackability test may have false positive or false negative conclusions. We empirically test the error rate and report the results in Additional Experiments section. + +We now prove the success and total cost of the proposed attack. The analysis relies on the "robustness" property of LinUCB stated in Lemma 1, which is restated and proved below. + +Lemma 6 (Robustness of ridge regression). Consider LinUCB with ridge regression under poisoning attack. Let $S_{t}^{\prime} = \sum_{\tau \in \{1\dots t\}, x_{a_{\tau}} \neq \tilde{x}} |\Delta_{\tau}|$ be the total corruption on non-target arms until time $t$ and assume every corruption on target arm is bounded by $\gamma$ . Then for any $t = 1 \dots T$ , with probability at least $1 - \delta$ we have + +$$ +\left\| \tilde {\boldsymbol {\theta}} - \hat {\boldsymbol {\theta}} _ {t} \right\| _ {A _ {t}} \leq \alpha_ {t} + S _ {t} ^ {\prime} / \sqrt {\lambda} + \gamma \sqrt {t} \tag {25} +$$ + +where $\alpha_{t} = \sqrt{d\log\left(\frac{1 + t / \lambda}{\delta}\right)} +\sqrt{\lambda}.$ + +Proof. Based on the closed form solution of ridge regression, we have + +$$ +\hat {\pmb {\theta}} _ {t} = \tilde {\pmb {\theta}} - \lambda \mathbf {A} _ {t} ^ {- 1} \tilde {\pmb {\theta}} + \mathbf {A} _ {t} ^ {- 1} \sum_ {\tau = 1} ^ {t} x _ {a _ {\tau}} [ \eta_ {\tau} + \Delta_ {\tau} ] +$$ + +Therefore, using ideas from (Abbasi-yadkori et al., 2011), we can have + +$$ +\begin{array}{l} \| \hat {\boldsymbol {\theta}} _ {t} - \tilde {\boldsymbol {\theta}} \| _ {\mathbf {A} _ {t}} \leq \lambda^ {1 / 2} \| \boldsymbol {\theta} ^ {*} \| _ {2} + \left\| \sum_ {\tau = 1} ^ {t} x _ {a _ {\tau}} \eta_ {\tau} \right\| _ {\mathbf {A} _ {t} ^ {- 1}} + \left\| \sum_ {\tau = 1} ^ {t} x _ {a _ {\tau}} \Delta_ {\tau} \right\| _ {\mathbf {A} _ {t} ^ {- 1}} \\ \leq \alpha_ {t} + \left\| \sum_ {\tau = 1} ^ {t} x _ {a _ {\tau}} \Delta_ {\tau} \right\| _ {\mathbf {A} _ {t} ^ {- 1}} \\ \leq \alpha_ {t} + \| \sum_ {\tau \in \{1 \dots t \}, x _ {a _ {\tau}} \neq \tilde {x}} x _ {a _ {\tau}} \Delta_ {\tau} \| _ {\mathbf {A} _ {t} ^ {- 1}} + \| \sum_ {\tau \in \{1 \dots t \}, x _ {a _ {\tau}} = \tilde {x}} x _ {a _ {\tau}} \Delta_ {\tau} \| _ {\mathbf {A} _ {t} ^ {- 1}} \\ \leq \alpha_ {t} + \| \sum_ {\tau \in \{1 \dots t \}, x _ {a _ {\tau}} \neq \tilde {x}} x _ {a _ {\tau}} \Delta_ {\tau} \| _ {\mathbf {A} _ {t} ^ {- 1}} + \| \gamma n (\tilde {x}) \tilde {x} \| _ {\mathbf {A} _ {t} ^ {- 1}} \\ \leq \alpha_ {t} + \| \sum_ {\tau \in \{1 \dots t \}, x _ {a _ {\tau}} \neq \tilde {x}} x _ {a _ {\tau}} \Delta_ {\tau} \| _ {2} / \sqrt {\lambda} + \| \gamma n (\tilde {x}) \tilde {x} \| _ {\mathbf {A} _ {t} ^ {- 1}} \\ \leq \alpha_ {t} + S _ {t} ^ {\prime} / \sqrt {\lambda} + \| \gamma n (\tilde {x}) \tilde {x} \| _ {\mathbf {A} _ {t} ^ {- 1}} \\ \leq \alpha_ {t} + S _ {t} ^ {\prime} / \sqrt {\lambda} + \frac {\gamma n (\tilde {x})}{\sqrt {n (\tilde {x})}} \\ \leq \alpha_ {t} + S _ {t} ^ {\prime} / \sqrt {\lambda} + \gamma \sqrt {t} \\ \end{array} +$$ + +with probability at least $1 - \delta$ , where $n(\tilde{x})$ is the times target arm has been pulled. The second step is based on the definition of $\alpha_{t}$ and introduces the high probability bound, the fourth step is because we have $|\Delta_{\tau}| < \gamma$ if $x_{a_{\tau}} = \tilde{x}$ ; the fifth step is because of $\mathbf{A}_t\succeq \lambda \mathbf{I}$ ; and the second last inequality follows Eq (8). Finally, notice that $n(\tilde{x})\leq t$ and we finish the proof. + +Let us first analyze the attack in the first stage. Denote $R_{T}(\theta)$ as the regret of LinUCB until round $T$ , where $\theta$ is the ground-truth parameter. We know from (Abbasi-yadkori et al., 2011) that if the rewards are all generated by $\theta$ then with probability at least $1 - \delta$ we have + +$$ +R _ {T} (\boldsymbol {\theta}) = \alpha_ {T} \sqrt {d T \log \left(\frac {1 + T / \lambda}{\delta}\right)} = O (d \sqrt {T} \log (T / \delta)) \tag {26} +$$ + +where $\alpha_{t} = \sqrt{d\log\left(\frac{1 + t / \lambda}{\delta}\right)} +\sqrt{\lambda}$ . Then the attack in the first $T_{1}$ rounds based on $\theta_0$ should make the bandit algorithm pull $\tilde{x}$ at least $T_{1} - R_{T_{1}}(\pmb{\theta}_{0}) / \epsilon_{0}^{*}$ times. According to Lemma 5, with probability at least $1 - \delta$ parameter estimation error is bounded by + +$$ +\left\| \tilde {\boldsymbol {\theta}} _ {\parallel , T _ {1}} - \boldsymbol {\theta} _ {\parallel} ^ {*} \right\| _ {2} \leq \sqrt {2 \log (1 / \delta)} / \sqrt {T _ {1} - R _ {T _ {1}} \left(\boldsymbol {\theta} _ {0}\right) / \epsilon_ {0} ^ {*}} \leq 2 \sqrt {2 \log (1 / \delta)} / \sqrt {T _ {1}} \tag {27} +$$ + +for large enough $T_{1}$ . This means we have + +$$ +\gamma = \left\| \tilde {x} ^ {\mathsf {T}} \left(\tilde {\boldsymbol {\theta}} _ {\parallel , T _ {1}} - \boldsymbol {\theta} _ {\parallel} ^ {*}\right) \right\| \leq 2 \sqrt {2 \log (1 / \delta)} / \sqrt {T _ {1}} \tag {28} +$$ + +Now we prove the attack is successful with high probability. Consider the regret of the LinUCB against $\tilde{\theta}$ as the ground-truth parameter. The estimation error in $\hat{\theta}_t - \tilde{\theta}$ has three sources: the sub-Gaussian noise, the rewards on non-target arms in the first stage generated by $\theta_0$ (the rewards on the target arm are corrected to $\tilde{\theta}$ in step 19-20 in Algorithm 1), and the unattacked rewards on target arm in the second stage generated by $\theta^*$ . According to Lemma 1, with probability at least $1 - 3\delta$ , we have + +$$ +\left\| \hat {\boldsymbol {\theta}} _ {t} - \tilde {\boldsymbol {\theta}} \right\| _ {\mathbf {A} _ {t}} \leq \alpha_ {t} + R _ {T _ {1}} (\boldsymbol {\theta} _ {0}) / \sqrt {\lambda} + 2 \sqrt {2 t \log (1 / \delta)} / \sqrt {T _ {1}}, t > T _ {1}. +$$ + +To show the number of rounds pulling non-target arms, we first look at the regret against $\tilde{\theta}$ , i.e., $R_{T}(\tilde{\theta})$ . + +$$ +\begin{array}{l} R _ {T} (\tilde {\boldsymbol {\theta}}) \leq \sum_ {t = 1} ^ {T} \left(\tilde {x} ^ {\mathsf {T}} \tilde {\boldsymbol {\theta}} - x _ {a _ {t}} ^ {\mathsf {T}} \tilde {\boldsymbol {\theta}}\right) \\ \leq \sum_ {t = 1} ^ {T} \left(\tilde {\boldsymbol {x}} ^ {\mathsf {T}} \hat {\boldsymbol {\theta}} _ {t} + \mathbf {C B} _ {t} (\tilde {\boldsymbol {x}}) - x _ {a _ {t}} ^ {\mathsf {T}} \tilde {\boldsymbol {\theta}}\right) \\ \leq \sum_ {t = 1} ^ {T} \left(x _ {a _ {t}} ^ {\mathsf {T}} \hat {\boldsymbol {\theta}} _ {t} + \mathbf {C B} _ {t} \left(x _ {a _ {t}}\right) - x _ {a _ {t}} ^ {\mathsf {T}} \tilde {\boldsymbol {\theta}}\right) \\ \leq \sum_ {t = 1} ^ {T} 2 \mathrm {C B} _ {t} \left(x _ {a _ {t}}\right) \\ \leq 2 \sqrt {T \sum_ {t = 1} ^ {T} \mathrm {C B} _ {t} ^ {2} \left(x _ {a _ {t}}\right)} \\ \leq 2 \| \hat {\boldsymbol {\theta}} _ {T} - \tilde {\boldsymbol {\theta}} \| _ {\mathbf {A} _ {T}} \sqrt {T \sum_ {t = 1} ^ {T} \| x \| _ {\mathbf {A} _ {t} ^ {- 1}} ^ {2}} \\ \leq 2 \left(\alpha_ {T} + R _ {T _ {1}} (\boldsymbol {\theta} _ {0}) / \sqrt {\lambda} + 2 \sqrt {2 T \log (1 / \delta)} / \sqrt {T _ {1}}\right) \sqrt {d T \log \left(\frac {1 + T / \lambda}{\delta}\right)} \\ \end{array} +$$ + +holds with probability at least $1 - 3\delta$ . And LinUCB will pull non-target arms at most $R_{T}(\tilde{\boldsymbol{\theta}}) / \epsilon^{*}$ times, which can be bounded by + +$$ +\begin{array}{l} R _ {T} (\tilde {\boldsymbol {\theta}}) / \epsilon^ {*} \leq 2 \left(\alpha_ {T} + R _ {T _ {1}} (\boldsymbol {\theta} _ {0}) / \sqrt {\lambda} + 2 \sqrt {2 T \log (1 / \delta)} / \sqrt {T _ {1}}\right) \sqrt {d T \log \left(\frac {1 + T / \lambda}{\delta}\right)} / \epsilon^ {*} \\ \leq 2 \left(\sqrt {d T \log \left(\frac {1 + T / \lambda}{\delta}\right)} + \sqrt {\lambda} + R _ {T _ {1}} (\boldsymbol {\theta} _ {0}) / \sqrt {\lambda} + 2 \sqrt {2 T \log (1 / \delta)} / \sqrt {T _ {1}}\right) \sqrt {d T \log \left(\frac {1 + T / \lambda}{\delta}\right)} / \epsilon^ {*} \\ \end{array} +$$ + +and is in the order of + +$$ +O \left(d \left(\sqrt {\log (T / \delta)} + \sqrt {T _ {1}} \log \left(T _ {1} / \delta\right) + \sqrt {T \log (1 / \delta)} / \sqrt {T _ {1}}\right) \sqrt {T \log (T / \delta)} / \epsilon^ {*}\right) \tag {29} +$$ + +The $\sqrt{T_1}\log (T_1 / \delta)$ term is due to the "corrupted" rewards of non-target arms observed in the first stage. Setting $T_{1} = T^{1 / 2}$ gives us the minimum number of rounds pulling non-target arms in $\tilde{O} (T^{3 / 4})$ according to Eq (29). + +Now we prove the total cost $C(T)$ . Note that in order to make the attack "stealthy", we inject sub-Gaussian noise $\tilde{\eta}_t$ on perturbed reward to make it stochastic. We separate the total cost by the cost on changing the mean reward and the cost of sub-Gaussian noise as + +$$ +C (T) = \sum_ {t = \{1.. T \}, \tilde {r} _ {t} \neq r _ {t}} | \Delta r _ {t} | \leq \sum_ {i = 1} ^ {N} \left| x _ {a _ {i}} ^ {\mathsf {T}} \left(\tilde {\boldsymbol {\theta}} - \boldsymbol {\theta} ^ {*}\right) \right| + \sum_ {i = 1} ^ {N} | \tilde {\eta} _ {i} | \tag {30} +$$ + +where $i \in \{t = \{1..T\} : \tilde{r}_t \neq r_t\}$ . Let $N = |\{i\}|$ be the total rounds of attack. Since we know the times attacking non-target arms is bounded by Eq 29 and attack target arm at most $T_1$ times, we have with probability $1 - \delta$ , + +$$ +N = T _ {1} + O \left(d \left(\sqrt {\log (T / \delta)} + \sqrt {T _ {1}} \log \left(T _ {1} / \delta\right) + \sqrt {T \log (1 / \delta)} / \sqrt {T _ {1}}\right) \sqrt {T \log (T / \delta)} / \epsilon^ {*}\right) = \tilde {O} \left(T ^ {3 / 4}\right) \tag {31} +$$ + +when setting $T_{1} = T^{1 / 2}$ . + +Notice that since $\tilde{\eta}_t$ is $R$ -sub-Gaussian, its absolute value $|\tilde{\eta}_t|$ is also $R$ -sub-Gaussian, and $\mathbb{E}[|\tilde{\eta}_t|] < L$ for some constant $L$ following Proposition 2.5.2 in (Vershynin, 2018). According to the general Hoeffding's inequality, with probability at least $1 - \delta$ , + +$$ +\sum_ {i = 1} ^ {N} \left| \tilde {\eta} _ {i} \right| \leq N L + \sqrt {N L \log (2 / \delta)} = O \left(N + \sqrt {N \log (1 / \delta)}\right) \tag {32} +$$ + +Thus the second term of Eq (30) has the order of $O(N) = \tilde{O}(T^{3/4})$ . The first term of Eq (30) is bounded by $2N + 2T_1$ because each attack changes the mean reward at most 2 except the compensation step in line 20, and the reward compensation on target arm can be bounded by $2T_1$ because target arm is pulled at most $T_1$ times in the first stage. Overall, with probability at least $1 - 4\delta$ + +$$ +C (T) \leq \sum_ {i = 1} ^ {N} \left| x _ {a _ {i}} ^ {\mathrm {T}} \left(\tilde {\boldsymbol {\theta}} - \boldsymbol {\theta} ^ {*}\right) \right| + \sum_ {i = 1} ^ {N} \left| \tilde {\eta} _ {i} \right| \leq 2 N + 2 T _ {1} + N L + \sqrt {N L \log (2 / \delta)} = \tilde {O} (N) = \tilde {O} \left(T ^ {3 / 4}\right) \tag {33} +$$ + +when setting $T_{1} = T^{1 / 2}$ . + +# C.2. Proof Sketch of Corollary 4 + +The proof is similar to the proof of Theorem 3, and thus we only explain the difference here. + +Instead of using Lemma 1 to analyze the impact of perturbed rewards generated by $\theta_0$ (against $\tilde{\pmb{\theta}}$ ) collected in the first stage, we know RobustPhE has an additional regret term $O(S^2)$ for corruption $S$ (assuming $S$ is unknown to the bandit algorithm). Since the bandit algorithm observes $T_{1}$ rewards in the first stage, $S \leq 2T_{1}$ and the additional regret due to rewards from first stage is $\tilde{O}(T_{1}^{2})$ . For the unattacked rewards on target arm in the second stage generated by $\pmb{\theta}^{*}$ , we view them as rewards generated by $\tilde{\pmb{\theta}}$ with misspecification error $\gamma$ , i.e., $|\tilde{x}^{\mathsf{T}}(\pmb{\theta}^{*} - \tilde{\pmb{\theta}})| \leq \gamma$ . Proposition 5.1 in (Lattimore et al., 2020) showed that the phase elimination algorithm with misspecification $\gamma$ has additional regret in $O(\gamma \sqrt{dT}\log(T))$ . With $\gamma \leq 2\sqrt{2\log(1/\delta)}/\sqrt{T_{1}}$ by Eq (28), the total regret is + +$$ +R _ {T} (\tilde {\boldsymbol {\theta}}) = O \Big (d \sqrt {T} \log (T / \delta) + \sqrt {d} T \log (T) \log (1 / \delta) / \sqrt {T _ {1}} + T _ {1} ^ {2} \Big) +$$ + +with probability at least $1 - 2\delta$ . Therefore, we have with probability at least $1 - 2\delta$ , the attack strategy will fool RobustPhE to pull non-target arms at most $O\left((d\sqrt{T}\log (T / \delta) + \sqrt{dT}\log (T)\log (1 / \delta) / \sqrt{T_1} + T_1^2) / \epsilon^*\right)$ rounds. + +Similar to Eq (31), we bound the total rounds of attacking RobustPhE by + +$$ +N = T _ {1} + O \left(\left(d \sqrt {T} \log (T / \delta) + \sqrt {d} T \log (T) \log (1 / \delta) / \sqrt {T _ {1}} + T _ {1} ^ {2}\right) / \epsilon^ {*}\right) \tag {34} +$$ + +From Eq (33), we know the total cost is in the same order as the rounds of attack. So with probability at least $1 - 3\delta$ the total cost is + +$$ +O \Big (T _ {1} + (d \sqrt {T} \log (T / \delta) + \sqrt {d} T \log (T) \log (1 / \delta) / \sqrt {T _ {1}} + T _ {1} ^ {2}) / \epsilon^ {*} \Big). +$$ + +Setting $T_{1} = T^{2 / 5}$ gives us the minimum attack cost $\tilde{O}(T^{4 / 5})$ , and the non-target arms are pulled at most $\tilde{O}(T^{4 / 5})$ rounds. + +Remark 4. Note that we bound the total corruption by $T_{1}$ , which means the adversary does not need to compensate the rewards on the target arm as shown in line 20 in Algorithm 1. The robustness of RobustPhE allows us to carry over the rewards in the first stage while LinUCB does not. + +# C.3. Attack under unknown $T$ + +Our two-stage null space attack algorithm requires that $T$ is known for the convenience of analysis. Here we discuss a promising idea that leveraging the doubling trick to extend the attack to the case of unknown $T$ , which will lead to a multi-stage attack that repeatedly adjusts the target parameter $\tilde{\theta}$ at each stage. More concretely, to attack LinUCB without knowing $T$ , the adversary can start with a pre-specified horizon $T_0$ and run the two-stage attack. Once the actual horizon reaches $T_0$ , the adversary will expand the horizon to $T_0^2$ (i.e., the "doubling" trick), and views previous $T_0$ rounds as the + +new first stage, re-calculates target parameter $\tilde{\theta}$ using rewards from the $T_{0}$ rounds and runs the new attack strategy until $T_{0}^{2}$ . Using this exponential horizon sequence $\{T_{i} = T_{0}^{2^{i}}, i \in \mathbb{N}\}$ , we have a multi-stage attack on LinUCB with unknown time horizon. Similarly, to attack RobustPhE, we will need to adjust the horizon sequence to be $\{T_{i} = T_{0}^{(5/2)^{i}}, i \in \mathbb{N}\}$ , which will lead to a similar multi-stage attack on RobustPhE. We believe this direction is feasible based on our current analysis, and more thorough and complete proof should be the target of our next work. + +# D. Additional Experiments + +![](images/837268a131ff295831acfb770be2c2104ff551644dd5717a9aae5a68330672e8.jpg) +Figure 4. False negative rate of attackability test + +In Figure 4, we study the false negative rate of the attackability test in Algorithm 1, i.e., how often the adversary mistakenly asserts that an attackable environment is not attackable. As we explained in Proof of Theorem 1, the wrong assertion is because of using estimated $\tilde{\theta}_{\parallel}$ instead of the ground-truth bandit parameter. In this experiment, we consider a challenging attackable three-arm environment with $\mathcal{A} = \{x_1 = (0,1), x_2 = (0.11,1.1), x_3 = (-2,0)\}$ , $\tilde{x} = x_1$ and $\pmb{\theta}^{*} = (0,0.5)$ . By solving CQP (2), we have attackability index $\epsilon^{*} = 0.005$ and certificate $\tilde{\theta}_{\perp} = (-0.5,0)^5$ . We test two-stage null space attack against LinUCB with $T = 10,000$ and the adversary will test the attackability after the first $T_{1} = T^{1 / 2} = 100$ rounds. We vary $T_{1}$ from 1 to 100 to see how many iterations is sufficient for attackability test. We report averaged results of 100 runs. We also vary the standard derivation $\sigma$ of Gaussian noise from 0.1 to 0.3. In Figure 4, we can see that the false negative rate is almost zero when $T_{1} > 50$ , suggesting $T_{1} = 100$ is sufficient. When $\sigma = 0.1$ the adversary only needs around 10 rounds to make a correct assertion. We also notice the false negative rate becomes higher under a larger noise scale. As suggested in Lemma 5, the error in $\tilde{\theta}_{\parallel}$ estimation is larger if noise scale is larger or the number of target arm's rewards $n(\tilde{x})$ is smaller, which highly depends on $T_{1}$ . Larger error means CQP (2) with $\tilde{\theta}_{\parallel}$ is more likely to be unfeasible and gives false negative assertion. However, $T_{1} = 100$ is still enough for the attackability test when $\epsilon^{*} = 0.005$ . \ No newline at end of file diff --git a/whenarelinearstochasticbanditsattackable/images.zip b/whenarelinearstochasticbanditsattackable/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..98211484c377ab9d1b093c02431c5ee6f8c7acd9 --- /dev/null +++ b/whenarelinearstochasticbanditsattackable/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6fb14af463127dfdfc3f11cd5f10eef8ed7b6f0b686649123f42ea9a33e2e626 +size 588521 diff --git a/whenarelinearstochasticbanditsattackable/layout.json b/whenarelinearstochasticbanditsattackable/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..98f678e3a1ccb39c1c170af049bdb00a1ea4da6e --- /dev/null +++ b/whenarelinearstochasticbanditsattackable/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c3bfcf0ce5dfe352dd55f4c76d7ce55843b6b860d12cf6bcafd51833f6599567 +size 1092062 diff --git a/whenaucmeetsdrooptimizingpartialaucfordeeplearningwithnonconvexconvergenceguarantee/8b19e93b-3825-4106-a2c9-9708f68b7e71_content_list.json b/whenaucmeetsdrooptimizingpartialaucfordeeplearningwithnonconvexconvergenceguarantee/8b19e93b-3825-4106-a2c9-9708f68b7e71_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..3c5d200e8dffb133f829c27d21b1da97c27640c5 --- /dev/null +++ b/whenaucmeetsdrooptimizingpartialaucfordeeplearningwithnonconvexconvergenceguarantee/8b19e93b-3825-4106-a2c9-9708f68b7e71_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2602812a9b1217249ce16c9e37f8418ab7a016934c39d4df27409ee9f1aed6ff +size 235924 diff --git a/whenaucmeetsdrooptimizingpartialaucfordeeplearningwithnonconvexconvergenceguarantee/8b19e93b-3825-4106-a2c9-9708f68b7e71_model.json b/whenaucmeetsdrooptimizingpartialaucfordeeplearningwithnonconvexconvergenceguarantee/8b19e93b-3825-4106-a2c9-9708f68b7e71_model.json new file mode 100644 index 0000000000000000000000000000000000000000..75725f460081531d57fcacb7efc96270147d7436 --- /dev/null +++ b/whenaucmeetsdrooptimizingpartialaucfordeeplearningwithnonconvexconvergenceguarantee/8b19e93b-3825-4106-a2c9-9708f68b7e71_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fa5ca00fd6512dde5315dd8b3f655263bf1443aadee5e51c4ecdd5f2a83715d0 +size 267889 diff --git a/whenaucmeetsdrooptimizingpartialaucfordeeplearningwithnonconvexconvergenceguarantee/8b19e93b-3825-4106-a2c9-9708f68b7e71_origin.pdf b/whenaucmeetsdrooptimizingpartialaucfordeeplearningwithnonconvexconvergenceguarantee/8b19e93b-3825-4106-a2c9-9708f68b7e71_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b48b890889c880922333b2d07a75fe8a8d9fcb61 --- /dev/null +++ b/whenaucmeetsdrooptimizingpartialaucfordeeplearningwithnonconvexconvergenceguarantee/8b19e93b-3825-4106-a2c9-9708f68b7e71_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:88d30a3725d6717be4a348f74ee775bb1f935ffa93d654608f3e6c770d283789 +size 1286915 diff --git a/whenaucmeetsdrooptimizingpartialaucfordeeplearningwithnonconvexconvergenceguarantee/full.md b/whenaucmeetsdrooptimizingpartialaucfordeeplearningwithnonconvexconvergenceguarantee/full.md new file mode 100644 index 0000000000000000000000000000000000000000..73ec2ae4f81db3fe7c870736a01924e6ca592e7b --- /dev/null +++ b/whenaucmeetsdrooptimizingpartialaucfordeeplearningwithnonconvexconvergenceguarantee/full.md @@ -0,0 +1,1070 @@ +# When AUC meets DRO: Optimizing Partial AUC for Deep Learning with Non-Convex Convergence Guarantee + +Dixian Zhu\*1 Gang Li\*1 Bokun Wang 1 Xiaodong Wu 2 Tianbao Yang + +# Abstract + +In this paper, we propose systematic and efficient gradient-based methods for both one-way and two-way partial AUC (pAUC) maximization that are applicable to deep learning. We propose new formulations of pAUC surrogate objectives by using the distributionally robust optimization (DRO) to define the loss for each individual positive data. We consider two formulations of DRO, one of which is based on conditional-value-at-risk (CVaR) that yields a non-smooth but exact estimator for pAUC, and another one is based on a KL divergence regularized DRO that yields an inexact but smooth (soft) estimator for pAUC. For both one-way and two-way pAUC maximization, we propose two algorithms and prove their convergence for optimizing their two formulations, respectively. Experiments demonstrate the effectiveness of the proposed algorithms for pAUC maximization for deep learning on various datasets. The proposed methods are implemented with tutorials in our open-sourced library LibAUC (www.libauc.org). + +# 1. Introduction + +AUC, short for the area under the ROC curve, is a performance measure of a model, where the ROC curve is a curve of true positive rate (TPR) vs false positive rate (FPR) for all possible thresholds. AUC maximization in machine learning has a long history dating back to early 2000s (Herbrich et al., 1999). It has four ages in the twenty-years history, full-batch based methods in the first age, online methods in the second age, stochastic methods in the third age, and deep learning methods in the recent age. The first three + +*Equal contribution ${}^{1}$ Department of Computer Science,University of Iowa,Iowa City,Iowa,USA ${}^{2}$ Department of Electrical and Computer Engineering,University of Iowa,Iowa City,Iowa,USA. Correspondence to: Tianbao Yang . + +Proceedings of the $39^{th}$ International Conference on Machine Learning, Baltimore, Maryland, USA, PMLR 162, 2022. Copyright 2022 by the author(s). + +ages focus on learning linear models or kernelized models. In each age, there have been seminal works in rigorous optimization algorithms that play important roles in the evolution of AUC maximization methods. Recent advances in non-convex optimization (in particular non-convex min-max optimization) (Liu et al., 2020) has driven large-scale deep AUC maximization to succeed in real-world tasks, e.g., medical image classification (Yuan et al., 2020) and molecular properties prediction (Wang et al., 2021). + +Nevertheless, the research on efficient optimization algorithms for partial AUC (pAUC) lag behind. In many applications, there are large monetary costs due to high false positive rates (FPR) and low true positive rates (TPR), e.g., in medical diagnosis. Hence, a measure of primary interest is the region of the curve corresponding to low FPR and/or high TPR, i.e., pAUC. There are two commonly used versions of pAUC, namely one-way pAUC (OPAUC) (Dodd & Pepe, 2003) and two-way pAUC (TPAUC) (Yang et al., 2019), where OPAUC puts a restriction on the range of FPR, i.e., $\mathrm{FPR} \in [\alpha, \beta]$ (Figure 1 middle) and TPAUC puts a restriction on the lower bound of TPR and the upper bound of FPR, i.e., $\mathrm{TPR} \geq \alpha$ , $\mathrm{FPR} \leq \beta$ (Figure 1 right). Compared with standard AUC maximization, pAUC maximization is more challenging since its estimator based on training examples involves selection of examples whose prediction scores are in certain ranks. + +To the best of our knowledge, there are few rigorous and efficient algorithms developed for pAUC maximization for deep learning. Some earlier works have focused on pAUC maximization for learning linear models. For example, Narasimhan & Agarwal (2017) have proposed a structured SVM approach for one-way pAUC maximization, which is guaranteed to converge for optimizing the surrogate objective of pAUC. However, their approach is not efficient for big data and is not applicable to deep learning, which needs to evaluate the prediction scores of all examples and sort them at each iteration. There are some heuristic approaches, e.g., updating the model parameters according to the gradient of surrogate pAUC computed based on a mini-batch data (Kar et al., 2014) or using an ad-hoc weighting function for each example for computing the stochastic gradient (Yang et al., 2021). However, such approaches are + +![](images/989dc5064a47a47bf71508ba009ff6ae1b9e56d24420364d4a7aa53afbf291f6.jpg) +Figure 1. From left to right: AUC, one-way pAUC, two-way pAUC + +either not guaranteed to converge or could suffer a large approximation error. + +In this paper, we propose more systematic and rigorous optimization algorithms for pAUC maximization with convergence guarantee, which are applicable to deep learning. We consider both OPAUC maximization and TPAUC maximization, where for OPAUC we focus on maximizing pAUC in the region where FPR $\in [0,\beta ]$ and for TPAUC we focus on maximizing pAUC in the region where FPR $\leq \beta$ and TPR $\geq \alpha$ for some $\alpha ,\beta \in (0,1)$ . In order to tackle the challenge of computing unbiased stochastic gradients of the surrogate objective of pAUC, we propose new formulations based on distributionally robust optimization (DRO), which allows us to formulate the problem into weakly convex optimization, and novel compositional optimization problems, and to develop efficient stochastic algorithms with convergence guarantee. We summarize our contributions below. + +- For OPAUC maximization, for each positive example, we define a loss over all negative examples based on DRO. We consider two special formulations of DRO, with one based on the conditional-value-at-risk (CVaR) function that yields an exact estimator of the surrogate objective of OPAUC, and another one based on Kullback-Leibler (KL) divergence regularized DRO that yields a soft estimator of the surrogate objective. +- We propose efficient stochastic algorithms for optimizing both formulations of OPAUC and establish their convergence guarantee and complexities for finding a (nearly) stationary solution. We also demonstrate that the algorithm for optimizing the soft estimator based on the KL divergence regularized DRO can enjoy parallel speed-up. +- For TPAUC maximization, we apply another level of DRO with respect to the positive examples on top of OPAUC formulations, yielding both exact and soft estimators for TPAUC. We also provide two rigorous stochastic algorithms with provable convergence for optimizing both the exact and soft estimator of TPAUC, with the latter problem formulated as a novel three-level compositional stochastic optimization problem. +- We conduct extensive experiments for deep learning on image classification and graph classification tasks with + +imbalanced data. We compare with heuristic and ad-hoc approaches for pAUC maximization and multiple baseline methods, and observe superior performance of the proposed algorithms. + +To the best our knowledge, this work is the first one that provides rigorous stochastic algorithms and convergence guarantee for pAUC maximization that are efficient and applicable to deep learning. We expect the proposed novel formulations for OPAUC and TPAUC will allow researchers to develop even faster algorithms than the proposed algorithms in this paper. + +# 2. Related Work + +In this section, we provide a brief overview of related work for pAUC maximization. + +Earlier works have considered indirect methods for pAUC maximization (Rudin, 2009; Agarwal, 2011; Rakotomamonjy, 2012; Li et al., 2014; Wu et al., 2008). They did not directly optimize the surrogate objective of pAUC but instead some objectives that have some relationship to the right corner of ROC curve, e.g., p-norm push (Rudin, 2009), infinite-push (Agarwal, 2011; Rakotomamonjy, 2012; Li et al., 2014), and asymmetric SVM objective (Wu et al., 2008). Nevertheless, none of these studies propose algorithms that are scalable and applicable for deep learning. + +In (Kar et al., 2014), the authors proposed mini-batch based stochastic methods for pAUC maximization. At each iteration, a gradient estimator is simply computed based on the pAUC surrogate function of the mini-batch data. However, this heuristic approach is not guaranteed to converge for minimizing the pAUC objective and its error scales as $O(1 / \sqrt{B})$ , where $B$ is the mini-batch size. Narasimhan & Agarwal (2013b;a; 2017) developed rigorous algorithms for optimizing pAUC with FPR restricted in a range $(\alpha, \beta)$ based on the structured SVM formulation. However, their algorithms are only applicable to learning linear models and are not efficient for big data due to per-iteration costs proportional to the size of training data. Recently, Yang et al. (2021) considered optimizing two-way partial AUC with FPR less than $\beta$ and TPR larger than $\alpha$ . Their paper focuses on simplifying the optimization problem that involves selection of top ranked negative examples and bottom ranked positive examples. They use ad-hoc weight functions for each positive and negative examples to relax the objective function into decomposable over pairs. The weight function is designed such that the larger the scores of negative examples the higher are their weights, the smaller the scores of positive examples the higher are their weights. Nevertheless, their objective function might have a large approximation error for the pAUC estimator. + +There are also some studies about partial AUC maximization without providing rigorous convergence guarantee on their methods, including greedy methods (Wang & Chang, 2011; Ricamato & Tortorella, 2011) and boosting methods (Komori & Eguchi, 2010; Takenouchi et al., 2012). Some works also use pAUC maximization for learning non-linear neural networks (Ueda & Fujino, 2018; Iwata et al., 2020). However, it is unclear how the optimization algorithms were designed as there were no discussion on the algorithm design and convergence analysis. Finally, it was brought to our attention that a recent work (Yao et al., 2022) also considered partial AUC maximization with a non-convex objective. The difference between this work and (Yao et al., 2022) is that: (i) they focus on optimizing one-way pAUC with FPR in a certain range $(\alpha, \beta)$ where $\alpha > 0$ ; in contrast we consider optimizing both one-way pAUC and two-way pAUC, but for one-way pAUC we only consider FPR in a range of $(0, \beta)$ ; (ii) the second difference is that the proposed algorithms in this paper for one-way pAUC maximization has a better complexity than that established in (Yao et al., 2022). + +# 3. Preliminaries + +In this section, we present some notations and preliminaries. Let $S = \{(\mathbf{x}_1,y_1),\dots ,(\mathbf{x}_n,y_n)\}$ denote a set of training data, where $\mathbf{x}_i$ represents an input training example (e.g., an image), and $\mathbf{y}_i\in \{1, - 1\}$ denotes its corresponding label (e.g., the indicator of a certain disease). Let $h_{\mathbf{w}}(\mathbf{x}) = h(\mathbf{w},\mathbf{x})$ denote the score function of the neural network on an input data $\mathbf{x}$ , where $\mathbf{w}\in \mathbb{R}^d$ denotes the parameters of the network. Denote by $\mathbb{I}(\cdot)$ an indicator function of a predicate, and by $[s]_{+} = \max (s,0)$ . For a set of given training examples $S$ , let $S_{+}$ and $S_{-}$ be the subsets of $S$ with only positive and negative examples, respectively, with $n_{+} = |\mathcal{S}_{+}|$ and $n_{-} = |\mathcal{S}_{-}|$ . Let $S^{\downarrow}[k_1,k_2]\subset S$ be the subset of examples whose rank in terms of their prediction scores in the descending order are in the range of $[k_1,k_2]$ , where $k_{1}\leq k_{2}$ . Similarly, let $S^{\uparrow}[k_1,k_2]\subset S$ denote the subset of examples whose rank in terms of their prediction scores in the ascending order are in the range of $[k_1,k_2]$ , where $k_{1}\leq k_{2}$ . We denote by $\mathrm{E}_{\mathbf{x}\sim S}$ the average over $\mathbf{x}\in S$ . Let $\mathbf{x}_{+}\sim \mathbb{P}_{+}$ denote a random positive example and $\mathbf{x}_{-}\sim \mathbb{P}_{-}$ denote a random negative example. We use $\Delta$ to denote a simplex of a proper dimension. + +A function $F(\mathbf{w})$ is weakly convex if there exists $C > 0$ such that $F(\mathbf{w}) + \frac{C}{2} \| \mathbf{w} \|^2$ is a convex function. A function $F(\mathbf{w})$ is $L$ -smooth if its gradient is Lipschitz continuous, i.e., $\| \nabla F(\mathbf{w}) - \nabla F(\mathbf{w}') \| \leq L \| \mathbf{w} - \mathbf{w}' \|$ . + +pAUC and its non-parametric estimator. For a given threshold $t$ and a score function $h(\cdot)$ , the TPR can be written as $\mathrm{TPR}(t) = \operatorname*{Pr}(h(\mathbf{x})\geq t|y = 1)$ , and the FPR can be written as $\mathrm{FPR}(t) = \mathrm{Pr}(h(\mathbf{x}) > t|y = -1)$ . For a given $u\in [0,1]$ , let $\mathrm{FPR}^{-1}(u) = \inf \{t\in \mathbb{R}:\mathrm{FPR}(t)\leq u\}$ + +and $\mathrm{TPR}^{-1}(u) = \inf \{t\in \mathbb{R}:\mathrm{TPR}(t)\leq u\}$ . The ROC curve defined as $\{u,\mathrm{ROC}(u)\}$ , where $u\in [0,1]$ and $\mathrm{ROC}(u) = \mathrm{TPR}(\mathrm{FPR}^{-1}(u))$ . OPAUC (non-normalized) with FRP restricted in the range $(\alpha_0,\alpha_1)$ is equal to (Dodd & Pepe, 2003) + +$$ +\operatorname {O P A U C} (h, \alpha_ {0}, \alpha_ {1}) = \int_ {\alpha_ {0}} ^ {\alpha_ {1}} \operatorname {R O C} (u) d u = \tag {1} +$$ + +$$ +\Pr (h (\mathbf {x} _ {+}) > h (\mathbf {x} _ {-}), h (\mathbf {x} _ {-}) \in [ \mathrm {F P R} ^ {- 1} (\alpha_ {1}), \mathrm {F P R} ^ {- 1} (\alpha_ {0}) ]), +$$ + +where $h(\mathbf{x}_{-}) \in [\mathrm{FPR}^{-1}(\alpha_{1}), \mathrm{FPR}^{-1}(\alpha_{0})]$ means that only negative examples whose prediction scores are in certain quantiles are considered. As a result, we have the following non-parametric estimator of OPAUC: + +$$ +\widehat {\mathrm {O P A U C}} (h, \alpha_ {0}, \alpha_ {1}) = \tag {2} +$$ + +$$ +\frac {1}{n _ {+}} \frac {1}{n _ {-}} \sum_ {\mathbf {x} _ {i} \in \mathcal {S} _ {+}} \sum_ {\mathbf {x} _ {j} \in \mathcal {S} _ {-} ^ {\perp} [ k _ {1} + 1, k _ {2} ]} \mathbb {I} (h (\mathbf {x} _ {i}) > h (\mathbf {x} _ {j})), +$$ + +where $k_{1} = \lceil n_{-}\alpha_{0}\rceil ,k_{2} = \lfloor n_{-}\alpha_{1}\rfloor$ . In this work, we will focus on optimizing OPAUC(h,0,β) for some $\beta \in (0,1)$ + +Similarly, a non-parametric estimator of TPAUC with $\mathrm{FPR} \leq \beta$ , $\mathrm{TPR} \geq \alpha$ is given by + +$$ +\widehat {\mathrm {T P A U C}} (h, \alpha , \beta) = \tag {3} +$$ + +$$ +\frac {1}{n _ {+}} \frac {1}{n _ {-}} \sum_ {\mathbf {x} _ {i} \in \mathcal {S} _ {+} ^ {\uparrow} [ 1, k _ {1} ]} \sum_ {\mathbf {x} _ {j} \in \mathcal {S} _ {-} ^ {\downarrow} [ 1, k _ {2} ]} \mathbb {I} (h (\mathbf {x} _ {i}) > h (\mathbf {x} _ {j})), +$$ + +where $k_{1} = \lfloor n_{+}\alpha \rfloor ,k_{2} = \lfloor n_{-}\beta \rfloor$ + +Distributionally Robust Optimization (DRO). For a set of random loss functions $\ell_1(\cdot),\ldots ,\ell_n(\cdot)$ , a DRO loss can be written as + +$$ +\hat {L} _ {\phi} (\cdot) = \max _ {\mathbf {p} \in \Delta} \sum_ {j} p _ {j} \ell_ {j} (\cdot) - \lambda D _ {\phi} (\mathbf {p}, 1 / n), \tag {4} +$$ + +where $D_{\phi}(\mathbf{p},1 / n) = \frac{1}{n}\sum_{i}\phi (np_{i})$ is a divergence measure, and $\lambda >0$ is a parameter. The idea of the DRO loss is to assign an importance weight $p_i$ to each individual loss and take the uncertainty into account by maximization over $\mathbf{p}\in \Delta$ with a proper constraint/regularization on $\mathbf{p}$ . In the literature, several divergence measures have been considered (Levy et al., 2020). In this paper, we will consider two special divergence measures that are of most interest for our purpose, i.e., the KL divergence $\phi_{kl}(t) = t\log t - t + 1$ , which gives $D_{\phi}(\mathbf{p},1 / n) = \sum_{i}p_{i}\log (np_{i})$ , and the CVaR divergence $\phi_c(t) = \mathbb{I}(0 < t\leq 1 / \gamma)$ with a parameter $\gamma \in (0,1)$ which gives $D_{\phi}(\mathbf{p},1 / n) = 0$ if $p_i\leq 1 / (n\gamma)$ and infinity otherwise. The following lemma gives the closed form of $\hat{L}_{\phi}$ for $\phi_c$ and $\phi_{kl}$ . + +Lemma 1. By using KL divergence measure, we have + +$$ +\hat {L} _ {k l} (\cdot ; \lambda) = \lambda \log \left(\frac {1}{n} \sum_ {i = 1} ^ {n} \exp \left(\frac {\ell_ {i} (\cdot)}{\lambda}\right)\right). \tag {5} +$$ + +By using the CVaR divergence $\phi_c(t)$ for some $\gamma$ such that $n\gamma$ is an integer, we have, + +$$ +\hat {L} _ {c v a r} (\cdot ; \gamma) = \frac {1}{n \gamma} \sum_ {i = 1} ^ {n \gamma} \ell_ {[ i ]} (\cdot), \tag {6} +$$ + +where $\ell_{[i]}(\cdot)$ denotes the $i$ -th largest value in $\{\ell_1,\dots ,\ell_n\}$ . + +The estimator in (6) is also known as the estimator of conditional-value-at-risk (Rockafellar et al., 2000). + +# 4. AUC meets DRO for OPAUC Maximization + +Since the non-parametric estimator of OPAUC in (2) is non-continuous and non-differentiable, a continuous surrogate objective for OPAUC $(h_{\mathbf{w}},0,\beta)$ is usually defined by using a continuous pairwise surrogate loss $L(\mathbf{w};\mathbf{x}_i,\mathbf{x}_j) = \ell (h_{\mathbf{w}}(\mathbf{x}_i) - h_{\mathbf{w}}(\mathbf{x}_j))$ , resulting in the following problem: + +$$ +\min _ {\mathbf {w}} \frac {1}{n _ {+}} \sum_ {\mathbf {x} _ {i} \in \mathcal {S} _ {+}} \frac {1}{n _ {-} \beta} \sum_ {\mathbf {x} _ {j} \in \mathcal {S} _ {-} ^ {\downarrow} [ 1, n _ {-} \beta ]} L (\mathbf {w}; \mathbf {x} _ {i}, \mathbf {x} _ {j}), \tag {7} +$$ + +where we assume $n - \beta$ is an positive integer for simplicity of presentation. For the surrogate loss $\ell(\cdot)$ , we assume it satisfies the following properties. + +Assumption 1. We assume $\ell(\cdot)$ is a convex, differentiable and monotonically decreasing function when $\ell(\cdot) > 0$ , and $\ell'(0) < 0$ . + +It is notable that the above condition is a sufficient condition to ensure that the surrogate $\ell(\cdot)$ is consistent for AUC maximization (Gao & Zhou, 2015). There are many surrogate loss functions that have the above properties, e.g., squared hinge loss $\ell(s) = (c - s)_+^2$ , logistic loss $\ell(s) = \log(1 + \exp(-s/c))$ where $c > 0$ is a parameter. + +The challenge of optimizing a surrogate objective of pAUC in (7) lies at tackling the selection of top ranked negative examples from $S_{-}$ , i.e., $S_{-}^{\downarrow}[1,k]$ for some fixed $k$ . It is impossible to compute an unbiased stochastic gradient of the objective in (7) based on a mini-batch of examples that include only a part of negative examples. + +# 4.1. AUC meets DRO for OPAUC + +To address the above challenge, we define new formulations for OPAUC maximization by leveraging the DRO. In particular, we define a robust loss for each positive data by + +$$ +\hat {L} _ {\phi} (\mathbf {w}; \mathbf {x} _ {i}) = \max _ {\mathbf {p} \in \Delta} \sum_ {\mathbf {x} _ {j} \in \mathcal {S} _ {-}} p _ {j} L (\mathbf {w}; \mathbf {x} _ {i}, \mathbf {x} _ {j}) - \lambda D _ {\phi} (\mathbf {p}, 1 / n _ {-}). +$$ + +Then we define the following objective for OPAUC maximization: + +$$ +\min _ {\mathbf {w}} \frac {1}{n _ {+}} \sum_ {\mathbf {x} _ {i} \in \mathcal {S} _ {+}} \hat {L} _ {\phi} (\mathbf {w}; \mathbf {x} _ {i}). \tag {8} +$$ + +When $\phi (\cdot) = \phi_c(\cdot)$ , we refer to the above estimator (i.e., the objective function) as CVaR-based OPAUC estimator; and when $\phi (\cdot) = \phi_{kl}(\cdot)$ , we refer to the above estimator as KLDRO-based OPAUC estimator. Below, we present two theorems to state the equivalent form of the objective, and the relationship between the two estimators and the surrogate objective in (7) of OPAUC. + +Theorem 1. By choosing $\phi (\cdot) = \phi_c(\cdot) = \mathbb{I}(\cdot \in (0,1 / \beta ])$ , then the problem (8) is equivalent to + +$$ +\min _ {\mathbf {w}} \min _ {\mathbf {s} \in \mathbb {R} ^ {n _ {+}}} F (\mathbf {w}, \mathbf {s}) = \frac {1}{n _ {+}} \sum_ {\mathbf {x} _ {i} \in \mathcal {S} _ {+}} \left(s _ {i} + \frac {1}{\beta} \psi_ {i} (\mathbf {w}, s _ {i})\right), \tag {9} +$$ + +where $\psi_{i}(\mathbf{w},s_{i}) = \frac{1}{n - }\sum_{\mathbf{x}_{j}\in S_{-}}(L(\mathbf{w};\mathbf{x}_{i},\mathbf{x}_{j}) - s_{i})_{+}$ . If $\ell$ is a monotonically decreasing function for $\ell (\cdot) > 0$ , then the objective in (8) is equivalent to (7) of OPAUC. + +Remark: The above theorem indicates that CVaR-based OPAUC estimator is an exact estimator of OPAUC, which is consistent for OPAUC maximization. The variable $s_i$ can be considered as the threshold variable to select the top-ranked negative examples for each positive data. + +Theorem 2. By choosing $\phi(\cdot) = \phi_{kl}(\cdot)$ , then the problem (8) becomes + +$$ +\min _ {\mathbf {w}} \frac {1}{n _ {+}} \sum_ {\mathbf {x} _ {i} \sim \mathcal {S} _ {+}} \lambda \log \mathrm {E} _ {\mathbf {x} _ {j} \in \mathcal {S} _ {-}} \exp \left(\frac {L (\mathbf {w} ; \mathbf {x} _ {i} , \mathbf {x} _ {j})}{\lambda}\right). \tag {10} +$$ + +If $\ell(\cdot)$ is a monotonically decreasing function for $\ell(\cdot) > 0$ , when $\lambda = 0$ , the above objective is a surrogate of $\widehat{OPAUC}(h_{\mathbf{w}}, 0, \frac{1}{n-})$ ; and when $\lambda = +\infty$ , the above objective is a surrogate of $\widehat{OPAUC}(h_{\mathbf{w}}, 0, 1)$ , i.e., the AUC. + +Remark: Theorem 2 indicates that KLDRO-based OPAUC estimator is a soft estimator, which interpolates between OPAUC $(h_{\mathbf{w}},0,1 / n_{-})$ and OPAUC $(h_{\mathbf{w}},0,1)$ by varying $\lambda$ . + +It is also notable that when $\beta = 1 / n_{-}$ in CVaR-based estimator, the objective in (8) becomes the infinite-push (or top-push) objective considered in the literature (Agarwal, 2011; Rakotomamonjy, 2012; Li et al., 2014), and hence our algorithm for solving (9) can be also used for solving the infinite-push objective for deep learning. In contrast, the previous works for the infinite-push objective focus on learning linear models. Similarly, when $\lambda = 0$ in KLDRO-based estimator, the objective in (10) becomes the infinitepush objective. Nevertheless, our algorithm for optimizing KLDRO-based estimator is not exactly applicable to optimizing the infinite-push objective as we focus on the cases $\lambda > 0$ , which yields a smooth objective function under proper conditions of $\ell(\cdot)$ and $h(\cdot; \mathbf{x})$ . As a result, we could + +have stronger convergence by optimizing the KLDRO-based estimator as indicated by our convergence results in next subsection. + +# 4.2. Optimization Algorithms and Convergence Results + +In this subsection, we present the optimization algorithms for solving both (9) and (10), and then present their convergence results for finding a nearly stationary solution. The key to our development is to formulate the two optimization problems into known non-convex optimization problems that have been studied in the literature, and then to develop stochastic algorithms by borrowing the existing techniques. + +Optimizing CVaR-based estimator. We first consider optimizing the CVaR-based estimator, which is equivalent to (9). A benefit for solving (9) is that an unbiased stochastic subgradient can be computed in terms of $(\mathbf{w},\mathbf{s})$ . However, this problem is still challenging because the objective function $F(\mathbf{w},\mathbf{s})$ is non-smooth non-convex. In order to develop a stochastic algorithm with convergence guarantee, we prove that $F(\mathbf{w},\mathbf{s})$ is weakly convex in terms of $(\mathbf{w},\mathbf{s})$ , which allows us to borrow the techniques of optimizing weakly convex function (Davis & Drusvyatskiy, 2018) for solving our problem and to establish the convergence. We first establish the weak convexity of $F(\mathbf{w},\mathbf{s})$ . + +Lemma 2. If $L(\cdot ;\mathbf{x}_i,\mathbf{x}_j)$ is a $L_{s}$ -smooth function for any $\mathbf{x}_i,\mathbf{x}_j$ , then $F(\mathbf{w},\mathbf{s})$ is $\rho$ -weakly convex with $\rho = L_s / \beta$ . + +Another challenge for optimizing $F(\mathbf{w},\mathbf{s})$ is that s is of high dimensionality and computing the gradient for all entries in s at each iteration is expensive. Therefore, we develop a tailored stochastic algorithm for solving (9), which is shown in Algorithm 1. This algorithm uses stochastic gradient descent (SGD) updates for updating w and stochastic coordinate gradient descent (SCGD) updates for updating s. We refer to the algorithm as SOPA. A key feature of SOPA is that the stochastic gradient estimator for w is a weighted average gradient of the pairwise losses for all pairs in the mini-batch, i.e., step 6. The hard weights $p_{ij}$ (either 0 or 1) are dynamically computed by step 4, which compares the pairwise loss $(\ell (h(\mathbf{w}_t,\mathbf{x}_i) - h(\mathbf{w}_t,\mathbf{x}_j))$ with the threshold variable $s_i^t$ , which is also updated by a SGD step. + +Optimizing KLDRO-based estimator of OPAUC. Next, we consider optimizing the KLDRO-based estimator, which is equivalent to (10). A nice property of the objective function is that it is smooth under a proper condition as stated in Assumption 2. However, the challenge for solving (10) is that an unbiased stochastic gradient is not readily computed. To highlight the issue, the problem (10) can be written as + +$$ +\min _ {\mathbf {w}} F (\mathbf {w}) = \frac {1}{n _ {+}} \sum_ {\mathbf {x} _ {i} \in \mathcal {S} _ {+}} f \left(g _ {i} (\mathbf {w})\right), \tag {11} +$$ + +where $g_{i}(\mathbf{w}) = \mathrm{E}_{\mathbf{x}_{j}\sim \mathcal{S}_{-}}\exp \left(\frac{L(\mathbf{w};x_{i},\mathbf{x}_{j})}{\lambda}\right)$ and $f(\cdot) = \lambda \log (\cdot)$ . A similar optimization problem has been studied + +# Algorithm 1 SOPA + +1: Set $\mathbf{s}^1 = 0$ and initialize w +2: for $t = 1, \dots, T$ do +3: Sample two mini-batches $\mathcal{B}_{+} \subset S_{+}, \mathcal{B}_{-} \subset S_{-}$ +4: Let $p_{ij} = \mathbb{I}(\ell(h(\mathbf{w}_t, \mathbf{x}_i) - h(\mathbf{w}_t, \mathbf{x}_j)) - s_i^t > 0)$ +5: Update $s_i^{t+1} = s_i^t - \frac{\eta_2}{n_+} \left( 1 - \frac{\sum_j p_{ij}}{\beta |\mathcal{B}_-|} \right)$ for $\mathbf{x}_i \in \mathcal{B}_+$ . +6: Compute a gradient estimator $\nabla_t$ by + +$$ +\nabla_ {t} = \frac {1}{\beta | \mathcal {B} _ {+} | | \mathcal {B} _ {-} |} \sum_ {\mathbf {x} _ {i} \in \mathcal {B} _ {+}} \sum_ {\mathbf {x} _ {j} \in \mathcal {B} _ {-}} p _ {i j} \nabla_ {\mathbf {w}} L (\mathbf {w} _ {t}; \mathbf {x} _ {i}, \mathbf {x} _ {j}) +$$ + +7: Update $\mathbf{w}_{t + 1} = \mathbf{w}_t - \eta_1\nabla_t$ + +8: end for + +in (Qi et al., 2021) for maximizing average precision, which is referred to as finite-sum coupled compositional stochastic optimization, where $f(g_{i}(\mathbf{w}))$ is a compositional function and $g_{i}(\mathbf{w})$ depends on the index $i$ for the outer summation. A full gradient of $f(g_{i}(\mathbf{w}))$ is given by $f^{\prime}(g_{i}(\mathbf{w}))\nabla g_{i}(\mathbf{w})$ . With a mini-batch of samples, $g_{i}(\mathbf{w})$ can be estimated by an unbiased estimator $\hat{g}_i(\mathbf{w})$ . However, $f^{\prime}(\hat{g}_i(\mathbf{w}))\nabla \hat{g}_i(\mathbf{w})$ is a biased estimator due to the compositional form. To address this challenge, Qi et al. (2021) proposed a novel stochastic algorithm that maintains a moving average estimator for $g_{i}(\mathbf{w})$ denoted by $u_{i}$ . Recently, Wang & Yang (2022) has also studied the finite-sum coupled compositional optimization problem comprehensively and proposed a similar algorithm (SOX) and derived better convergence results than that in (Qi et al., 2021). Hence, we employ the same algorithm in (Wang & Yang, 2022) for solving (10), which is in shown in Algorithm 2 and is referred to as SOPA-s. + +There are two key differences between SOPA-s and SOPA. First, the pairwise weights $p_{ij}$ in SOPA-s (step 5) are soft weights between 0 and 1, in contrast to the hard weights $p_{ij} \in \{0,1\}$ in SOPA. Second, the update for $\mathbf{w}_{t+1}$ is a momentum-based update where $\gamma_1 \in (0,1)$ . We can also use an Adam-style update, which shares similar convergence as the momentum-based update (Guo et al., 2021). + +# 4.3. Convergence Analysis + +For convergence analysis, we make the following assumption about $h$ and $\ell(\cdot)$ . + +Assumption 2. Assume $h(\cdot; \mathbf{x})$ is Lipschitz continuous, smooth and bounded, $\ell(\cdot)$ is a smooth function and has a bounded gradient for a bounded argument. + +A bounded smooth score function $h(\cdot ;\mathbf{x})$ is ensured if the activation function of the neural network is smooth and the output layer uses a bounded and smooth activation function. For example, let $\hat{h} (\mathbf{w};\mathbf{x})$ denote the plain output of the neural network, then the score function $h(\mathbf{w};\mathbf{x}) =$ + +# Algorithm 2 SOPA-s + +1: Set $\mathbf{u}^1 = 0$ and initialize $\mathbf{w}$ +2: for $t = 1, \dots, T$ do +3: Sample two mini-batches $\mathcal{B}_{+} \subset S_{+}, \mathcal{B}_{-} \subset S_{-}$ +4: For each $\mathbf{x}_i\in \mathcal{B}_+$ , update $u_{i}^{t + 1} = (1 - \gamma_0)u_i^t +$ $\gamma_0\frac{1}{|\mathcal{B}_-|}\sum_{\mathbf{x}_j\in \mathcal{B}_-}\exp \left(\frac{L(\mathbf{w}_t;\mathbf{x}_i,\mathbf{x}_j)}{\lambda}\right)$ +5: Let $p_{ij} = \exp (L(\mathbf{w}_t;\mathbf{x}_i,\mathbf{x}_j) / \lambda) / u_i^t$ +6: Compute a gradient estimator $\nabla_t$ by + +$$ +\nabla_ {t} = \frac {1}{| \mathcal {B} _ {+} |} \frac {1}{| \mathcal {B} _ {-} |} \sum_ {\mathbf {x} _ {i} \in \mathcal {B} _ {+}} \sum_ {\mathbf {x} _ {j} \in \mathcal {B} _ {-}} p _ {i j} \nabla L (\mathbf {w} _ {t}; \mathbf {x} _ {i}, \mathbf {x} _ {j}) +$$ + +7: Update $\mathbf{v}_t = (1 - \gamma_1)\mathbf{v}_{t-1} + \gamma_1\nabla_t$ +8: Update $\mathbf{w}_{t + 1} = \mathbf{w}_t - \eta \mathbf{v}_t$ (or Adam-style) +9: end for + +$1 / (1 + \exp (-\hat{h} (\mathbf{w};\mathbf{x}))$ is bounded and smooth. The Lipschitz continuity of $h(\mathbf{w};\mathbf{x})$ can be guaranteed if $\mathbf{w}$ is bounded. + +We first consider the analysis of SOPA. Since $F(\mathbf{w}, \mathbf{s})$ is non-smooth, for presenting the convergence result, we need to introduce a convergence measure based on the Moreau envelope of $F(\mathbf{w}, \mathbf{s})$ given below for some $\hat{\rho} > \rho$ : + +$$ +F _ {\hat {\rho}} (\mathbf {w}, \mathbf {s}) = \min _ {\mathbf {w}, \mathbf {s}} F (\mathbf {w}, \mathbf {s}) + \frac {\hat {\rho}}{2} (\| \mathbf {w} \| ^ {2} + \| \mathbf {s} \| ^ {2}). +$$ + +It is guaranteed that $F_{\hat{\rho}}(\mathbf{w}, \mathbf{s})$ is a smooth function (Drusvyatskiy & Paquette, 2019). A point $(\mathbf{w}, \mathbf{s})$ is called an $\epsilon$ -nearly stationary solution to $F(\mathbf{w}, \mathbf{s})$ if $\| \nabla F_{\hat{\rho}}(\mathbf{w}, \mathbf{s}) \| \leq \epsilon$ for some $\hat{\rho} > \rho$ , where $\rho$ is the weak convexity parameter of $F$ . This convergence measure has been widely used for weakly convex optimization problems (Davis & Drusvyatskiy, 2018; Rafique et al., 2020; Chen et al., 2019). Then we establish the following convergence guarantee for SOPA. + +Theorem 3. Under Assumption 2, Algorithm 1 ensures that after $T = O(1 / (\beta \epsilon^4))$ iterations we can find an $\epsilon$ nearly stationary solution of $F(\mathbf{w},\mathbf{s})$ , i.e., $\mathrm{E}\| \nabla F_{\hat{\rho}}(\mathbf{w}_{\tau},\mathbf{s}_{\tau})\|^{2} \leq \epsilon^{2}$ for a randomly selected $\tau \in \{1,\dots ,T\}$ and $\hat{\rho} = 1.5\rho$ . + +Next, we establish the convergence of SOPA-s. Under Assumption 2, we can show that $F(\mathbf{w})$ in (11) is smooth. Hence, we use the standard convergence measure in terms of gradient norm of $F(\mathbf{w})$ . + +Theorem 4. Under Assumption 2, Algorithm 2 with $\gamma_0 = O(B_{-}\epsilon^2)$ , $\gamma_1 = O(\min\{B_{-}, B_{+}\} \epsilon^2)$ , $\eta = O(\min\{\gamma_0 B_1 / n_{+}, \gamma_1\})$ ensures that after $T = O\left(\frac{1}{\min(B_{+}, B_{-}) \epsilon^4} + \frac{n_{+}}{B_{+} B_{-} \epsilon^4}\right)$ iterations we can find an $\epsilon$ -stationary solution of $F(\mathbf{w})$ , i.e., $\operatorname{E}\left[\|\nabla F(\mathbf{w}_{\tau})\|^{2}\right] \leq \epsilon^{2}$ for a randomly selected $\tau \in \{1, \ldots, T\}$ , where $B_{+} = |\mathcal{B}_{+}|$ and $B_{-} = |\mathcal{B}_{-}|$ . + +Remark: The convergence analysis of Algorithm 2 follows + +directly from that in (Wang & Yang, 2022). Compared with that in Theorem 3 for SOPA, the convergence of SOPA-s is stronger than that of SOPA in several aspects: (i) the convergence measure of SOPA-s is stronger than that of SOPA due to that Theorem 4 guarantees the convergence in terms of gradient norm of the objective, while Theorem 3 guarantees the convergence on a weaker convergence measure namely the gradient norm of the Moreau envelope of the objective; (ii) the complexity of SOPA-s enjoys a parallel speed-up by using a mini-batch of data. However, it is also notable that the complexity of SOPA does not depend on the number of positive data as that of SOPA-s. + +# 5. AUC meets DRO for TPAUC Maximization + +In this section, we propose estimators for the surrogate objective of TPAUC and stochastic algorithms with convergence guarantee for optimizing the estimators. To this end, we apply another level of DRO on top of $\hat{L}_{\phi}(\mathbf{x}_i,\mathbf{w}),\mathbf{x}_i\in S_+$ and define the following estimator of TPAUC: + +$$ +F (\mathbf {w}; \phi , \phi^ {\prime}) = \max _ {\mathbf {p} \in \Delta} \sum_ {\mathbf {x} _ {i} \in \mathcal {S} _ {+}} p _ {i} \hat {L} _ {\phi} (\mathbf {x} _ {i}, \mathbf {w}) - \lambda^ {\prime} D _ {\phi^ {\prime}} (\mathbf {p}, \frac {1}{n _ {+}}). +$$ + +Next, we focus on optimizing the soft estimator of TPAUC defined by using $\phi = \phi' = \phi_{kl}$ . First, we have the following form for the estimator. + +Lemma 3. When $\phi = \phi' = \phi_{kl}$ , we have + +$$ +\begin{array}{l} F (\mathbf {w}; \phi_ {k l}, \phi_ {k l}) \\ = \lambda^ {\prime} \log \operatorname {E} _ {\mathbf {x} _ {i} \sim \mathcal {S} _ {+}} \left(\operatorname {E} _ {\mathbf {x} _ {j} \sim \mathcal {S} _ {-}} \exp (\frac {\ell (\mathbf {w} ; \mathbf {x} _ {i} , \mathbf {x} _ {j})}{\lambda})\right) ^ {\frac {\lambda}{\lambda^ {\prime}}}. \\ \end{array} +$$ + +For minimizing this function, we formulate the problem as a novel three-level compositional stochastic optimization: + +$$ +\min _ {\mathbf {w}} f _ {1} \left(\frac {1}{n _ {+}} \sum_ {\mathbf {x} _ {i} \in \mathcal {S} _ {+}} f _ {2} \left(g _ {i} (\mathbf {w})\right)\right), +$$ + +where $f_{1}(s) = \lambda^{\prime}\log (s)$ , $f_{2}(g) = g^{\lambda /\lambda^{\prime}}$ and $g_{i}(\mathbf{w}) = \mathrm{E}_{\mathbf{x}_j\sim \mathcal{S}_-}\exp (L(\mathbf{w};\mathbf{x}_i,\mathbf{x}_j) / \lambda)$ . We propose a novel stochastic algorithm for solving the above problem, which is shown in Algorithm 3, to which we refer as SOTAs. Note that the problem is similar to multi-level compositional optimization (Balasubramanian et al., 2021) but also has subtle difference. The function inside $f_{1}$ has a form similar to that in (11). Hence, we use similar technique to SOPA-s by maintaining and updating $u^{i}$ to track $g_{i}(\mathbf{w})$ in step 4. Besides, we need to maintain and update $v_{t + 1}$ to track $\frac{1}{n_{+}}\sum_{\mathbf{x}_{i}\in \mathcal{S}_{+}}f_{2}(g_{i}(\mathbf{w}_{t}))$ in step 5. Then the gradient estimator in step 7 is computed by $\nabla f_1(v_{t + 1})\frac{1}{|\mathcal{B}_+|}\sum_{\mathbf{x}_i\in \mathcal{B}_+}\nabla \hat{g}_i(\mathbf{w}_t)\nabla f_2(u_t^i)$ , where $\hat{g}_i(\mathbf{w}) = \mathrm{E}_{\mathbf{x}_j\sim \mathcal{B}_-}\exp (L(\mathbf{w}_t;\mathbf{x}_i,\mathbf{x}_j) / \lambda)$ . Then we update the model parameter by the momentum-style or Adam-style update. + +Theorem 5. Under Assumption 2, Algorithm 3 with $\gamma_0 =$ + +# Algorithm 3 SOTA-s + +1: Set $\mathbf{u}_0 = 0, v_0 = 0, \mathbf{m}_0 = 0$ and initialize $\mathbf{w}$ +2: for $t = 1, \dots, T$ do +3: Sample two mini-batches $\mathcal{B}_{+} \subset S_{+}$ , $\mathcal{B}_{-} \subset S_{-}$ +4: For each $\mathbf{x}_i\in \mathcal{B}_+$ compute $u_{t}^{i} = (1 - \gamma_{0})u_{t - 1}^{i} + \gamma_{0}\frac{1}{|B_{-}|}\sum_{\mathbf{x}_{j}\in \mathcal{B}_{-}}L(\mathbf{w}_{t};\mathbf{x}_{i},\mathbf{x}_{j})$ +5: Let $v_{t} = (1 - \gamma_{1})v_{t - 1} + \gamma_{1}\frac{1}{|\mathcal{B}_{+}|}\sum_{\mathbf{x}_{i}\in \mathcal{B}_{+}}f_{2}(u_{t - 1}^{i})$ +6: Let $p_{ij} = (u_{t - 1}^i)^{\lambda /\lambda ' - 1}\exp (L(\mathbf{w}_t,\mathbf{x}_i,\mathbf{x}_j) / \lambda) / v_t$ +7: Compute a gradient estimator $\nabla_t$ by + +$$ +\nabla_ {t} = \frac {1}{| \mathcal {B} _ {+}} \frac {1}{| \mathcal {B} _ {-} |} \sum_ {\mathbf {x} _ {i} \in \mathcal {B} _ {+}} \sum_ {\mathbf {x} _ {j} \in \mathcal {B} _ {-}} p _ {i j} \nabla L (\mathbf {w} _ {t}; \mathbf {x} _ {i}, \mathbf {x} _ {j}) +$$ + +8: Update $\mathbf{m}_t = (1 - \gamma_2)\mathbf{m}_{t-1} + \gamma_2\nabla_t$ +9: Update $\mathbf{w}_{t + 1} = \mathbf{w}_t - \eta \mathbf{m}_t$ (or Adam-style) + +# 10: end for + +$O(B_{-}\epsilon^{2})$ $\gamma_{1} = O(B_{+}\epsilon^{2})$ $\gamma_{2} = O(\min \{B_{-},B_{+}\} \epsilon^{2})$ $\eta = O(\min \{\gamma_0B_1 / n_+,\gamma_1,\gamma_2\})$ ensures that after $T = O\left(\frac{1}{\min(B_{+},B_{-})\epsilon^{4}} +\frac{n_{+}}{B_{+}B_{-}\epsilon^{4}}\right)$ iterations we can find an $\epsilon$ nearly stationary solution of $F(\mathbf{w})$ , where $B_{+} = |\mathcal{B}_{+}|$ and $B_{-} = |\mathcal{B}_{-}|$ + +Remark: It is notable that SOTA-s has an iteration complexity in the same order of SOPA-s for OPAUC maximization. + +Finally, we discuss how to optimize the exact estimator of TPAUC defined by $F(\mathbf{w};\phi_c,\phi_c')$ , where $\phi_c(t) = \mathbb{I}(0\leq t\leq 1 / \beta)$ and $\phi_c^\prime (t) = \mathbb{I}(0\leq t\leq 1 / \alpha)$ with $K_{2} = n_{-}\beta$ and $K_{1} = n_{+}\alpha$ being integers. Lemma 7 in the supplement shows that if $\ell (\cdot)$ is monotonically decreasing for $\ell (\cdot) > 0$ + +$$ +\begin{array}{l} F (\mathbf {w}; \phi_ {c}, \phi_ {c} ^ {\prime}) = \\ \frac {1}{K _ {1} K _ {2}} \sum_ {\mathbf {x} _ {i} \in \mathcal {S} _ {+} ^ {\uparrow} [ 1, K _ {1} ]} \sum_ {\mathbf {x} _ {j} \in \mathcal {S} _ {-} ^ {\downarrow} [ 1, K _ {2} ]} L (\mathbf {w}; \mathbf {x} _ {i}, \mathbf {x} _ {j}), \\ \end{array} +$$ + +is a consistent surrogate function of TPAUC for $\mathrm{TPR} \geq \alpha$ and $\mathrm{FPR} \leq \beta$ in view of the estimator TPAUC given in (3). + +Similar to Theorem 1, we can show that $F(\mathbf{w}; \phi_c, \phi_c')$ is equivalent to: + +$$ +\min _ {s ^ {\prime} \in \mathbb {R}, \mathbf {s} \in \mathbb {R} ^ {n +}} s ^ {\prime} + \frac {1}{n + \alpha} \sum_ {\mathbf {x} _ {i} \in \mathcal {S} _ {+}} (s _ {i} + \frac {1}{\beta} \psi_ {i} (\mathbf {w}; s _ {i}) - s ^ {\prime}) _ {+}. +$$ + +Like $F(\mathbf{w},\mathbf{s})$ in (9), we can prove the inner function is weakly convex in terms of $(\mathbf{w},\mathbf{s},s')$ . However, computing an unbiased stochastic gradient in terms of $\mathbf{w}$ and $s_i$ is also impossible due to that $\psi_i(\mathbf{w};s_i)$ is inside a hinge function. To solve this problem, we can use the conjugate form of the hinge function to convert the minimization of $F(\mathbf{w};\phi_c,\phi_c')$ into a weakly-convex concave min-max problem (Rafique et al., 2020) and we can develop a stochastic algorithm but only with $O(1 / \epsilon^6)$ iteration complexity for finding a nearly stationary solution. We present the algorithm and analysis + +in the supplement for interested readers. + +# 6. Experiments + +Datasets. We consider binary classification tasks on two types of datasets, namely image datasets and molecular datasets. For image datasets, we use CIFAR-10, CIFAR-100, Melanoma for experiments. For CIFAR-10 and CIFAR-100 (Krizhevsky et al., 2009), we construct imbalanced versions of the datasets by randomly removing some positive samples following (Yuan et al., 2020). Specifically, we take first half of classes as the negative class and last half of classes as the positive class, and then remove $80\%$ samples from the positive class to make it imbalanced. The Melanoma dataset is a naturally imbalanced medical dataset which is released on Kaggle (Rotemberg et al., 2021). For molecular datasets, we use ogbg-moltox21 (the No.0 target), ogbg-molmuv (the No.1 target) and ogbg-molpbca (the No.0 target) for experiments, which are from the Stanford Open Graph Benchmark (OGB) website (Hu et al., 2020). The task on these molecular datasets is to predict certain property of molecules. The statistics for the datasets are presented in Table 5 in the supplement. + +Deep Models. For image datasets, we learn convolutional neural network (CNN) and use ResNet18 (He et al., 2016) for CIFAR-10, CIFAR100 and Melanoma. For molecular datasets, we learn graph neural network (GNN) and use Graph Isomorphism Network (GIN) as the backbone model on all datasets (Xu et al., 2018), which has 5 mean-pooling layers with 64 number of hidden units and dropout rate 0.5. + +Baselines. We will compare our methods with different baselines for both training performance and testing performance. For comparison of training convergence, we consider different methods for optimizing the same objective, i.e., partial AUC. We compare with 2 baselines, i.e., the naive mini-batch based method (Kar et al., 2014), to which we refer as MB, and a recently proposed ad-hoc weight based method (Yang et al., 2021), to which we refer as AW-poly. MB that optimizes OPAUC only considers the top negative samples in the mini-batch; and MB that optimizes TPAUC considers the top negative samples and bottom positive samples in the mini-batch. For AW-poly, we use the polynomial weight function according to their paper. It is notable that AW-poly was originally proposed for optimizing TPAUC. But it can be easily modified for optimizing OPAUC with FPR in $(0,\beta)$ . For comparison of testing performance, we compare different methods for optimizing different objectives, including the cross-entropy loss (CE), the pair-wise squared hinge loss for AUC maximization (AUC-SH), the AUC min-max margin loss (AUC-M) (Yuan et al., 2021), p-norm push (P-push) (Rudin, 2009). For optimizing CE and AUC-SH, we use the standard Adam optimizer. For optimizing AUC-M, we use their proposed + +![](images/b6f6b317b91ceba5cb866a85082be7d24c9f911d65fb7177d041f80f689e00e1.jpg) + +![](images/5d292170e79a1fcf6d271c0e778af879dd4a362ceab9425fabcb4c0473eda152.jpg) + +![](images/cfb9bc54d495e4df2101a1ebddfe612b054750ffdc5aceffd36d76dbd36520c9.jpg) + +![](images/e5e6eab8cee271520c4a7298a4697191957c0cd5520ae27c4dee546228fd34e8.jpg) + +![](images/fae3a1805a810f8f2e2cfb3a6a954d5f9acf8c8945bbcb60b1d7ce850c48965c.jpg) +Figure 2. Training Convergence Curves on image and molecular datasets; Top for OPAUC maximization, bottom for TPAUC maximization. + +![](images/a6aa982f894e7d9c70299ae2443d6b28c21bf1fb5259a20f6e599569989c29d3.jpg) + +![](images/9683aa18fcb52f9b66cecd32487923d2a8112221a1d1f7604d69cbe08953541b.jpg) + +![](images/ffccc67da68624c1ccbe50ac0396e81040f55a1fcee265408eaf615b7f462fbb.jpg) + +optimizer PESG. For P-push, we use a stochastic algorithm with an Adam-style update similar to that proposed in (Qi et al., 2021). For our methods, we use $\ell(t) = (1 - t)_+^2$ and also use the Adam-style update unless specified explicitly. Similar to (Yuan et al., 2021; Qi et al., 2021), we use a pretraining step that optimizes the base model by optimizing CE loss with an Adam optimizer, and then re-initialize the classifier layer and fine-tune all layers by different methods. + +Target Measures. For OPAUC maximization, we evaluate OPAUC with two FPR upper bounds, i.e., $\mathrm{FPR} \leq 0.3$ and $\mathrm{FPR} \leq 0.5$ separately. For TPAUC maximization, we evaluate TPAUC with two settings, i.e., $\mathrm{FPR} \leq 0.4$ and $\mathrm{TPR} \geq 0.6$ , and $\mathrm{FPR} \leq 0.5$ and $\mathrm{TPR} \geq 0.5$ . + +Parameter Tuning. The learning rate of all methods is tuned in $\{1\mathrm{e} - 3,1\mathrm{e} - 4,1\mathrm{e} - 5\}$ , except for PESG which is tuned at $\{1\mathrm{e} - 1,1\mathrm{e} - 2,1\mathrm{e} - 3\}$ because it favors a larger learning rate. Weight decay is fixed as $2\mathrm{e} - 4$ . Each method is run 60 epochs in total and learning rate decays 10-fold after every 20 epochs. The mini-batch size is 64. For AUC-M, we tune the hyperparameter $\gamma$ that controls consecutive epoch-regularization in $\{100,500,1000\}$ . For P-push, we tune the polynomial power hyper-parameter in $\{2,4,6\}$ . For MB that optimizes OPAUC, we tune the top proportion of negative samples in $\{10\%,30\%,50\% \}$ , and for MB that optimizes TPAUC we tune the top proportion of negative samples in $\{30\%,40\%,50\% \}$ , and tune the bottom proportion of positive samples in the range $\{30\%,40\%,50\% \}$ . For AW-poly, we follow (Yang et al., 2021) and tune its parameter $\gamma$ in $\{101,34,11\}$ . For SOPA, we tune the truncated FPR i.e. $\beta$ in $\{0.1,0.3,0.5\}$ . For SOPA-s, we fix $\gamma_0 = 0.9$ and tune the KL-regularization parameter $\lambda$ in $\{0.1,1.0,10\}$ , and for SOTA-s, we fix $\gamma_0 = \gamma_1 = 0.9$ , and tune both $\lambda$ and $\lambda'$ in $\{0.1,1.0,10\}$ . The momentum parameter for updating $\mathbf{v}_t$ in SOPA-s (i.e., $1 - \gamma_{1}$ ) and SOTA-s (i.e., $1 - \gamma_{2}$ ) is set to the default value as in the Adam optimizer, i.e., 0.1. For comparison of training convergence, the parameters are tuned according to the training performance. For comparison of + +testing performance, the parameters are tuned according to the validation performance. For each experiment, we repeat multiple times with different train/validation splits and random seeds, then report average and standard deviation over multiple runs. + +Results. We show the plots of training convergence in Figure 2 on two image datasets (CIFAR-10, -100) and on two molecular datasets (moltox21, molpcba). From the results, we can see that SOPA-s (SOTA-s) converge always faster than MB and AW-poly for OPAUC (TPAUC) maximization. For OPAUC maximization, SOPA-s is usually faster than SOPA. More results are included in the supplement on other datasets with similar observations. The testing performance on all six datasets are shown in Table 1, 2, 3 and 4. In most cases, the proposed methods are better than the baselines. In particular, dramatic improvements have been observed on Melanoma and ogbg-molmuv datasets, which are two datasets with the highest imbalance ratios. In addition, we see that AUC maximization methods (AUC-M, AUC-SH) are not necessarily good for pAUC maximization. + +Accuracy of KLDRO-based estimator. Of independent interest, we conduct simple experiments to verify the accuracy of KLDRO-based estimator of OPAUC. To this end, we compute the relative error (RE) of KLDRO-based estimator compared with the exact estimator (i.e., CVaR-based estimator). For a given upper bound of FRP we vary $\lambda$ for 100 independently randomly generated model parameters $\mathbf{w}$ , and the results are shown in the following figure on moltox21-t0 data (please refer to the experiments section for more information of the dataset), which demonstrates that for a given FPR there exists $\lambda$ such that KLDRO estimator is close to the exact estimator. + +Ablation Study. We also conduct some ablation study to understand the proposed algorithm SOPA-s and SOTA-s. In particular for both algorithms, we verify that tuning $\gamma_0$ in SOPA-s and $\gamma_0, \gamma_1$ in SOTA-s can help further improve the performance. The results are included in the supplement. + +Table 1. One way partial AUC on testing data of three image datasets + +
CIFAR-10CIFAR-100Melanoma
MethodsFPR≤0.3FPR≤0.5FPR≤0.3FPR≤0.5FPR≤0.3FPR≤0.5
CE0.8446(0.0018)0.8777(0.0014)0.7338(0.0047)0.7787(0.0044)0.7651(0.0135)0.8151(0.0028)
AUC-SH0.8657(0.0056)0.8948(0.0036)0.7467(0.0047)0.7930(0.0027)0.7824(0.0138)0.8176(0.0160)
AUC-M0.8678(0.0016)0.8934(0.0022)0.7371(0.0031)0.7828(0.0005)0.7788(0.0068)0.8249(0.0141)
P-push0.8610(0.0007)0.8889(0.0021)0.7445(0.0025)0.7930(0.0029)0.7440(0.0130)0.8028(0.0170)
MB0.8690(0.0016)0.8931(0.0015)0.7487(0.0017)0.7930(0.0014)0.7683(0.0303)0.8184(0.0278)
AW-poly0.8664(0.0052)0.8915(0.0075)0.7490(0.0058)0.7909(0.0068)0.7936(0.0238)0.8355(0.0067)
SOPA0.8766(0.0034)0.9028(0.0031)0.7551(0.0044)0.7999(0.0028)0.8093(0.0248)0.8585(0.0210)
SOPA-s0.8691(0.0036)0.8961(0.0036)0.7468(0.0056)0.7877(0.0053)0.7775(0.0076)0.8401(0.0206)
+ +Table 2. Two way partial AUC on testing data of three image datasets; $\left( {\alpha ,\beta }\right)$ represents TPR $\geq \alpha$ and FPR $\leq \beta$ . + +
CIFAR-10CIFAR-100Melanoma
Methods(0.6,0.4)(0.5,0.5)(0.6,0.4)(0.5,0.5)(0.6,0.4)(0.5,0.5)
CE0.4981(0.0078)0.6414(0.0080)0.2178(0.0136)0.4011(0.0118)0.3399(0.0135)0.5150(0.0038)
AUC-SH0.5622(0.0064)0.6923(0.0071)0.2599(0.0061)0.4397(0.0062)0.3640(0.0354)0.5291(0.0312)
AUC-M0.5691(0.0021)0.6907(0.0125)0.2336(0.0041)0.4153(0.0022)0.3665(0.0646)0.5404(0.0545)
P-push0.5477(0.0077)0.6781(0.0055)0.2623(0.0042)0.4417(0.0092)0.3317(0.0304)0.4870(0.0443)
MB0.5404(0.0041)0.6724(0.0011)0.2207(0.0033)0.4017(0.0149)0.3330(0.0258)0.4981(0.0252)
AW-poly0.5536(0.0196)0.6814(0.0203)0.2489(0.0166)0.4342(0.0112)0.3878(0.0292)0.5216(0.0288)
SOTA-s0.5799(0.0202)0.7074(0.0145)0.2708(0.0055)0.4528(0.0069)0.4198(0.0825)0.5865(0.0664)
+ +Table 3. One way partial AUC on testing data of three molecular datasets + +
moltox21(t0)molmuv(t1)molpcba(t0)
MethodsFPR≤0.3FPR≤0.5FPR≤0.3FPR≤0.5FPR≤0.3FPR≤0.5
CE0.6671(0.0009)0.6954(0.005)0.8008(0.0090)0.8201(0.0061)0.6802(0.0002)0.7169(0.0002)
AUC-SH0.7161(0.0043)0.7295(0.0036)0.7880(0.0382)0.8025(0.0437)0.6939(0.0009)0.7350(0.0015)
AUC-M0.6866(0.0048)0.7080(0.0020)0.7960(0.0123)0.8076(0.0175)0.6985(0.0016)0.7399(0.0005)
P-push0.6946(0.0107)0.7160(0.0073)0.7832(0.0220)0.7940(0.0321)0.6841(0.0007)0.7293(0.0043)
MB0.7398(0.0131)0.7329(0.0099)0.7672(0.0563)0.7772(0.0547)0.6899(0.0002)0.7253(0.0006)
AW-poly0.7227(0.0024)0.7271(0.0112)0.7754(0.0372)0.7883(0.0431)0.6975(0.0006)0.7350(0.0015)
SOPA0.7209(0.0063)0.7318(0.0084)0.8187(0.0319)0.8245(0.0312)0.6989(0.0022)0.7371(0.0011)
SOPA-s0.7309(0.0151)0.7330(0.0073)0.8449(0.0399)0.8412(0.0447)0.7027(0.0018)0.7416(0.0006)
+ +Table 4. Two way partial AUC on testing data of three molecular datasets; $\left( {\alpha ,\beta }\right)$ represents $\mathrm{{TPR}} \geq \alpha$ and $\mathrm{{FPR}} \leq \beta$ . + +
moltox21(t0)molmuv(t1)molpcba(t0)
Methods(0.6,0.4)(0.5,0.5)(0.6,0.4)(0.5,0.5)(0.6,0.4)(0.5,0.5)
CE0.0674(0.0014)0.2082(0.0011)0.1613(0.0337)0.4691(0.0183)0.0949(0.0006)0.2639(0.0006)
AUC-SH0.0640(0.0080)0.2170(0.0140)0.2600(0.1300)0.4440(0.1280)0.1400(0.0030)0.3120(0.0030)
AUC-M0.0660(0.0090)0.2090(0.0100)0.1140(0.0790)0.4330(0.0530)0.1420(0.0090)0.3130(0.0030)
P-push0.0610(0.0180)0.2070(0.0120)0.1860(0.1520)0.4170(0.1080)0.1350(0.0020)0.3000(0.0120)
MB0.0670(0.0150)0.2150(0.0230)0.1730(0.1530)0.4260(0.1180)0.0950(0.0020)0.2620(0.0030)
AW-poly0.0640(0.0100)0.2060(0.0250)0.1720(0.1440)0.3930(0.1230)0.1100(0.0010)0.2810(0.0020)
SOTA-s0.0680(0.0180)0.2300(0.0210)0.3270(0.1640)0.5260(0.1220)0.1430(0.0010)0.3140(0.0020)
+ +![](images/4b0239f72ac6ef515328af7f27d1dce001923c289d23bec9a1784f49f35726bf.jpg) +Figure 3. Relative error (RE) for KLDRO-based estimator for OPAUC on moltox21-t0 dataset with FPR={0.3, 0.5}. + +![](images/881dd403ab35dffb0dda4cad7f89e77c7c5e417bed3319cb838ee87436b09de0.jpg) + +# 7. Conclusions + +In this paper, we have proposed new formulations for partial AUC maximization by using distributionally robust opti + +mization. We propose two formulations for both one-way and two-way partial AUC, and develop stochastic algorithms with convergence guarantee for solving the two formulations, respectively. Extensive experiments on image and molecular graph datasets verify the effectiveness of the proposed algorithms. + +# 8. Acknowledgements + +This work is partially supported by NSF Grant 2110545, NSF Career Award 1844403, and NSF Grant 1933212. D. Zhu and X. Wu was partially supported by NSF grant CCF-1733742. We also thank anonymous reviewers for constructive comments. + +# References + +Agarwal, S. The infinite push: A new support vector ranking algorithm that directly optimizes accuracy at the absolute top of the list. In SDM, 2011. +Balasubramanian, K., Ghadimi, S., and Nguyen, A. Stochastic multi-level composition optimization algorithms with level-independent convergence rates. *ArXiv e-prints*, arXiv:2008.10526, 2021. +Chen, Z., Yuan, Z., Yi, J., Zhou, B., Chen, E., and Yang, T. Universal stagewise learning for non-convex problems with convergence on averaged solutions. In 7th International Conference on Learning Representations (ICLR), 2019. +Davis, D. and Drusvyatskiy, D. Stochastic subgradient method converges at the rate $o(k^{-1/4})$ on weakly convex functions. CoRR, /abs/1802.02988, 2018. +Dodd, L. and Pepe, M. Partial auc estimation and regression. Biometrics, 59:614-23, 10 2003. doi: 10.1111/1541-0420.00071. +Drusvyatskiy, D. and Paquette, C. Efficiency of minimizing compositions of convex functions and smooth maps. Mathematical Programming, pp. 1-56, 2019. +Gao, W. and Zhou, Z.-H. On the consistency of auc pairwise optimization. In Proceedings of the 24th International Conference on Artificial Intelligence, IJCAI'15, pp. 939-945. AAAI Press, 2015. ISBN 9781577357384. +Guo, Z., Xu, Y., Yin, W., Jin, R., and Yang, T. On stochastic moving-average estimators for non-convex optimization. ArXiv e-prints, arXiv:2104.14840, 2021. +He, K., Zhang, X., Ren, S., and Sun, J. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770-778, 2016. +Herbrich, R., Graepel, T., and Obermayer, K. Large Margin Rank Boundaries for Ordinal Regression. In Advances in Large Margin Classifiers, chapter 7, pp. 115-132. The MIT Press, 1999. URL http://www.berbrich.me/papers/nips98_ordinal.pdf. +Hu, W., Fey, M., Zitnik, M., Dong, Y., Ren, H., Liu, B., Catasta, M., and Leskovec, J. Open graph benchmark: Datasets for machine learning on graphs. arXiv preprint arXiv:2005.00687, 2020. +Iwata, T., Fujino, A., and Ueda, N. Semi-supervised learning for maximizing the partial auc. In AAAI, 2020. + +Kar, P., Narasimhan, H., and Jain, P. Online and stochastic gradient methods for non-decomposable loss functions. In Proceedings of the 27th International Conference on Neural Information Processing Systems - Volume 1, NIPS'14, pp. 694-702, Cambridge, MA, USA, 2014. MIT Press. +Komori, O. and Eguchi, S. A boosting method for maximizing the partial area under the roc curve. BMC Bioinformatics, 11:314 - 314, 2010. +Krizhevsky, A., Hinton, G., et al. Learning multiple layers of features from tiny images. 2009. +Levy, D., Carmon, Y., Duchi, J. C., and Sidford, A. Large-scale methods for distributionally robust optimization. Advances in Neural Information Processing Systems, 33, 2020. +Li, N., Jin, R., and Zhou, Z.-H. Top rank optimization in linear time. In NIPS, 2014. +Liu, M., Yuan, Z., Ying, Y., and Yang, T. Stochastic AUC maximization with deep neural networks. In 8th International Conference on Learning Representations (ICLR), 2020. +Narasimhan, H. and Agarwal, S. Svmpauctight: A new support vector method for optimizing partial auc based on a tight convex upper bound. In Proceedings of the 19th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD '13, pp. 167-175, New York, NY, USA, 2013a. Association for Computing Machinery. ISBN 9781450321747. doi: 10. 1145/2487575.2487674. URL https://doi.org/ 10.1145/2487575.2487674. +Narasimhan, H. and Agarwal, S. A structural SVM based approach for optimizing partial auc. In Dasgupta, S. and McAllester, D. (eds.), Proceedings of the 30th International Conference on Machine Learning, volume 28 of Proceedings of Machine Learning Research, pp. 516-524, Atlanta, Georgia, USA, 17-19 Jun 2013b. PMLR. URL https://proceedings.mlr.press/v28/narasimhan13.html. +Narasimhan, H. and Agarwal, S. Support vector algorithms for optimizing the partial area under the roc curve. Neural Computation, 29:1919-1963, 2017. +Ogryczak, W. and Tamir, A. Minimizing the sum of the k largest functions in linear time. Information Processing Letters, 85:117-122, 02 2003. doi: 10.1016/S0020-0190(02)00370-8. +Qi, Q., Luo, Y., Xu, Z., Ji, S., and Yang, T. Stochastic optimization of area under precision-recall curve + +for deep learning with provable convergence. In Advances in neural information processing systems, volume abs/2104.08736, 2021. URL https://arxiv.org/abs/2104.08736. +Rafique, H., Liu, M., Lin, Q., and Yang, T. Non-convex min-max optimization: Provable algorithms and applications in machine learning. Optimization Methods and Software, 2020. +Rakotomamonjy, A. Sparse support vector infinite push. In ICML, 2012. +Ricamato, M. T. and Tortorella, F. Partial auc maximization in a linear combination of dichotomizers. Pattern Recognit., 44:2669-2677, 2011. +Rockafellar, R. T., Uryasev, S., et al. Optimization of conditional value-at-risk. Journal of risk, 2:21-42, 2000. +Rotemberg, V., Kurtansky, N., Betz-Stablein, B., Caffery, L., Chousakos, E., Codella, N., Combalia, M., Dusza, S., Guitera, P., Gutman, D., et al. A patient-centric dataset of images and metadata for identifying melanomas using clinical context. Scientific data, 8(1):1-8, 2021. +Rudin, C. The p-norm push: A simple convex ranking algorithm that concentrates at the top of the list. Journal of Machine Learning Research, 10(78):2233-2271, 2009. URL http://jmlr.org/papers/v10/rudin09b.html. +Takenouchi, T., Komori, O., and Eguchi, S. An extension of the receiver operating characteristic curve and auc-optimal classification. Neural computation, 24:2789-824, 06 2012. doi: 10.1162/NECO_a_00336. +Ueda, N. and Fujino, A. Partial auc maximization via nonlinear scoring functions. ArXiv, abs/1806.04838, 2018. +Wang, B. and Yang, T. Finite-sum coupled compositional stochastic optimization: Theory and applications. In Proceedings of the International Conference on Machine Learning, pp. -, 2022. +Wang, Z. and Chang, Y.-C. I. Marker selection via maximizing the partial area under the roc curve of linear risk scores. *Biostatistics*, 12 2:369–85, 2011. +Wang, Z., Liu, M., Luo, Y., Xu, Z., Xie, Y., Wang, L., Cai, L., Qi, Q., Yuan, Z., Yang, T., and Ji, S. Advanced graph and sequence neural networks for molecular property prediction and drug discovery, 2021. +Wu, S.-H., Lin, K.-P., Chen, C.-M., and Chen, M.-S. Asymmetric support vector machines: Low false-positive learning under the user tolerance. In Proceedings of the 14th ACM SIGKDD International Conference on + +Knowledge Discovery and Data Mining, KDD '08, pp. 749-757, New York, NY, USA, 2008. Association for Computing Machinery. ISBN 9781605581934. doi: 10. 1145/1401890.1401980. URL https://doi.org/ 10.1145/1401890.1401980. +Xu, K., Hu, W., Leskovec, J., and Jegelka, S. How powerful are graph neural networks? arXiv preprint arXiv:1810.00826, 2018. +Yang, H., Lu, K., Lyu, X., and Hu, F. Two-way partial auc and its properties. Statistical methods in medical research, 28(1):184-195, 2019. +Yang, Z., Xu, Q., Bao, S., He, Y., Cao, X., and Huang, Q. When all we need is a piece of the pie: A generic framework for optimizing two-way partial auc. In Meila, M. and Zhang, T. (eds.), Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pp. 11820-11829. PMLR, 18-24 Jul 2021. URL https://proceedings.mlr.press/v139/yang21k.html. +Yao, Y., Lin, Q., and Yang, T. Large-scale optimization of partial auc in a range of false positive rates. arXiv preprint, 2022. +Yuan, Z., Yan, Y., Sonka, M., and Yang, T. Robust deep AUC maximization: A new surrogate loss and empirical studies on medical image classification. In International Conference on Computer Vision, volume abs/2012.03173, 2020. URL https://arxiv.org/abs/2012.03173. +Yuan, Z., Guo, Z., Xu, Y., Ying, Y., and Yang, T. Federated deep AUC maximization for heterogeneous data with a constant communication complexity. In Meila, M. and Zhang, T. (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. 12219-12229. PMLR, 2021. URL http://proceedings.mlr.press/v139/yuan21a.html. + +# A. More Experimental Results + +Table 5. Datasets Statistics. The percentage in parenthesis represents the proportion of positive samples. + +
DatasetTrainValidationTest
CIFAR-1024000 (16.67%)6000 (16.67%)6000 (16.67%)
CIFAR-10024000 (16.67%)6000 (16.67%)6000 (16.67%)
Melanoma26500 (1.76%)3313 (1.78%)3313 (1.75%)
moltox21(t0)5834 (4.25%)722 (4.01%)709 (4.51%)
molmuv(t1)11466 (0.18%)1559 (0.13%)1709 (0.35%)
molpcba(t0)120762 (9.32%)19865 (11.74%)20397 (11.61%)
+ +# A.1. Additional plots for training convergence + +We present more training convergence plots on Melanoma dataset and molmuv dataset at Figure 4. For OPAUC maximization, We can observe that both our proposed SOPA-s and SOPA converge much better than AW-poly and MB method under different settings, i.e., $\mathrm{FPR} \leq 0.3$ and $\mathrm{FPR} \leq 0.5$ . And our proposed SOTA-s converge higher by a noticeable margin than AW-poly and MB method for TPAUC maximization all the time. + +![](images/10b632c54be155ac517d4ecaa710212fd4943fb515508314d420a469246ffb4b.jpg) + +![](images/2c7a8e08fff7ff58fa5e8c11c846c6367f689e421d7b8f7ef942b30c175aeb3c.jpg) + +![](images/c30d42b544baa211e63c96117e6e335271c2ea7236a90d47cc79416ec60fa714.jpg) + +![](images/98d15b50e72f6d9ee7d89470ab5b4647dc3e7f3d218c26f168dcd6d280cf7148.jpg) + +![](images/3cb67f30554018962957f56516af95c110732d72d241ead4121e855a9d5d4fc2.jpg) +Figure 4. Training Convergence Curves on Melanoma and molmuv datasets; Top for OPAUC maximization, bottom for TPAUC maximization. + +![](images/731242acd2194455428b7abc8744f5a6b1a36bfc3605be32ce2faabe579f2eef.jpg) + +![](images/32248a254ff50cd5f7a710ae4dd88e40a56a1e7bcb53950c5cfcd98b9527d376.jpg) + +![](images/56520c061d0e4af2b93c4528e4b6348e02e761a5a88dd0274eb2287eca031596.jpg) + +# A.2. Ablation study for $\gamma_0$ in SOPA-s and $\gamma_0, \gamma_1$ in SOTA-s + +We conduct extensive ablation study for understanding the extra hyper-parameters $\gamma_0$ in SOPA-s and $\gamma_0, \gamma_1$ in SOTA-s algorithms. We fix it as 0.9 for all of our experiments in the main content. But in practice, the performance would be further improved if we tune those hyper-parameters as well. + +For image datasets, we conduct experiments on CIFAR-10 and CIFAR-100; for molecule datasets, we conduct experiments on ogbg-moltox21 and ogbg-molmuv. For each dataset, we first fix the best learning rate and other hyper-parameters based on our previous results in the paper. Then, for SOPA-s, we investigate $\gamma_0$ at $\{1.0, 0.9, 0.7, 0.5, 0.3, 0.1\}$ ; for SOTA-s, we investigate both $\gamma_0$ and $\gamma_1$ at $\{1.0, 0.9, 0.7, 0.5, 0.3, 0.1\}$ + +For training aspect, we include the comparisons for SOPA-s at Figure 5; we include the comparisons for SOTA-s at Figure 6. From Figure 5, we can see that better training performance could be achieved by tuning the parameter $\gamma_0$ in SOPA-s, compared with fixing it as 0.9; the similar result for SOTA-s can be also observed from Figure 6. + +For testing aspect, we include the testing pAUC results at Table 6 for SOPA-s; Table 7 for SOTA-s. Both verify that tuning these parameters can further improve the performance. + +![](images/1e9724ea4a7f4ba9867fd34b3cac1e074b84cc33631d3d248fb6b66786c72890.jpg) + +![](images/17d64c157d0102e43e0e5cacff3c29ac6268f8c8b81f8a78b83c1c0c8d6b437d.jpg) + +![](images/764c1f4065a86e9a1eb375ac392a96e1557feee2e8a288a2273d929e94abb392.jpg) + +![](images/70533e2fe88b18cee8f8ad9b570c59aa391c9d0330250146a6f76e437ac94990.jpg) + +![](images/c43d6e2dc3b3eb7a121a18cd9919fba6a715df59d7feb7727564460c9a8db6a1.jpg) + +![](images/933615ab30553be2d5188a8cbda92e3c7ed6c68a67515889868e0521d2068ac3.jpg) +Figure 5. Training convergence for SOPA-s on different $\gamma_0$ . + +![](images/7555f5139f80f3a33a7a252585a4fe6e891c27e8a10a6f2f8ca0292aa69a86f5.jpg) + +![](images/72fcf58a4d4af0ec2905cfd5f35f84da1a4258ba7220fe5f436877ae1153dc0f.jpg) + +![](images/a559fbdcf3c10e0b0a6c7bf2679bec1035769067f2282ddcf4a34520652cb682.jpg) + +![](images/0ba0393e8fe4e47d785351bc60cf0750fbeaeb20cf2a67e58b0952223ebbf334.jpg) + +![](images/5856d1725025ce003ff109655ef309670c78aca937bc18d60011b9c0fef98fc8.jpg) + +![](images/a494c3a147085220eb2a14331f3d2a47b0df64ac61b09f6d9d0eee4c59033328.jpg) + +![](images/642a17d12365ed1a9e02d1ed246509e2c4c66703d4004f69766fd6b856c7918f.jpg) +Figure 6. Top-6 choices of $\gamma_0$ and $\gamma_{1}$ for SOTA-s from training perspective. + +![](images/f5988d338db36ea3f29400debcc65375ca58e13a09b99f3bb6f8e9cdf6484aab.jpg) + +![](images/c260d149c1fbb936ce238409509d93914fd46ff16682f0b1bba3c2f0c9f4a4cb.jpg) + +![](images/e74c02f5f87b5a396032898adf0bd243d53cc6fe36b7db5c923495acdde0c89c.jpg) + +Table 6. Test pAUC for SOPA-s on different ${\gamma }_{0}$ . + +
DatasetMetricγ0=1.0γ0=0.9γ0=0.7γ0=0.5γ0=0.3γ0=0.1
CIFAR-10FPR≤0.30.8721(0.0049)0.8691(0.0036)0.8682(0.0048)0.8697(0.0032)0.8674(0.0045)0.8725(0.0012)
FPR≤0.50.8989(0.0051)0.8961(0.0036)0.8946(0.0040)0.8980(0.0037)0.8947(0.0028)0.8996(0.0021)
CIFAR-100FPR≤0.30.7464(0.0012)0.7460(0.0068)0.7482(0.0031)0.7508(0.0038)0.7494(0.0048)0.7514(0.0018)
FPR≤0.50.7888(0.0016)0.7877(0.0053)0.7936(0.0040)0.7961(0.0063)0.7922(0.0059)0.7954(0.0015)
moltox21FPR≤0.30.7242(0.0170)0.7288(0.0125)0.7274(0.0087)0.7274(0.0062)0.7158(0.0069)0.7340(0.0079)
FPR≤0.50.7245(0.0194)0.7266(0.0111)0.7280(0.0066)0.7358(0.0079)0.7249(0.0090)0.7360(0.0123)
molmuvFPR≤0.30.8692(0.0116)0.8376(0.0340)0.8642(0.0214)0.8735(0.0070)0.8732(0.0104)0.8496(0.0392)
FPR≤0.50.8773(0.0186)0.8616(0.0355)0.8747(0.0053)0.8996(0.0228)0.8918(0.0232)0.8622(0.0415)
+ +# B. Proofs + +We next present several lemmas. The first lemma is straightforward. + +Lemma 4. For $\hat{L}_{kl}(\cdot ;\lambda)$ , when $\lambda = 0$ it reduces to the maximal value of $\{\ell_1(\cdot),\dots ,\ell_n(\cdot)\}$ , i.e., $\hat{L}_{kl}(\cdot ,0) = \max_{i}\ell_{i}(\cdot)$ ; and when $\lambda = \infty$ , it reduces to the average value of $\{\ell_1,\ldots ,\ell_n\}$ , i.e., $\hat{L}_{kl}(\cdot ;\infty) = \frac{1}{n}\sum_{i = 1}^{n}\ell_{i}(\cdot)$ . + +Lemma 5. [Lemma 1 (Ogryczak & Tamir, 2003)] Assume $\gamma = k / n$ for some integer $k\in [n]$ , we have $\hat{L}_{cvar}(\cdot ;\gamma) = \min_s s + \frac{1}{n\gamma}\sum_{i = 1}^n [\ell_i(\cdot) - s]_+$ . + +A major difference between $\hat{L}_{kl}(\cdot ;\lambda)$ and $\hat{L}_{cvar}(\cdot ;\gamma)$ that has an impact on optimization is that $\hat{L}_{cvar}(\cdot ;\gamma)$ is a non-smooth function, and $\hat{L}_{kl}(\cdot ;\lambda)$ is a smooth function for $\lambda >0$ when $\ell_i(\cdot)$ is smooth and bounded as indicated by the following lemma. + +Table 7. Test pAUC for SOTA-s on different ${\gamma }_{0}$ and ${\gamma }_{1}$ . + +
CIFAR-10(0.4, 0.6)γ1=1.0γ1=0.9γ1=0.7γ1=0.5γ1=0.3γ1=0.1
γ0=1.00.5731(0.0069)0.5744(0.0083)0.5668(0.0048)0.5686(0.0089)0.5678(0.0070)0.5739(0.0135)
γ0=0.90.5802(0.0081)0.5839(0.0116)0.5693(0.0072)0.5743(0.0131)0.5688(0.0048)0.5760(0.0095)
γ0=0.70.5755(0.0098)0.5715(0.0032)0.5684(0.0131)0.5797(0.0036)0.5718(0.0095)0.5695(0.0111)
γ0=0.50.5743(0.0058)0.5706(0.0025)0.5641(0.0094)0.5819(0.0077)0.5725(0.0109)0.5739(0.0068)
γ0=0.30.5767(0.0121)0.5638(0.0144)0.5617(0.0075)0.5644(0.0099)0.5595(0.0028)0.5768(0.0100)
γ0=0.10.5608(0.0075)0.5689(0.0134)0.5699(0.0096)0.5685(0.0056)0.5583(0.0101)0.5756(0.0135)
CIFAR-10(0.5, 0.5)γ1=1.0γ1=0.9γ1=0.7γ1=0.5γ1=0.3γ1=0.1
γ0=1.00.7022(0.0054)0.6999(0.0076)0.6922(0.0076)0.6969(0.0087)0.6982(0.0046)0.6981(0.0074)
γ0=0.90.7051(0.0083)0.7047(0.0072)0.6987(0.0034)0.7008(0.0103)0.6964(0.0048)0.7003(0.0064)
γ0=0.70.7027(0.0046)0.6999(0.0031)0.6959(0.0099)0.7043(0.0056)0.6988(0.0099)0.6914(0.0110)
γ0=0.50.7012(0.0050)0.6988(0.0008)0.6944(0.0067)0.7044(0.0067)0.7014(0.0047)0.7031(0.0088)
γ0=0.30.7024(0.0099)0.6940(0.0085)0.6901(0.0060)0.6981(0.0047)0.6908(0.0025)0.6977(0.0129)
γ0=0.10.6934(0.0068)0.7009(0.0060)0.6972(0.0088)0.6946(0.0037)0.6891(0.0098)0.7027(0.0082)
CIFAR-100(0.4, 0.6)γ1=1.0γ1=0.9γ1=0.7γ1=0.5γ1=0.3γ1=0.1
γ0=1.00.2710(0.0144)0.2650(0.0052)0.2528(0.0061)0.2573(0.0129)0.2587(0.0096)0.2613(0.0046)
γ0=0.90.2666(0.0144)0.2708(0.0055)0.2698(0.0117)0.2586(0.0116)0.2562(0.0032)0.2663(0.0056)
γ0=0.70.2634(0.0086)0.2624(0.0065)0.2577(0.0045)0.2664(0.0051)0.2634(0.0090)0.2626(0.0144)
γ0=0.50.2633(0.0010)0.2591(0.0026)0.2552(0.0068)0.2530(0.0069)0.2656(0.0089)0.2594(0.0052)
γ0=0.30.2572(0.0063)0.2542(0.0076)0.2517(0.0111)0.2599(0.0184)0.2580(0.0191)0.2631(0.0081)
γ0=0.10.2532(0.0050)0.2745(0.0029)0.2529(0.0060)0.2573(0.0115)0.2568(0.0029)0.2671(0.0187)
CIFAR-100(0.5, 0.5)γ1=1.0γ1=0.9γ1=0.7γ1=0.5γ1=0.3γ1=0.1
γ0=1.00.4489(0.0122)0.4454(0.0084)0.4337(0.0097)0.4418(0.0083)0.4361(0.0093)0.4405(0.0063)
γ0=0.90.4416(0.0115)0.4528(0.0069)0.4494(0.0073)0.4449(0.0171)0.4337(0.0046)0.4421(0.0058)
γ0=0.70.4426(0.0119)0.4426(0.0098)0.4367(0.0092)0.4414(0.0072)0.4455(0.0046)0.4430(0.0108)
γ0=0.50.4404(0.0058)0.4388(0.0085)0.4341(0.0066)0.4332(0.0079)0.4426(0.0107)0.4421(0.0057)
γ0=0.30.4384(0.0090)0.4313(0.0081)0.4377(0.0104)0.4392(0.0185)0.4401(0.0095)0.4384(0.0125)
γ0=0.10.4325(0.0006)0.4500(0.0015)0.4361(0.0085)0.4316(0.0083)0.4355(0.0053)0.4461(0.0213)
moltox21(0.4, 0.6)γ1=1.0γ1=0.9γ1=0.7γ1=0.5γ1=0.3γ1=0.1
γ0=1.00.0769(0.0403)0.0800(0.0345)0.0594(0.0377)0.0409(0.0241)0.0774(0.0342)0.0607(0.0139)
γ0=0.90.0668(0.0304)0.0733(0.0198)0.0676(0.0357)0.0761(0.0316)0.0737(0.0245)0.0588(0.0249)
γ0=0.70.0657(0.0280)0.0849(0.0451)0.0840(0.0162)0.0807(0.0253)0.0665(0.0171)0.0573(0.0262)
γ0=0.50.0795(0.0537)0.0513(0.0140)0.0704(0.0301)0.0367(0.0164)0.0754(0.0190)0.0676(0.0350)
γ0=0.30.1009(0.0133)0.0695(0.0256)0.0806(0.0289)0.0805(0.0358)0.0943(0.0453)0.0546(0.0409)
γ0=0.10.0746(0.0473)0.0610(0.0224)0.0694(0.0303)0.0578(0.0458)0.0768(0.0574)0.0485(0.0254)
moltox21(0.5, 0.5)γ1=1.0γ1=0.9γ1=0.7γ1=0.5γ1=0.3γ1=0.1
γ0=1.00.2474(0.0154)0.2489(0.0282)0.2355(0.0508)0.2127(0.0326)0.2798(0.0640)0.2254(0.0223)
γ0=0.90.2483(0.0214)0.2476(0.0222)0.2373(0.0552)0.2457(0.0296)0.2341(0.0137)0.2198(0.0233)
γ0=0.70.2306(0.0286)0.2354(0.0360)0.2531(0.0217)0.2546(0.0174)0.2415(0.0181)0.2233(0.0225)
γ0=0.50.2536(0.0531)0.2251(0.0163)0.2276(0.0241)0.2153(0.0196)0.2488(0.0121)0.2230(0.0228)
γ0=0.30.2773(0.0207)0.2482(0.0256)0.2434(0.0224)0.2603(0.0323)0.2574(0.0455)0.22208(0.0494)
γ0=0.10.2368(0.0193)0.2395(0.0267)0.2323(0.0239)0.1973(0.0383)0.2543(0.0611)0.2121(0.0369)
molmuv(0.4, 0.6)γ1=1.0γ1=0.9γ1=0.7γ1=0.5γ1=0.3γ1=0.1
γ0=1.00.5021(0.1222)0.4508(0.1263)0.3878(0.0776)0.5399(0.1575)0.3972(0.0768)0.3904(0.1404)
γ0=0.90.5651(0.0833)0.4524(0.0290)0.6060(0.2187)0.5711(0.1495)0.4250(0.0543)0.4313(0.1174)
γ0=0.70.4120(0.1026)0.4338(0.0407)0.5375(0.1339)0.5765(0.1719)0.3251(0.0889)0.4744(0.1379)
γ0=0.50.5432(0.1177)0.4934(0.1065)0.4812(0.0744)0.3890(0.0976)0.4507(0.0387)0.3859(0.0488)
γ0=0.30.4680(0.1079)0.4559(0.1037)0.4811(0.1237)0.4221(0.1322)0.4297(0.2263)0.3828(0.0606)
γ0=0.10.4777(0.0591)0.4264(0.1414)0.5322(0.1342)0.4122(0.0260)0.3836(0.0368)0.3903(0.0325)
molmuv(0.5, 0.5)γ1=1.0γ1=0.9γ1=0.7γ1=0.5γ1=0.3γ1=0.1
γ0=1.00.6780(0.0880)0.6384(0.0964)0.6175(0.0447)0.7135(0.1074)0.6188(0.0483)0.6152(0.0965)
γ0=0.90.7405(0.0621)0.6399(0.0276)0.7481(0.1464)0.7230(0.1020)0.6136(0.0321)0.6277(0.0854)
γ0=0.70.6201(0.0698)0.6445(0.0430)0.7007(0.1013)0.7272(0.1178)0.5588(0.0482)0.6496(0.1030)
γ0=0.50.7071(0.0869)0.6854(0.0853)0.6542(0.0646)0.5867(0.0657)0.6495(0.0470)0.5996(0.0431)
γ0=0.30.6626(0.0737)0.6561(0.0778)0.6658(0.0910)0.6408(0.0825)0.6264(0.1791)0.5801(0.0399)
γ0=0.10.6643(0.0562)0.6362(0.1103)0.7142(0.0904)0.6271(0.1188)0.5746(0.0283)0.5877(0.0449)
+ +Lemma 6. If $\ell_i(\cdot)$ is a smooth function, and has a bounded value and bounded gradient for a bounded input, then for $\lambda >0$ the function $\hat{L}_{kl}(\cdot ;\lambda)$ is also a smooth and bounded function. + +Lemma 7. When $\phi_c(t) = \mathbb{I}(0\leq t\leq 1 / \beta)$ and $\phi_c^\prime (t) = \mathbb{I}(0\leq t\leq 1 / \alpha)$ with $K_{2} = n_{-}\beta$ and $K_{1} = n_{+}\alpha$ being integers, if $\ell (\cdot)$ is monotonically decreasing for $\ell (\cdot) > 0$ , we can show that + +$$ +F (\mathbf {w}; \phi_ {c}, \phi_ {c} ^ {\prime}) = \frac {1}{K _ {1} K _ {2}} \sum_ {\mathbf {x} _ {i} \in \mathcal {S} _ {+} ^ {\uparrow} [ 1, K _ {1} ]} \sum_ {\mathbf {x} _ {j} \in \mathcal {S} _ {-} ^ {\downarrow} [ 1, K _ {2} ]} L (\mathbf {w}; \mathbf {x} _ {i}, \mathbf {x} _ {j}), +$$ + +which is also equivalent to + +$$ +F (\mathbf {w}; \phi_ {c}, \phi_ {c} ^ {\prime}) = \min _ {s ^ {\prime} \in \mathbb {R}, \mathbf {s} \in \mathbb {R} ^ {n +}} s ^ {\prime} + \frac {1}{n + \alpha} \sum_ {\mathbf {x} _ {i} \in \mathcal {S} _ {+}} (s _ {i} + \frac {1}{\beta} \psi_ {i} (\mathbf {w}; s _ {i}) - s ^ {\prime}) _ {+}. +$$ + +# B.1. Proof of Lemma 6 + +It is easy to see if $\ell (\mathbf{w})\in [0,C]$ is bounded and smooth, we have $\exp (\frac{\ell(\mathbf{w})}{\lambda})$ is bounded and smooth due to its second order gradient is upper bounded. Then $\log \operatorname {E}_i\exp (\frac{\ell_i(\mathbf{w})}{\lambda})$ is bounded. Its smoothness due to that is a composition of $f = \log (\cdot)$ and $g = \mathrm{E}_i\exp (\frac{\ell_i(\mathbf{w})}{\lambda})\in [1,C']$ and both $f,g$ are smooth and Lipschitz continuous for their inputs. + +# B.2. Proof of Lemma 7 + +Proof. First, following Lemma 1, we have $F(\mathbf{w}; \phi, \phi')$ is equivalent to $\frac{1}{K_1} \sum_{i=1}^{K_1} \hat{L}_{\phi}(\mathbf{x}_{\pi_i}, \mathbf{w})$ , where $\pi_i$ denote the index of the positive example whose $\hat{L}_{\phi}(\mathbf{x}_{\pi_i}, \mathbf{w})$ is the $i$ -th largest among all positive examples. We prove that this is equivalent to $\frac{1}{K_1} \sum_{\mathbf{x}_i \in S_{+}^{\dagger}[1, K_1]} \hat{L}_{\phi}(\mathbf{x}_i, \mathbf{w})$ . To this end, we just need to show that if $h_{\mathbf{w}}(\mathbf{x}) \geq h_{\mathbf{w}}(\mathbf{x}')$ then $\hat{L}_{\phi}(\mathbf{x}', \mathbf{w}) \geq \hat{L}_{\phi}(\mathbf{x}, \mathbf{w})$ which is true due to $\hat{L}_{\phi}(\mathbf{x}_i, \mathbf{w}) = \frac{1}{K_2} \sum_{\mathbf{x}_j \in S_{-}^{\downarrow}[1, K_2]} \ell(h_{\mathbf{w}}(\mathbf{x}_i) - h_{\mathbf{w}}(\mathbf{x}_j))$ and $\ell$ is monotonically decreasing function. The second equation in the lemma is applying Lemma 5 twice and by noting that $(\min_x f(x) - s)_+ = \min_x (f(x) - s)_+$ . + +# B.3. Proof of Theorem 1 + +Proof. Let us consider for a particular $\mathbf{x}_i\in S_+$ . When $\phi (\cdot) = \phi_c(\cdot) = \mathbb{I}(\cdot \in (0,1 / \beta ])$ , then $\hat{L} (\mathbf{w};\mathbf{x}_i)$ becomes the CVaR estimator, i.e., the average of top $K = n_{-}\beta$ losses of $\ell (h_{\mathbf{w}}(\mathbf{x}_i) - h_{\mathbf{w}}(\mathbf{x}_j))$ among $\mathbf{x}_j\in S_{-}$ . Since $\ell (\cdot)$ is monotonically decreasing when $\ell (\cdot)) > 0$ , the top $K = n_{-}\beta$ losses of $\ell (h_{\mathbf{w}}(\mathbf{x}_i) - h_{\mathbf{w}}(\mathbf{x}_j))$ among all $\mathbf{x}_j\in S_{-}$ correspond to negative samples with top $K$ prediction scores. Hence, $\hat{L}_{\phi_c}(\mathbf{w};\mathbf{x}_i) = \frac{1}{K}\sum_{\mathbf{x}_j\in S_-^\downarrow [1,K]}\ell (h_{\mathbf{w}}(\mathbf{x}_i) - h_{\mathbf{w}}(\mathbf{x}_j))$ . Then the equivalent problem in (9) follows from Lemma 5. + +# B.4. Proof of Theorem 2 + +Proof. When choosing $\phi (\cdot) = \phi_{kl}(\cdot)$ , the $\hat{L}_{\phi}(\mathbf{w};\mathbf{x}_i)$ in problem (8) becomes + +$$ +\max _ {\mathbf {p} \in \Delta} \sum_ {\mathbf {x} _ {j} \in \mathcal {S} _ {-}} p _ {j} L (\mathbf {w}; \mathbf {x} _ {i}, \mathbf {x} _ {j}) - \lambda \sum_ {j} p _ {j} \log (n p _ {j}). +$$ + +With Karush-Kuhn-Tucker(KKT) conditions, it is not difficult to have $p_j^\star = \frac{\exp(L(\mathbf{w};\mathbf{x}_i,\mathbf{x}_j) / \lambda}{\sum_j\exp(L(\mathbf{w};\mathbf{x}_i,\mathbf{x}_j) / \lambda}$ . By plugging in this back we obtain the claimed objective (10). When $\lambda = 0$ , the above becomes the maximal one among $\{L(\mathbf{w};\mathbf{x}_i,\mathbf{x}_j),\mathbf{x}_j\in S_+\}$ for each $\mathbf{x}_i$ . Then the object is $\frac{1}{n_{+}}\max_{\mathbf{x}_j\in S_-}L(\mathbf{w};\mathbf{x}_i,\mathbf{x}_j)$ , which is the surrogate of pAUC with FPR $\leq 1 / n_{-}$ . When $\lambda = \infty$ , the above becomes the average of $\{L(\mathbf{w};\mathbf{x}_i,\mathbf{x}_j),\mathbf{x}_j\in S_+\}$ , which gives the standard surrogate of AUC. + +# B.5. Proof of Lemma 2 + +First note that $F(\mathbf{w},\mathbf{s}) = \frac{1}{n_{+}}\sum_{\mathbf{x}_{i}\in \mathcal{S}_{+}}\left(s_{i} + \frac{1}{\beta} g_{i}(\mathbf{w},s_{i})\right)$ , and $g_{i}(\mathbf{w},s_{i}) = \frac{1}{n_{-}}\sum_{\mathbf{x}_{j}\in \mathcal{S}_{-}}(L(\mathbf{w};\mathbf{x}_{i},\mathbf{x}_{j}) - s_{i})_{+}$ . We prove that $(L(\mathbf{w};\mathbf{x}_i,\mathbf{x}_j) - s_i)_+$ is weakly convex in terms of $(\mathbf{w},\mathbf{s}_i)$ , i.e. there exists $\rho >0$ such that $(L(\mathbf{w};\mathbf{x}_i,\mathbf{x}_j) - s_i)_+ + \frac{\rho}{2}\| \mathbf{w}\| ^2 +\frac{\rho}{2} s_i^2$ is jointly convex in terms of $\mathbf{w}$ , $\mathbf{s}$ . To this end, let $\psi (\cdot) = [\cdot ]_+$ which is convex and Lipschitz continuous, and $q(\mathbf{w},\mathbf{s}_i) = L(\mathbf{w};\mathbf{x}_i,\mathbf{x}_j) - s_i$ , which is $L_{s}$ -smooth function with respect to $(\mathbf{w},s_i)$ due to that $L(\mathbf{w};\mathbf{x}_i,\mathbf{x}_j)$ is $L_{s}$ -smooth + +function. Then for any $\omega \in \phi^{\prime}(\psi (\mathbf{w}^{\prime},s_{i}^{\prime}))$ we have + +$$ +\begin{array}{l} \psi (q (\mathbf {w}, s _ {i})) \geq \psi (q \left(\mathbf {w} ^ {\prime}, s _ {i} ^ {\prime}\right)) + \omega (q (\mathbf {w}, s _ {i}) - q \left(\mathbf {w} ^ {\prime}, s _ {i} ^ {\prime}\right)) \\ \geq \psi (q (\mathbf {w} ^ {\prime}, s _ {i} ^ {\prime})) + \omega (\nabla q (\mathbf {w} ^ {\prime}, s _ {i} ^ {\prime}) - \frac {L _ {s}}{2} (\| \mathbf {w} - \mathbf {w} ^ {\prime} \| ^ {2} + | s _ {i} - s _ {i} ^ {\prime} | ^ {2})) \\ \geq \psi (q (\mathbf {w} ^ {\prime}, s _ {i} ^ {\prime})) + \partial \psi (q (\mathbf {w} ^ {\prime}, s _ {i} ^ {\prime})) - \frac {L _ {s}}{2} (\| \mathbf {w} - \mathbf {w} ^ {\prime} \| ^ {2} + | s _ {i} - s _ {i} ^ {\prime} | ^ {2}) \\ \end{array} +$$ + +where we use $0 \leq \omega \leq 1$ . The above inequality implies that $[L(\mathbf{w}; \mathbf{x}_i, \mathbf{x}_j) - s_i]_+$ is $L_s$ -weakly convex in terms of $(\mathbf{w}, s_i)$ (Davis & Drusvyatskiy, 2018), i.e., $\frac{1}{n_-} \sum_{\mathbf{x}_j \in S_-} \left\{ (L(\mathbf{w}; \mathbf{x}_i, \mathbf{x}_j) - s_i)_+ + \frac{L_s}{2} (\| \mathbf{w} \|^2 + |s_i|^2) \right\}$ is convex. As a result $\frac{1}{n_-} \sum_{\mathbf{x}_j \in S_-} (L(\mathbf{w}; \mathbf{x}_i, \mathbf{x}_j) - s_i)_+ + \frac{L_s}{2} (\| \mathbf{w} \|^2 + |s_i|^2)$ is jointly convex in $(\mathbf{w}, s_i)$ . Then $F(\mathbf{w}, \mathbf{s}) + \frac{L_s}{2\beta} (\| \mathbf{w} \|^2 + \sum_i |s_i|^2)$ is jointly convex in terms of $(\mathbf{w}, \mathbf{s})$ . + +# B.6. Proof of Theorem 3 + +Let $F(\mathbf{w}, \mathbf{s})$ denote the objective function, and let $\mathbf{v} = (\mathbf{w}, \mathbf{s})$ . Define $F_{1 / \hat{\rho}}(\mathbf{v}) = \min_{\mathbf{u}} F(\mathbf{u}) + \frac{\hat{\rho}}{2} \| \mathbf{u} - \mathbf{v} \|^2$ for some $\hat{\rho} > \rho$ and the minimizer is denoted by $\mathrm{prox}_{F / \hat{\rho}}(\mathbf{v})$ . Let $\widehat{\mathbf{v}}_t = \mathrm{prox}_{F / \hat{\rho}}(\mathbf{v}_t)$ . Define $\| \mathbf{v} - \mathbf{v}' \|^2 = \| \mathbf{w} - \mathbf{w}' \|^2 + \| \mathbf{s} - \mathbf{s}' \|^2$ . + +$$ +\begin{array}{l} \mathrm {E} _ {t} \left[ F _ {1 / \hat {\rho}} \left(\mathbf {v} _ {t + 1}\right) \right] = \mathrm {E} _ {t} \left[ F \left(\widehat {\mathbf {v}} _ {t}\right) + \frac {\hat {\rho}}{2} \| \mathbf {v} _ {t + 1} - \widehat {\mathbf {v}} _ {t} \| ^ {2} \right] \\ \leq F (\widehat {\mathbf {v}} _ {t}) + \frac {\hat {\rho}}{2} \mathrm {E} _ {t} [ \| \mathbf {w} _ {t} - \eta_ {1} \nabla_ {\mathbf {w}} F (\mathbf {w} _ {t}, \mathbf {s} _ {t}, \xi_ {t}) - \widehat {\mathbf {w}} _ {t} \| ^ {2} + \| \mathbf {s} _ {t + 1} - \widehat {\mathbf {s}} _ {t} \| ^ {2} ] \\ \leq F (\widehat {\mathbf {v}} _ {t}) + \frac {\hat {\rho}}{2} \mathrm {E} _ {t} [ \| \mathbf {w} _ {t} - \eta_ {1} \nabla_ {\mathbf {w}} F (\mathbf {w} _ {t}, \mathbf {s} _ {t}, \boldsymbol {\xi} _ {t}) - \widehat {\mathbf {w}} _ {t} \| ^ {2} ] + \frac {\hat {\rho}}{2} \mathrm {E} _ {t} [ \| \mathbf {s} _ {t + 1} - \widehat {\mathbf {s}} _ {t} \| ^ {2} ] \\ \leq F (\widehat {\mathbf {x}} _ {t}) + \frac {\hat {\rho}}{2} \| \mathbf {w} _ {t} - \widehat {\mathbf {w}} _ {t} \| ^ {2} + \hat {\rho} \eta_ {t} \mathrm {E} _ {t} [ (\widehat {\mathbf {w}} _ {t} - \mathbf {w} _ {t}) ^ {\top} \nabla_ {\mathbf {w}} F (\mathbf {w} _ {t}, \mathbf {s} _ {t}) ] + \frac {\hat {\rho} \eta_ {1} ^ {2} G ^ {2}}{2} + \frac {\hat {\rho}}{2} \mathrm {E} _ {t} [ \| \mathbf {s} _ {t + 1} - \widehat {\mathbf {s}} _ {t} \| ^ {2} ] \\ \end{array} +$$ + +where we assume $\operatorname{E}[\|\nabla_{\mathbf{w}}F(\mathbf{w}_t,\mathbf{s}_t,\xi_t)\|^2] \leq G^2 = \frac{C^2}{\beta^2}$ . According to the analysis of stochastic coordinate descent method, for any $\mathbf{s} = (s_1,\dots,s_{n_+})$ we have + +$$ +2 \eta_ {2} (s _ {t, i} - s _ {i}) ^ {\top} \nabla_ {s _ {i}} F (\mathbf {w} _ {t}, \mathbf {s} _ {t}; \xi_ {t}) \leq \eta_ {2} ^ {2} \| \nabla_ {s _ {i}} F (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}) \| ^ {2} + (\| s _ {i} - s _ {t, i} \| ^ {2} - \| s _ {i} - s _ {t + 1, i} \| ^ {2}) +$$ + +Summing the above inequality over $i\in \mathcal{B}_{+}$ , we have + +$$ +2 \eta_ {2} \sum_ {i \in \mathcal {B} _ {+}} (s _ {t, i} - s _ {i}) ^ {\top} \nabla_ {s _ {i}} F (\mathbf {w} _ {t}, \mathbf {s} _ {t}; \xi_ {t}) \leq \eta_ {2} ^ {2} \sum_ {i \in \mathcal {B} _ {+}} \| \nabla_ {s _ {i}} F (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}) \| ^ {2} + (\| \mathbf {s} - \mathbf {s} _ {t} \| ^ {2} - \| \mathbf {s} - \mathbf {s} _ {t + 1} \| ^ {2}) +$$ + +Taking expectation and re-arrange, we have + +$$ +\operatorname {E} [ \frac {1}{2} \| \mathbf {s} _ {t + 1} - \widehat {\mathbf {s}} _ {t} \| ^ {2} ] \leq \operatorname {E} [ \frac {1}{2} \| \mathbf {s} _ {t} - \widehat {\mathbf {s}} _ {t} \| ^ {2} + \eta_ {2} \frac {B _ {+}}{n _ {+}} (\widehat {\mathbf {s}} _ {t} - \mathbf {s} _ {t}) ^ {\top} \nabla_ {\mathbf {s}} F (\mathbf {w} _ {t}, \mathbf {s} _ {t}) + \frac {\eta_ {2} ^ {2} B _ {+} C _ {2} ^ {2}}{2} ] +$$ + +where we use the fact $\operatorname{E}[|\nabla_{s_i}F(\mathbf{w},\mathbf{s})|^2] \leq C_2^2 = \frac{1}{n_+^2} (1 + 1 / \beta)^2$ . Let $\eta_{2}B_{+} / n_{+} = \eta_{1}$ , we have + +$$ +\begin{array}{l} \mathbf {E} _ {t} [ F _ {1 / \hat {\rho}} (\mathbf {v} _ {t + 1}) ] \\ \leq F (\widehat {\mathbf {x}} _ {t}) + \frac {\hat {\rho}}{2} \| \mathbf {w} _ {t} - \widehat {\mathbf {w}} _ {t} \| ^ {2} + \hat {\rho} \eta_ {1} \mathrm {E} _ {t} [ (\widehat {\mathbf {w}} _ {t} - \mathbf {w} _ {t}) ^ {\top} \nabla_ {\mathbf {w}} F (\mathbf {w} _ {t}, \mathbf {s} _ {t}) ] + \frac {\hat {\rho}}{2} \mathrm {E} _ {t} [ \| \mathbf {s} _ {t + 1} - \widehat {\mathbf {s}} _ {t}) ] + \frac {\hat {\rho} \eta_ {1} ^ {2} G ^ {2}}{2} \\ \leq F (\widehat {\mathbf {v}} _ {t}) + \frac {\hat {\rho}}{2} \| \mathbf {v} _ {t} - \widehat {\mathbf {v}} _ {t} \| ^ {2} + \hat {\rho} \eta_ {1} \mathrm {E} _ {t} [ (\widehat {\mathbf {v}} _ {t} - \mathbf {v} _ {t}) ^ {\top} \partial F (\mathbf {w} _ {t}, \mathbf {s} _ {t}) ] + \frac {\hat {\rho} \eta_ {1} ^ {2} (G ^ {2} + n _ {+} ^ {2} C _ {2} ^ {2} / B _ {+})}{2} \\ \leq F _ {1 / \hat {\rho}} (\mathbf {v} _ {t}) + \hat {\rho} \eta_ {1} (F (\widehat {\mathbf {v}} _ {t}) - F (\mathbf {v} _ {t}) + \frac {\rho}{2} \| \mathbf {v} _ {t} - \widehat {\mathbf {v}} _ {t} \| ^ {2}) + \frac {\hat {\rho} \eta_ {1} ^ {2} (G ^ {2} + n _ {+} ^ {2} C _ {2} ^ {2} / B _ {+})}{2} \\ \end{array} +$$ + +As a result, we have + +$$ +\hat {\rho} \eta_ {1} (F (\mathbf {v} _ {t}) - F (\widehat {\mathbf {v}} _ {t}) - \rho \| \mathbf {v} _ {t} - \widehat {\mathbf {v}} _ {t} \| ^ {2}) \leq F _ {1 / \hat {\rho}} (\mathbf {v} _ {t}) - \mathrm {E} _ {t} [ F _ {1 / \hat {\rho}} (\mathbf {v} _ {t + 1}) ] + \frac {\hat {\rho} \eta_ {1} ^ {2} (G ^ {2} + n _ {+} ^ {2} C _ {2} ^ {2} / B _ {+})}{2} +$$ + +Since we have + +$$ +\begin{array}{l} F (\mathbf {v} _ {t}) - F (\widehat {\mathbf {v}} _ {t}) - \rho \| \mathbf {v} _ {t} - \widehat {\mathbf {v}} _ {t} \| ^ {2} = (F (\mathbf {v} _ {t}) + \widehat {\rho} \| \mathbf {v} _ {t} - \mathbf {v} _ {t} \| ^ {2}) - (F (\widehat {\mathbf {v}} _ {t}) + \widehat {\rho} \| \widehat {\mathbf {v}} _ {t} - \mathbf {v} _ {t} \| ^ {2}) + (\widehat {\rho} - \rho) \| \mathbf {v} _ {t} - \widehat {\mathbf {v}} _ {t} \| ^ {2} \\ \geq \frac {(2 \hat {\rho} - \rho)}{2} \| \widehat {\mathbf {v}} _ {t} - \mathbf {v} _ {t} \| ^ {2} + (\hat {\rho} - \rho) \| \mathbf {v} _ {t} - \widehat {\mathbf {v}} _ {t} \| ^ {2} = (2 \hat {\rho} - 3 / 2 \rho) \| \mathbf {v} _ {t} - \widehat {\mathbf {v}} _ {t} \| ^ {2} = \frac {(2 \hat {\rho} - 3 / 2 \rho)}{\hat {\rho} ^ {2}} \| \nabla F _ {1 / \hat {\rho}} (\mathbf {v} _ {t}) \| ^ {2} \\ \end{array} +$$ + +Let $\hat{\rho} = 3\rho /2$ . As a result, we have + +$$ +\begin{array}{l} \frac {1}{T} \sum_ {t = 1} ^ {T} \| \nabla F _ {1 / \hat {\rho}} (\mathbf {v} _ {t}) \| ^ {2} \leq \frac {(F _ {1 / \hat {\rho}} (\mathbf {v} _ {1}) - \min F)}{\eta_ {1} T} + \frac {\hat {\rho} \eta_ {1} (G ^ {2} + n _ {+} ^ {2} C _ {2} ^ {2} / B _ {+})}{2} \\ \leq \frac {(F _ {1 / \hat {\rho}} (\mathbf {v} _ {1}) - \min F)}{\eta_ {1} T} + \frac {\hat {\rho} \eta_ {1} (C ^ {2} / \beta^ {2} + (1 + 1 / \beta) ^ {2} / B _ {+})}{2} \\ \end{array} +$$ + +By setting $\eta_{1} = O(\beta \epsilon^{2})$ and $T = O\left(\frac{1}{\epsilon^2\eta_1}\right) = O(1 / (\beta \epsilon^4))$ we have $\operatorname {E}[\| \nabla F_{1 / \hat{\rho}}(\mathbf{v}_{\tau})\| ^2 ]\leq \epsilon^2$ for a randomly selected $\tau \in [T]$ . + +# B.7. Proof of Theorem 4 + +Note that the SOPA-s algorithm is just a special case of the SOX algorithm (Wang & Yang, 2022) for the more general problem $\min_{\mathbf{w}} \frac{1}{n} \sum_{\mathbf{z}_i \in \mathcal{D}} f_i(g_i(\mathbf{w}))$ and the convergence proof just follows the proof of Theorem 1 in Wang & Yang (2022). + +# B.8. Proof of Theorem 5 + +We consider the following problem: + +$$ +\min _ {\mathbf {w}} F (\mathbf {w}), \quad F (\mathbf {w}) = f _ {1} \left(\frac {1}{n} \sum_ {i \in \mathcal {S}} f _ {2} \left(g _ {i} (\mathbf {w})\right)\right). \tag {12} +$$ + +Lemma 8. If $g_i$ is $C_g$ -Lipschitz, $L_g$ -smooth and $f_1, f_2$ are $C_f$ -Lipschitz, $L_g$ -smooth, $F$ in (12) is $L_F$ -smooth and $L_F = L_f C_f^2 C_g^2 + C_f^2 L_g + C_f C_g L_f$ . + +Proof. Based on the definition of $F$ , we have + +$$ +\begin{array}{l} \| \nabla F (\mathbf {w}) - \nabla F (\mathbf {w} ^ {\prime}) \| \\ = \left\| \nabla f _ {1} \left(\frac {1}{n} \sum_ {i \in S} f _ {2} \left(g _ {i} (\mathbf {w})\right)\right) \left(\frac {1}{n} \sum_ {i \in S} \nabla f _ {2} \left(g _ {i} (\mathbf {w})\right) \nabla g _ {i} (\mathbf {w})\right) \right. \\ \left. - \nabla f _ {1} \left(\frac {1}{n} \sum_ {i \in \mathcal {S}} f _ {2} \left(g _ {i} \left(\mathbf {w} ^ {\prime}\right)\right)\right) \left(\frac {1}{n} \sum_ {i \in \mathcal {S}} \nabla f _ {2} \left(g _ {i} \left(\mathbf {w} ^ {\prime}\right)\right) \nabla g _ {i} \left(\mathbf {w} ^ {\prime}\right)\right) \right\| \\ \leq L _ {f} \left\| \frac {1}{n} \sum_ {i \in \mathcal {S}} \nabla f _ {2} \left(g _ {i} (\mathbf {w})\right) \nabla g _ {i} (\mathbf {w}) \right\| \left\| \frac {1}{n} \sum_ {i \in \mathcal {S}} \left(f _ {2} \left(g _ {i} (\mathbf {w})\right) - f _ {2} \left(g _ {i} \left(\mathbf {w} ^ {\prime}\right)\right)\right) \right\| \\ + \left\| \nabla f _ {1} \left(\frac {1}{n} \sum_ {i \in \mathcal {S}} f _ {2} \left(g _ {i} \left(\mathbf {w} ^ {\prime}\right)\right)\right) \right\| \left\| \frac {1}{n} \sum_ {i \in \mathcal {S}} \left(\nabla f _ {2} \left(g _ {i} (\mathbf {w})\right) \nabla g _ {i} (\mathbf {w}) - \nabla f _ {2} \left(g _ {i} \left(\mathbf {w} ^ {\prime}\right)\right) \nabla g _ {i} \left(\mathbf {w} ^ {\prime}\right)\right) \right\|. \\ \end{array} +$$ + +We can show that $\left\| \frac{1}{n}\sum_{i\in S}(\nabla f_2(g_i(\mathbf{w}))\nabla g_i(\mathbf{w}) - \nabla f_2(g_i(\mathbf{w}'))\nabla g_i(\mathbf{w}'))\right\| \leq (C_fL_g + CgL_f)\| \mathbf{w} - \mathbf{w}'\|$ . Thus, + +$$ +\begin{array}{l} \left\| \nabla F (\mathbf {w}) - \nabla F \left(\mathbf {w} ^ {\prime}\right) \right\| \leq L _ {f} C _ {f} ^ {2} C _ {g} ^ {2} \left\| \mathbf {w} - \mathbf {w} ^ {\prime} \right\| + C _ {f} \left(C _ {f} L _ {g} + C _ {g} L _ {f}\right) \left\| \mathbf {w} - \mathbf {w} ^ {\prime} \right\| \\ = \left(L _ {f} C _ {f} ^ {2} C _ {g} ^ {2} + C _ {f} ^ {2} L _ {g} + C _ {f} C _ {g} L _ {f}\right) \left\| \mathbf {w} - \mathbf {w} ^ {\prime} \right\|. \\ \end{array} +$$ + +We propose SOTA-s to solve (12). + +![](images/4d6fb6ff69fc0024c273e4fe079c08d2f78621202c9112869fc580a58c477c24.jpg) + +Lemma 9. Consider a sequence $\mathbf{w}_{t + 1} = \mathbf{w}_t - \eta \mathbf{m}_t$ and the $L_{F}$ -smooth function $F$ and the step size $\eta L_{F} \leq 1 / 2$ . + +$$ +F \left(\mathbf {w} _ {t + 1}\right) \leq F \left(\mathbf {w} _ {t}\right) + \frac {\eta}{2} \left\| \Delta_ {t} \right\| ^ {2} - \frac {\eta}{2} \left\| \nabla F \left(\mathbf {w} _ {t}\right) \right\| ^ {2} - \frac {\eta}{4} \left\| \mathbf {m} _ {t} \right\| ^ {2}, \tag {13} +$$ + +where $\Delta_t \coloneqq \mathbf{m}_t - \nabla F(\mathbf{w}_t)$ + +Lemma 10. For the gradient estimator $\mathbf{m}_t$ in SOTA- $s$ and $\Delta_t = \mathbf{m}_t - \nabla F(\mathbf{w}_t)$ , + +$$ +\begin{array}{l} \operatorname {E} \left[ \| \Delta_ {t + 1} \| ^ {2} \right] \leq (1 - \gamma_ {2}) \operatorname {E} \left[ \| \Delta_ {t} \| ^ {2} \right] + \frac {2 L _ {F} ^ {2} \eta^ {2}}{\gamma_ {2}} \operatorname {E} \left[ \| \mathbf {m} _ {t} \| ^ {2} \right] + 1 0 \gamma_ {2} C _ {f} ^ {2} C _ {1} ^ {2} L _ {f} ^ {2} \operatorname {E} \left[ \| \Psi_ {t + 1} \| ^ {2} \right] \\ + 2 0 \gamma_ {2} C _ {f} ^ {2} L _ {f} ^ {2} C _ {1} ^ {2} \mathrm {E} \left[ \frac {1}{n} \| \Xi_ {t + 1} \| ^ {2} \right] + 2 0 \gamma_ {2} C _ {f} ^ {2} L _ {f} ^ {2} C _ {1} ^ {2} \mathrm {E} \left[ \frac {1}{n} \| \mathbf {u} _ {t + 1} - \mathbf {u} _ {t} \| ^ {2} \right] + 2 \gamma_ {2} ^ {2} C _ {f} ^ {4} \left(\frac {\zeta^ {2}}{B _ {-}} + \frac {C _ {g} ^ {2}}{B _ {+}}\right), \tag {14} \\ \end{array} +$$ + +where we denote $\Delta_t \coloneqq \mathbf{m}_{t+1} - \nabla F(\mathbf{w}_t)$ , $\Xi_t \coloneqq \mathbf{u}_{t+1} - \mathbf{g}(\mathbf{w}_t)$ and $\Psi_t \coloneqq v_{t+1} - \frac{1}{n}\sum_{i\in S}f_2(g_i(\mathbf{w}_t))$ . + +Proof. Based on the update rule $\mathbf{m}_{t + 1} = (1 - \gamma_2)\mathbf{m}_t + \gamma_2G(\mathbf{w}_{t + 1})$ , we have + +$$ +\begin{array}{l} \left\| \mathbf {m} _ {t + 1} - \nabla F (\mathbf {w} _ {t + 1}) \right\| ^ {2} \\ = \left\| (1 - \gamma_ {2}) \mathbf {m} _ {t} + \gamma_ {2} \frac {1}{B _ {+}} \sum_ {i \in B _ {+}} \nabla f _ {1} \left(v _ {t + 1}\right) \nabla f _ {2} \left(u _ {t} ^ {i}\right) \nabla g _ {i} \left(\mathbf {w} _ {t + 1}; B _ {-}\right) - \nabla F (\mathbf {w} _ {t + 1}) \right\| ^ {2} \\ = \left\| \underbrace {(1 - \gamma_ {2}) (\mathbf {m} _ {t} - \nabla F (\mathbf {w} _ {t}))} _ {\text {a}} + \underbrace {(1 - \gamma_ {2}) (\nabla F (\mathbf {w} _ {t}) - \nabla F (\mathbf {w} _ {t + 1}))} _ {\text {b}} + \gamma_ {2} \frac {1}{B _ {+}} \sum_ {i \in B _ {+}} \nabla f _ {1} (v _ {t + 1}) \nabla f _ {2} (u _ {t} ^ {i}) \nabla g _ {i} (\mathbf {w} _ {t + 1}; \mathcal {B} _ {-}) \right. \\ - \gamma_ {2} \frac {1}{B _ {+}} \sum_ {i \in \mathcal {B} _ {+}} \nabla f _ {1} \left(\frac {1}{n} \sum_ {i \in \mathcal {S}} f _ {2} (g _ {i} (\mathbf {w} _ {t + 1}))\right) \nabla f _ {2} (g _ {i} (\mathbf {w} _ {t + 1})) \nabla g _ {i} (\mathbf {w} _ {t + 1}; \mathcal {B} _ {-}) \\ + \underbrace {\gamma_ {2} \left(\frac {1}{B _ {+}} \sum_ {i \in \mathcal {B} _ {+}} \nabla f _ {1} \left(\frac {1}{n} \sum_ {i \in \mathcal {S}} f _ {2} (g _ {i} (\mathbf {w} _ {t + 1}))\right) \nabla f _ {2} (g _ {i} (\mathbf {w} _ {t + 1})) \nabla g _ {i} (\mathbf {w} _ {t + 1} ; \mathcal {B} _ {-}) - \nabla F (\mathbf {w} _ {t + 1})\right)} _ {\text {①}} ^ {2}. \\ \end{array} +$$ + +We define that + +$$ +\begin{array}{l} \circledcirc := \gamma_ {2} \left(\frac {1}{B _ {+}} \sum_ {i \in \mathcal {B} _ {+}} \nabla f _ {1} (v _ {t + 1}) \nabla f _ {2} (u _ {t} ^ {i}) \nabla g _ {i} (\mathbf {w} _ {t + 1}; \mathcal {B} _ {-}) \right. \\ \left. - \frac {1}{B _ {+}} \sum_ {i \in \mathcal {B} _ {+}} \nabla f _ {1} \left(\frac {1}{n} \sum_ {i \in \mathcal {S}} f _ {2} \left(g _ {i} \left(\mathbf {w} _ {t + 1}\right)\right)\right) \nabla f _ {2} \left(g _ {i} \left(\mathbf {w} _ {t + 1}\right)\right) \nabla g _ {i} \left(\mathbf {w} _ {t + 1}; \mathcal {B} _ {-}\right)\right). \\ \end{array} +$$ + +We define that $\Delta_t \coloneqq \mathbf{m}_t - \nabla F(\mathbf{w}_t)$ . Note that $\operatorname{E}[\langle \widehat{\mathsf{a}}, \widehat{\mathsf{d}} \rangle] = \operatorname{E}[\langle \widehat{\mathsf{b}}, \widehat{\mathsf{d}} \rangle] = 0$ . Then, + +$$ +\begin{array}{l} \mathrm {E} _ {t} \left[ \| \widehat {\mathbf {a}} + \widehat {\mathbf {b}} + \widehat {\mathbf {c}} + \widehat {\mathbf {d}} \| ^ {2} \right] = \| \widehat {\mathbf {a}} \| ^ {2} + \| \widehat {\mathbf {b}} \| ^ {2} + \mathrm {E} _ {t} \left[ \| \widehat {\mathbf {c}} \| ^ {2} \right] + \mathrm {E} _ {t} \left[ \| \widehat {\mathbf {d}} \| ^ {2} \right] + 2 \langle \widehat {\mathbf {a}}, \widehat {\mathbf {b}} \rangle \\ + 2 \mathrm {E} _ {t} [ \langle \widehat {\mathbf {a}}, \widehat {\mathbf {c}} \rangle ] + 2 \mathrm {E} _ {t} [ \langle \widehat {\mathbf {b}}, \widehat {\mathbf {c}} \rangle ] + 2 \mathrm {E} _ {t} [ \langle \widehat {\mathbf {c}}, \widehat {\mathbf {d}} \rangle ]. \\ \end{array} +$$ + +Based on the Young's inequality for products, we have $2\langle \mathbf{a},\mathbf{b}\rangle \leq \frac{\|\mathbf{a}\|^2c}{2} +\frac{2\|\mathbf{b}\|^2}{c}$ for $c > 0$ + +$$ +\begin{array}{l} \mathrm {E} _ {t} \left[ \| \widehat {\mathsf {a}} + \widehat {\mathsf {b}} + \widehat {\mathsf {c}} + \widehat {\mathsf {d}} \| ^ {2} \right] \\ \leq \left(1 + \gamma_ {2}\right) \| \mathfrak {a} \| ^ {2} + 2 \left(1 + 1 / \gamma_ {2}\right) \| \mathfrak {b} \| ^ {2} + \frac {2 + 3 \gamma_ {2}}{\gamma_ {2}} \mathrm {E} _ {t} \left[ \| \mathfrak {c} \| ^ {2} \right] + 2 \mathrm {E} _ {t} \left[ \| \mathfrak {d} \| ^ {2} \right]. \\ \end{array} +$$ + +Thus, we have + +$$ +\mathrm {E} _ {t} \left[ \| \Delta_ {t + 1} \| ^ {2} \right] \leq \left(1 - \gamma_ {2}\right) \| \Delta_ {t} \| ^ {2} + \frac {2 \left(1 + \gamma_ {2}\right)}{\gamma_ {2}} \| \widehat {\mathfrak {b}} \| ^ {2} + \frac {5}{\gamma_ {2}} \mathrm {E} _ {t} \left[ \| \widehat {\mathfrak {c}} \| ^ {2} \right] + 2 \mathrm {E} _ {t} \left[ \| \widehat {\mathfrak {d}} \| ^ {2} \right]. \tag {15} +$$ + +Moreover, we have + +$$ +\left\| \widehat {⑥} \right\| ^ {2} = \left(1 - \gamma_ {2}\right) ^ {2} \left\| \nabla F \left(\mathbf {w} _ {t}\right) - \nabla F \left(\mathbf {w} _ {t + 1}\right) \right\| ^ {2} \leq \left(1 - \gamma_ {2}\right) ^ {2} \eta^ {2} L _ {F} ^ {2} \left\| \mathbf {m} _ {t} \right\| ^ {2}. \tag {16} +$$ + +On the other hand, + +$$ +\begin{array}{l} \| \odot \| ^ {2} \leq \frac {2 \gamma_ {2} ^ {2}}{B _ {+}} \sum_ {i \in \mathcal {B} _ {+}} \| \nabla g _ {i} (\mathbf {w} _ {t + 1}; \mathcal {B} _ {-}) \| ^ {2} \left\| \nabla f _ {1} (v _ {t + 1}) - \nabla f _ {1} \left(\frac {1}{n} \sum_ {i \in \mathcal {S}} f _ {2} (g _ {i} (\mathbf {w} _ {t + 1}))\right) \right\| ^ {2} \| \nabla f _ {2} (u _ {t} ^ {i}) \| ^ {2} \\ + \frac {2 \gamma_ {2} ^ {2}}{B _ {+}} \sum_ {i \in \mathcal {B} _ {+}} \| \nabla g _ {i} (\mathbf {w} _ {t + 1}; \mathcal {B} _ {-}) \| ^ {2} \left\| \nabla f _ {1} \left(\frac {1}{n} \sum_ {i \in \mathcal {S}} f _ {2} (g _ {i} (\mathbf {w} _ {t + 1}))\right) \right\| ^ {2} \| \nabla f _ {2} (u _ {t} ^ {i}) - \nabla f _ {2} (g _ {i} (\mathbf {w} _ {t + 1})) \| ^ {2} \\ \leq \frac {2 \gamma_ {2} ^ {2} L _ {f} ^ {2} C _ {f} ^ {2}}{B _ {+}} \sum_ {i \in \mathcal {B} _ {+}} \| \nabla g _ {i} (\mathbf {w} _ {t + 1}; \mathcal {B} _ {-}) \| ^ {2} \left\| v _ {t + 1} - \frac {1}{n} \sum_ {i \in \mathcal {S}} f _ {2} (g _ {i} (\mathbf {w} _ {t + 1})) \right\| ^ {2} \\ + \frac {2 \gamma_ {2} ^ {2} L _ {f} ^ {2} C _ {f} ^ {2}}{B _ {+}} \sum_ {i \in B _ {+}} \| \nabla g _ {i} (\mathbf {w} _ {t + 1}; \mathcal {B} _ {-}) \| ^ {2} \left\| u _ {t} ^ {i} - g _ {i} (\mathbf {w} _ {t + 1}) \right\| ^ {2} \\ \end{array} +$$ + +Due to $\operatorname{E}_{\mathcal{B}_-}\left[\|\nabla g_i(\mathbf{w}_{t+1};\mathcal{B}_-)\|^2\right] \leq C_g^2 + \zeta^2/\mathcal{B}_- \coloneqq C_1^2$ , we have + +$$ +\mathrm {E} _ {t} \left[ \| \odot \| ^ {2} \right] \leq \frac {2 \gamma_ {2} ^ {2} L _ {f} ^ {2} C _ {f} ^ {2} C _ {1} ^ {2}}{n} \sum_ {i \in \mathcal {S}} \mathrm {E} _ {t} \left[ \left\| v _ {t + 1} - \frac {1}{n} \sum_ {i \in \mathcal {S}} f _ {2} (g _ {i} (\mathbf {w} _ {t + 1})) \right\| ^ {2} + \left\| u _ {t} ^ {i} - g _ {i} (\mathbf {w} _ {t + 1}) \right\| ^ {2} \right] +$$ + +Besides, we also have + +$$ +\begin{array}{l} \mathrm {E} _ {t} \left[ \| \mathfrak {d} \| ^ {2} \right] \\ \leq \gamma_ {2} ^ {2} \mathrm {E} _ {t} \left[ \left\| \frac {1}{B _ {+}} \sum_ {i \in \mathcal {B} _ {+}} \nabla f _ {1} \left(\frac {1}{n} \sum_ {i \in \mathcal {S}} f _ {2} (g _ {i} (\mathbf {w} _ {t + 1}))\right) \nabla f _ {2} (g _ {i} (\mathbf {w} _ {t + 1})) \nabla g _ {i} (\mathbf {w} _ {t + 1}; \mathcal {B} _ {-}) - \nabla F (\mathbf {w} _ {t + 1}) \right\| ^ {2} \right] \\ = \gamma_ {2} ^ {2} C _ {f} ^ {2} \mathrm {E} _ {t} \left[ \left\| \frac {1}{B _ {+}} \sum_ {i \in \mathcal {B} _ {+}} (\nabla f _ {2} (g _ {i} (\mathbf {w} _ {t + 1})) \nabla g _ {i} (\mathbf {w} _ {t + 1}; \mathcal {B} _ {-}) - \nabla f _ {2} (g _ {i} (\mathbf {w} _ {t + 1})) \nabla g _ {i} (\mathbf {w} _ {t + 1})) \right\| ^ {2} \right] \\ + \gamma_ {2} ^ {2} C _ {f} ^ {2} \mathrm {E} _ {t} \left[ \left\| \frac {1}{B _ {+}} \sum_ {i \in \mathcal {B} _ {+}} \nabla f _ {2} \left(g _ {i} \left(\mathbf {w} _ {t + 1}\right)\right) \nabla g _ {i} \left(\mathbf {w} _ {t + 1}; \mathcal {B} _ {-}\right) - \frac {1}{n} \sum_ {i \in \mathcal {S}} \nabla f _ {2} \left(g _ {i} \left(\mathbf {w} _ {t + 1}\right)\right) \nabla g _ {i} \left(\mathbf {w} _ {t + 1}; \mathcal {B} _ {-}\right) \right\| ^ {2} \right] \\ \leq \frac {\gamma_ {2} ^ {2} C _ {f} ^ {4} \zeta^ {2}}{B _ {-}} + \frac {\gamma_ {2} ^ {2} C _ {f} ^ {4} C _ {g} ^ {2}}{B _ {+}}. \tag {17} \\ \end{array} +$$ + +Then, + +$$ +\begin{array}{l} \operatorname {E} \left[ \| \Delta_ {t + 1} \| ^ {2} \right] \leq (1 - \gamma_ {2}) \operatorname {E} \left[ \| \Delta_ {t} \| ^ {2} \right] + \frac {2 L _ {F} ^ {2} \eta^ {2}}{\gamma_ {2}} \operatorname {E} \left[ \| \mathbf {m} _ {t} \| ^ {2} \right] + 1 0 \gamma_ {2} C _ {f} ^ {2} C _ {1} ^ {2} L _ {f} ^ {2} \operatorname {E} \left[ \| \Psi_ {t + 1} \| ^ {2} \right] \\ + 2 0 \gamma_ {2} C _ {f} ^ {2} L _ {f} ^ {2} C _ {1} ^ {2} \mathrm {E} \left[ \frac {1}{n} \| \boldsymbol {\Xi} _ {t + 1} \| ^ {2} \right] + 2 0 \gamma_ {2} C _ {f} ^ {2} L _ {f} ^ {2} C _ {1} ^ {2} \mathrm {E} \left[ \frac {1}{n} \| \mathbf {u} _ {t + 1} - \mathbf {u} _ {t} \| ^ {2} \right] + 2 \gamma_ {2} ^ {2} C _ {f} ^ {4} \left(\frac {\zeta^ {2}}{B _ {-}} + \frac {C _ {g} ^ {2}}{B _ {+}}\right), \\ \end{array} +$$ + +where we denote $\Xi_t \coloneqq \mathbf{u}_t - \mathbf{g}(\mathbf{w}_t)$ and $\Psi_t \coloneqq v_t - \frac{1}{n}\sum_{i\in S}f_2(g_i(\mathbf{w}_t))$ + +Lemma 11. For the function value estimator $v_{t + 1}$ in SOTA-s and $\Psi_t \coloneqq v_t - \frac{1}{n}\sum_{i\in S}f_2(g_i(\mathbf{w}_t))$ , + +$$ +\begin{array}{l} \mathrm {E} _ {t} \left[ \| \Psi_ {t + 1} \| ^ {2} \right] \leq (1 - \gamma_ {1}) \| \Psi_ {t} \| ^ {2} + \frac {2 C _ {f} ^ {2} C _ {g} ^ {2} \eta^ {2}}{\gamma_ {1}} \| \mathbf {m} _ {t} \| ^ {2} + 5 \gamma_ {1} C _ {f} ^ {2} \mathrm {E} _ {t} \left[ \frac {1}{n} \| \Xi_ {t + 1} \| ^ {2} \right] \tag {18} \\ + \frac {1 0 \gamma_ {1} C _ {f} ^ {2}}{n} \mathrm {E} _ {t} \left[ \left\| \mathbf {u} _ {t} - \mathbf {u} _ {t + 1} \right\| ^ {2} \right] + \frac {2 \gamma_ {1} ^ {2} C _ {f} ^ {2}}{B _ {+}}. \\ \end{array} +$$ + +Proof. According to the update of $v$ in SOTA-s, we have + +$$ +\begin{array}{l} \left\| v _ {t + 1} - \frac {1}{n} \sum_ {i \in \mathcal {S}} f _ {2} (g _ {i} (\mathbf {w} _ {t + 1})) \right\| ^ {2} = \left\| (1 - \gamma_ {1}) v _ {t} + \gamma_ {1} \frac {1}{B _ {+}} \sum_ {i \in \mathcal {B} _ {+}} f _ {2} (u _ {t} ^ {i}) - \frac {1}{n} \sum_ {i \in \mathcal {S}} f _ {2} (g _ {i} (\mathbf {w} _ {t + 1})) \right\| ^ {2} \\ = \left\| \left(1 - \gamma_ {1}\right) \left(v _ {t} - \frac {1}{n} \sum_ {i \in \mathcal {S}} f _ {2} \left(g _ {i} \left(\mathbf {w} _ {t}\right)\right)\right) + \left(1 - \gamma_ {1}\right) \left(\frac {1}{n} \sum_ {i \in \mathcal {S}} \left(f _ {2} \left(g _ {i} \left(\mathbf {w} _ {t}\right)\right) - f _ {2} \left(g _ {i} \left(\mathbf {w} _ {t + 1}\right)\right)\right)\right) \right. \\ + \gamma_ {1} \left(\frac {1}{B _ {+}} \sum_ {i \in \mathcal {B} _ {+}} f _ {2} (u _ {t} ^ {i}) - \frac {1}{B _ {+}} \sum_ {i \in \mathcal {B} _ {+}} f _ {2} (g _ {i} (\mathbf {w} _ {t + 1}))\right) + \gamma_ {1} \left(\frac {1}{B _ {+}} \sum_ {i \in \mathcal {B} _ {+}} f _ {2} (g _ {i} (\mathbf {w} _ {t + 1})) - \frac {1}{n} \sum_ {i \in \mathcal {S}} f _ {2} (g _ {i} (\mathbf {w} _ {t + 1}))\right) \| ^ {2}. \\ \end{array} +$$ + +Denoting $\Psi_t \coloneqq \left\| v_t - \frac{1}{n} \sum_{i \in S} f_2(g_i(\mathbf{w}_t)) \right\|^2$ , we have + +$$ +\begin{array}{l} \mathbf {E} _ {t} \left[ \left\| \boldsymbol {\Psi} _ {t + 1} \right\| ^ {2} \right] \\ \leq \left(1 - \gamma_ {1}\right) \| \Psi_ {t} \| ^ {2} + \frac {2 (1 - \gamma_ {1}) C _ {f} ^ {2} C _ {g} ^ {2} \eta^ {2}}{\gamma_ {1}} \| \mathbf {m} _ {t} \| ^ {2} + \frac {(2 + 3 \beta) C _ {f} ^ {2}}{\gamma_ {1}} \gamma_ {1} ^ {2} \mathrm {E} _ {t} \left[ \frac {1}{B _ {+}} \sum_ {i \in \mathcal {B} _ {+}} \left\| u _ {t} ^ {i} - g _ {i} (\mathbf {w} _ {t + 1}) \right\| ^ {2} \right] + \frac {2 \gamma_ {1} ^ {2} C _ {f} ^ {2}}{B _ {+}} \\ \leq \left(1 - \gamma_ {1}\right) \| \Psi_ {t} \| ^ {2} + \frac {2 C _ {f} ^ {2} C _ {g} ^ {2} \eta^ {2}}{\gamma_ {1}} \| \mathbf {m} _ {t} \| ^ {2} + \frac {5 \gamma_ {1} C _ {f} ^ {2}}{n} \mathrm {E} _ {t} \left[ \| \mathbf {u} _ {t} - \mathbf {g} (\mathbf {w} _ {t + 1}) \| ^ {2} \right] + \frac {2 \gamma_ {1} ^ {2} C _ {f} ^ {2}}{B _ {+}} \\ \leq \left(1 - \gamma_ {1}\right) \| \Psi_ {t} \| ^ {2} + \frac {2 C _ {f} ^ {2} C _ {g} ^ {2} \eta^ {2}}{\gamma_ {1}} \| \mathbf {m} _ {t} \| ^ {2} + \frac {1 0 \gamma_ {1} C _ {f} ^ {2}}{n} \mathrm {E} _ {t} \left[ \| \mathbf {u} _ {t + 1} - \mathbf {g} (\mathbf {w} _ {t + 1}) \| ^ {2} \right] + \frac {1 0 \gamma_ {1} C _ {f} ^ {2}}{n} \mathrm {E} _ {t} \left[ \| \mathbf {u} _ {t} - \mathbf {u} _ {t + 1} \| ^ {2} \right] + \frac {2 \gamma_ {1} ^ {2} C _ {f} ^ {2}}{B _ {+}}. \\ \end{array} +$$ + +Proof of Theorem 5. Based on (13), we have + +$$ +\operatorname {E} \left[ F \left(\mathbf {w} _ {t + 1}\right) - F _ {\inf } \right] \leq \operatorname {E} \left[ F \left(\mathbf {w} _ {t}\right) - F _ {\inf } \right] + \frac {\eta}{2} \operatorname {E} \left[ \| \Delta_ {t} \| ^ {2} \right] - \frac {\eta}{2} \operatorname {E} \left[ \| \nabla F \left(\mathbf {w} _ {t}\right) \| ^ {2} \right] - \frac {\eta}{4} \operatorname {E} \left[ \| \mathbf {m} _ {t} \| ^ {2} \right] \tag {19} +$$ + +Re-arranging the terms and telescoping (19) from $t = 1$ to $T$ leads to + +$$ +\frac {1}{T} \sum_ {t = 1} ^ {T} \mathrm {E} \left[ \| \nabla F (\mathbf {w} _ {t}) \| ^ {2} \right] \leq \frac {2 \mathrm {E} \left[ F (\mathbf {w} _ {1}) - F _ {\text {i n f}} \right]}{\eta T} + \underbrace {\frac {1}{T} \sum_ {t = 1} ^ {T} \mathrm {E} \left[ \| \Delta_ {t} \| ^ {2} \right]} _ {:= \widehat {\Theta}} - \frac {1}{2 T} \sum_ {t = 1} ^ {T} \mathrm {E} \left[ \| \mathbf {m} _ {t} \| ^ {2} \right]. \tag {20} +$$ + +Based on (14), the term $\odot$ can be upper bounded as + +$$ +\begin{array}{l} \frac {1}{T} \sum_ {t = 1} ^ {T} \mathrm {E} \left[ \| \Delta_ {t} \| ^ {2} \right] \leq \frac {\mathrm {E} \left[ \| \Delta_ {1} \| ^ {2} \right]}{\gamma_ {2} T} + \frac {2 L _ {F} ^ {2} \eta^ {2}}{\gamma_ {2} ^ {2}} \frac {1}{T} \sum_ {t = 1} ^ {T} \mathrm {E} \left[ \| \mathbf {m} _ {t} \| ^ {2} \right] + 2 \gamma_ {2} C _ {f} ^ {4} \left(\frac {\zeta^ {2}}{B _ {-}} + \frac {C _ {g} ^ {2}}{B _ {+}}\right) \\ + 20C_{f}^{2}C_{1}^{2}L_{f}^{2}\sum_{t = 1}^{T}\frac{1}{n}\mathrm{E}[\| \mathbf{u}_{t + 1} - \mathbf{u}_{t}\|^{2}] + 20C_{f}^{2}C_{1}^{2}L_{f}^{2}\left(\underbrace{\frac{1}{T}\sum_{t = 1}^{T}\mathrm{E}\left[ \| \Psi_{t + 1}\|^{2}\right]}_{:= \text{\textcircled{1}}} + \underbrace{\frac{1}{T}\sum_{t = 1}^{T}\mathrm{E}\left[ \frac{1}{n}\| \Xi_{t + 1}\|^{2}\right]}_{:= \text{\textcircled{9}}}\right). \\ \end{array} +$$ + +Based on Lemma 2 in Wang & Yang (2022), the term $\mathfrak{g}$ can be upper bounded as + +$$ +\begin{array}{l} \frac {1}{T} \sum_ {t = 1} ^ {T} \mathrm {E} \left[ \frac {1}{n} \| \Xi_ {t + 1} \| ^ {2} \right] \leq \frac {4 n \mathrm {E} \left[ \frac {1}{n} \| \Xi_ {2} \| ^ {2} \right]}{\gamma_ {0} B _ {+} T} + 2 0 C _ {g} ^ {2} \left(\frac {n \eta}{\gamma_ {0} B _ {+}}\right) ^ {2} \frac {1}{T} \sum_ {t = 1} ^ {T} \mathrm {E} \left[ \| \mathbf {m} _ {t + 1} \| ^ {2} \right] \\ + \frac {8 \gamma_ {0} \sigma^ {2}}{B _ {-}} - \frac {1}{\gamma_ {0} B _ {+}} \sum_ {t = 1} ^ {T} \mathrm {E} \left[ \left\| \mathbf {u} ^ {t + 1} - \mathbf {u} ^ {t} \right\| ^ {2} \right]. \\ \end{array} +$$ + +With $1 / (\gamma_0B_+) \geq \max(10C_f^2 / n, 1 / n)$ , based on (18), the term ① can be bounded as + +$$ +\begin{array}{l} \frac {1}{T} \sum_ {t = 1} ^ {T} \operatorname {E} \left[ \| \Psi_ {t + 1} \| ^ {2} \right] \leq \frac {\operatorname {E} \left[ \| \Psi_ {2} \| ^ {2} \right]}{\gamma_ {1} T} + \frac {2 C _ {f} ^ {2} C _ {g} ^ {2} \eta^ {2}}{\gamma_ {1} ^ {2}} \frac {1}{T} \sum_ {t = 1} ^ {T} \operatorname {E} \left[ \| \mathbf {m} _ {t + 1} \| ^ {2} \right] + 5 C _ {f} ^ {2} \frac {1}{T} \sum_ {t = 1} ^ {T} \operatorname {E} \left[ \frac {1}{n} \| \Xi_ {t + 2} \| ^ {2} \right] + \frac {2 \gamma_ {1} C _ {f} ^ {2}}{B _ {+}} \\ \leq \frac {\operatorname {E} \left[ \| \Psi_ {2} \| ^ {2} \right]}{\gamma_ {1} T} + \frac {2 C _ {f} ^ {2} C _ {g} ^ {2} \eta^ {2}}{\gamma_ {1} ^ {2}} \frac {1}{T} \sum_ {t = 1} ^ {T} \operatorname {E} \left[ \| \mathbf {m} _ {t + 1} \| ^ {2} \right] + \frac {2 \gamma_ {1} C _ {f} ^ {2}}{B _ {+}} + \frac {2 0 C _ {f} ^ {2} n \operatorname {E} \left[ \frac {1}{n} \| \Xi_ {3} \| ^ {2} \right]}{\gamma_ {0} B _ {+} T} \\ + 1 0 0 C _ {f} ^ {2} C _ {g} ^ {2} \left(\frac {n \eta}{\gamma_ {0} B _ {+}}\right) ^ {2} \frac {1}{T} \sum_ {t = 1} ^ {T} \mathrm {E} \left[ \| \mathbf {m} _ {t + 2} \| ^ {2} \right] + \frac {4 0 C _ {f} ^ {2} \gamma_ {0} \sigma^ {2}}{B _ {-}}. \\ \end{array} +$$ + +Plug the upper bounds of 1 and 9 into (20). + +$$ +\begin{array}{l} \frac {1}{T} \sum_ {t = 1} ^ {T} \operatorname {E} \left[ \| \nabla F (\mathbf {w} _ {t}) \| ^ {2} \right] \\ \leq \frac {2 \operatorname {E} \left[ F (\mathbf {w} _ {1}) - F _ {\inf} \right]}{\eta T} + \frac {\operatorname {E} \left[ \| \Delta_ {1} \| ^ {2} \right]}{\gamma_ {2} T} + 2 \gamma_ {2} C _ {f} ^ {4} \left(\frac {\zeta^ {2}}{B _ {-}} + \frac {C _ {g} ^ {2}}{B _ {+}}\right) \\ + \frac {4 0 n C _ {f} ^ {2} C _ {1} ^ {2} L _ {f} ^ {2} \mathrm {E} \left[ \frac {1}{n} \| \Xi_ {2} \| ^ {2} \right]}{\gamma_ {0} B _ {+} T} - \left(\frac {1}{2} - \frac {2 L _ {F} ^ {2} \eta^ {2}}{\gamma_ {2} ^ {2}}\right) \frac {1}{T} \sum_ {t = 1} ^ {T} \mathrm {E} \left[ \| \mathbf {m} _ {t} \| ^ {2} \right] \\ + 2 0 0 C _ {f} ^ {2} C _ {g} ^ {2} C _ {1} ^ {2} L _ {f} ^ {2} \left(\frac {n \eta}{\gamma_ {0} B _ {+}}\right) ^ {2} \frac {1}{T} \sum_ {t = 1} ^ {T} \mathrm {E} \left[ \| \mathbf {m} _ {t + 1} \| ^ {2} \right] + \frac {8 0 \gamma_ {0} C _ {f} ^ {2} C _ {1} ^ {2} L _ {f} ^ {2} \sigma^ {2}}{B _ {-}} \\ + \frac {1 0 C _ {f} ^ {2} C _ {1} ^ {2} L _ {f} ^ {2} \mathrm {E} \left[ \| \Psi_ {2} \| ^ {2} \right]}{\gamma_ {1} T} + \frac {2 0 C _ {f} ^ {4} C _ {g} ^ {2} C _ {1} ^ {2} L _ {f} ^ {2} \eta^ {2}}{\gamma_ {1} ^ {2}} \frac {1}{T} \sum_ {t = 1} ^ {T} \mathrm {E} \left[ \| \mathbf {m} _ {t + 1} \| ^ {2} \right] + \frac {2 0 \gamma_ {1} C _ {f} ^ {4} C _ {1} ^ {2} L _ {f} ^ {2}}{B _ {+}} \\ + \frac {2 0 0 n C _ {f} ^ {4} C _ {1} ^ {2} L _ {f} ^ {2} \mathrm {E} \left[ \frac {1}{n} \| \Xi_ {3} \| ^ {2} \right]}{\gamma_ {0} B _ {+} T} + 1 0 0 0 C _ {f} ^ {4} C _ {1} ^ {2} C _ {g} ^ {2} \left(\frac {n \eta}{\gamma_ {0} B _ {+}}\right) ^ {2} \frac {1}{T} \sum_ {t = 1} ^ {T} \mathrm {E} \left[ \| \mathbf {m} _ {t + 2} \| ^ {2} \right] + \frac {4 0 0 \gamma_ {0} C _ {f} ^ {4} C _ {1} ^ {2} L _ {f} ^ {2} \sigma^ {2}}{B _ {-}}. \\ \end{array} +$$ + +If we choose $\eta \leq \min \left\{\frac{\gamma_2}{4L_F},\frac{\gamma_0B_+}{40nC_fC_gC_1\sqrt{L_f^2 + 5C_f^2}},\frac{\gamma_1}{15C_f^2C_gC_1L_f}\right\}$ , we have + +$$ +\begin{array}{l} - \left(\frac {1}{2} - \frac {2 L _ {F} ^ {2} \eta^ {2}}{\gamma_ {2} ^ {2}}\right) \frac {1}{T} \sum_ {t = 1} ^ {T} \mathrm {E} \left[ \| \mathbf {m} _ {t} \| ^ {2} \right] + 2 0 0 C _ {f} ^ {2} C _ {g} ^ {2} C _ {1} ^ {2} L _ {f} ^ {2} \left(\frac {n \eta}{\gamma_ {0} B _ {+}}\right) ^ {2} \frac {1}{T} \sum_ {t = 1} ^ {T} \mathrm {E} \left[ \| \mathbf {m} _ {t + 1} \| ^ {2} \right] \\ + \frac {2 0 C _ {f} ^ {4} C _ {g} ^ {2} C _ {1} ^ {2} L _ {f} ^ {2} \eta^ {2}}{\gamma_ {1} ^ {2}} \frac {1}{T} \sum_ {t = 1} ^ {T} \mathrm {E} \left[ \| \mathbf {m} _ {t + 1} \| ^ {2} \right] + 1 0 0 0 C _ {f} ^ {4} C _ {1} ^ {2} C _ {g} ^ {2} \left(\frac {n \eta}{\gamma_ {0} B _ {+}}\right) ^ {2} \frac {1}{T} \sum_ {t = 1} ^ {T} \mathrm {E} \left[ \| \mathbf {m} _ {t + 2} \| ^ {2} \right] \\ \leq \frac {\operatorname {E} \left[ \| \mathbf {m} _ {T + 1} \| ^ {2} \right] + \operatorname {E} \left[ \| \mathbf {m} _ {T + 2} \| ^ {2} \right]}{8 T}. \\ \end{array} +$$ + +Besides, Lemma 2 in Wang & Yang (2022) and Lemma 11 imply that + +$$ +\begin{array}{l} \operatorname {E} \left[ \frac {1}{n} \| \Xi_ {2} \| ^ {2} \right] \leq \operatorname {E} \left[ \frac {1}{n} \| \Xi_ {1} \| ^ {2} \right] + \frac {5 n \eta^ {2} C _ {g} ^ {2}}{\gamma_ {0} B _ {+}} \operatorname {E} \left[ \| \mathbf {m} _ {1} \| ^ {2} \right] + \frac {2 \gamma_ {0} ^ {2} \sigma^ {2} B _ {+}}{n B _ {-}} \\ \leq \operatorname {E} \left[ \frac {1}{n} \left\| \boldsymbol {\Xi} _ {1} \right\| ^ {2} \right] + \frac {\eta C _ {g}}{8 C _ {f} C _ {1} \sqrt {L _ {f} ^ {2} + 5 C _ {f} ^ {2}}} \operatorname {E} \left[ \left\| \mathbf {m} _ {1} \right\| ^ {2} \right] + \frac {2 \gamma_ {0} ^ {2} \sigma^ {2} B _ {+}}{n B _ {-}}, \\ \end{array} +$$ + +$$ +\begin{array}{l} \operatorname {E} \left[ \frac {1}{n} \| \Xi_ {3} \| ^ {2} \right] \leq \operatorname {E} \left[ \frac {1}{n} \| \Xi_ {1} \| ^ {2} \right] + \frac {\eta C _ {g}}{8 C _ {f} C _ {1} \sqrt {L _ {f} ^ {2} + 5 C _ {f} ^ {2}}} \left(\operatorname {E} \left[ \| \mathbf {m} _ {1} \| ^ {2} + \| \mathbf {m} _ {2} \| ^ {2} \right]\right) + \frac {4 \gamma_ {0} ^ {2} \sigma^ {2} B _ {+}}{n B _ {-}}, \\ \operatorname {E} \left[ \| \Psi_ {2} \| ^ {2} \right] \leq \operatorname {E} \left[ \| \Psi_ {1} \| ^ {2} \right] + \frac {2 C _ {g} \eta}{1 5 C _ {1} L _ {f}} \| \mathbf {m _ {1}} \| ^ {2} + 5 \gamma_ {1} C _ {f} ^ {2} \operatorname {E} \left[ \frac {1}{n} \| \Xi_ {t + 1} \| ^ {2} \right] + \frac {2 \gamma_ {1} ^ {2} C _ {f} ^ {2}}{B _ {+}}. \\ \end{array} +$$ + +If we initialize $\mathbf{m}_1 = 0$ , then $\operatorname{E}\left[\|\mathbf{m}_t\|^2\right] \leq C_f^2 C_1^2$ for any $t \geq 1$ . We define that $\Lambda_{F,1} = \operatorname{E}\left[F(\mathbf{w}_1) - F_{\inf}\right] < +\infty$ , $\Lambda_{\Delta,1} = \operatorname{E}\left[\|\Delta_1\|^2\right] < +\infty$ , $\Lambda_{\Xi,2} = \operatorname{E}\left[\frac{1}{n}\|\Xi_2\|^2\right] < +\infty$ , $\Lambda_{\Xi,3} = \operatorname{E}\left[\frac{1}{n}\|\Xi_2\|^2\right] < +\infty$ , $\Lambda_{\Psi}^2 = \operatorname{E}\left[\|\Psi_2\|^2\right] < +\infty$ . Then, + +$$ +\begin{array}{l} \frac {1}{T} \sum_ {t = 1} ^ {T} \operatorname {E} \left[ \left\| \nabla F (\mathbf {w} _ {t}) \right\| ^ {2} \right] \\ \leq \frac {2 \Lambda_ {F , 1}}{\eta T} + \frac {\Lambda_ {\Delta , 1}}{\gamma_ {2} T} + \frac {4 0 n C _ {f} ^ {2} C _ {1} ^ {2} L _ {f} ^ {2} \Lambda_ {\Xi , 2}}{\gamma_ {0} B _ {+} T} + \frac {1 0 C _ {f} ^ {2} C _ {1} ^ {2} L _ {f} ^ {2} \Lambda_ {\Psi} ^ {2}}{\gamma_ {1} T} + \frac {2 0 0 n C _ {f} ^ {4} C _ {1} ^ {2} L _ {f} ^ {2} \Lambda_ {\Xi , 3}}{\gamma_ {0} B _ {+} T} \\ + 2 \beta C _ {f} ^ {4} \left(\frac {\zeta^ {2}}{B _ {-}} + \frac {C _ {g} ^ {2}}{B _ {+}}\right) + \frac {8 0 \gamma_ {0} C _ {f} ^ {2} C _ {1} ^ {2} L _ {f} ^ {2} \sigma^ {2}}{B _ {-}} + \frac {2 0 \gamma_ {1} C _ {f} ^ {4} C _ {1} ^ {2} L _ {f} ^ {2}}{B _ {+}} + \frac {4 0 0 \gamma_ {0} C _ {f} ^ {4} C _ {1} ^ {2} L _ {f} ^ {2} \sigma^ {2}}{B _ {-}} + \frac {C _ {f} ^ {2} C _ {1} ^ {2}}{4 T}. \\ \end{array} +$$ + +Set $\gamma_0 = \frac{B_{-}\epsilon^2}{400C_f^2C_1^2L_f^2\sigma^2(1 + 5C_f^2)}$ $\gamma_{1} = \frac{B_{+}\epsilon^{2}}{200C_{f}^{4}C_{1}^{2}L_{f}^{2}}$ $\gamma_{2} = \frac{\min\{B_{-},B_{+}\} \epsilon^{2}}{20C_{f}^{4}(\zeta^{2} + C_{g}^{2})}$ , and + +$$ +\eta \leq \min \left\{\frac {\gamma_ {2}}{4 L _ {F}}, \frac {\gamma_ {0} B _ {+}}{4 0 n C _ {f} C _ {g} C _ {1} \sqrt {L _ {f} ^ {2} + 5 C _ {f} ^ {2}}}, \frac {\gamma_ {1}}{1 5 C _ {f} ^ {2} C _ {g} C _ {1} L _ {f}} \right\}, +$$ + +$$ +\begin{array}{l} T = \max \left\{\frac {1 6 0 0 \Lambda_ {F , 1} L _ {F} C _ {f} ^ {4} (\zeta^ {2} + C _ {g} ^ {2})}{\min \{B _ {-} , B _ {+} \} \epsilon^ {4}}, \frac {3 2 0 0 0 0 n \Lambda_ {F , 1} C _ {f} ^ {3} C _ {g} C _ {1} ^ {3} L _ {f} ^ {2} (1 + 5 C _ {f} ^ {2}) \sqrt {L _ {f} ^ {2} + 5 C _ {f} ^ {2}} \sigma^ {2}}{B _ {-} B _ {+} \epsilon^ {4}}, \right. \\ \frac {6 0 0 0 0 \Lambda_ {F , 1} C _ {f} ^ {6} C _ {g} C _ {1} ^ {3} L _ {f} ^ {3}}{B _ {+} \epsilon^ {4}}, \frac {2 0 0 C _ {f} ^ {4} (\zeta^ {2} + C _ {g} ^ {2}) \Lambda_ {\Delta , 1}}{\min \{B _ {-} , B _ {+} \} \epsilon^ {4}}, \frac {1 6 0 0 0 0 n C _ {f} ^ {4} C _ {1} ^ {4} L _ {f} ^ {4} \sigma^ {2} (1 + 5 C _ {f} ^ {2}) \Lambda_ {\Xi} ^ {2}}{B _ {-} B _ {+} \epsilon^ {4}}, \\ \left. \frac {2 0 0 0 0 C _ {f} ^ {6} C _ {1} ^ {4} L _ {f} ^ {4} \Lambda_ {\Psi} ^ {2}}{B _ {+} \epsilon^ {4}}, \frac {8 0 0 0 0 0 n C _ {f} ^ {6} C _ {1} ^ {4} L _ {f} ^ {4} (1 + 5 C _ {f} ^ {2}) \Lambda_ {\Xi , 3} \sigma^ {2}}{B _ {-} B _ {+} \epsilon^ {4}} \right\}. \\ \end{array} +$$ + +Then, we have $\frac{1}{T}\sum_{t = 1}^{T}\operatorname {E}\left[\| \nabla F(\mathbf{w}_t)\| ^2\right]\leq \epsilon^2$ + +# C. Optimization of CVaR-estimator of TPAUC + +We have the following estimator + +$$ +F (\mathbf {w}) = \min _ {s ^ {\prime} \in \mathbb {R}} s ^ {\prime} + \frac {1}{n _ {+} \alpha} \sum_ {\mathbf {x} _ {i} \in \mathcal {S} _ {+}} \left(\min _ {s _ {i}} s _ {i} + \frac {1}{\beta} g _ {i} (\mathbf {w}; s _ {i}) - s ^ {\prime}\right) _ {+}. +$$ + +It is not difficult to show that the above estimator is equivalent to + +$$ +F (\mathbf {w}) = \min _ {s ^ {\prime} \in \mathbb {R}, \mathbf {s} \in \mathbb {R} ^ {n +}} s ^ {\prime} + \frac {1}{n + \alpha} \sum_ {\mathbf {x} _ {i} \in \mathcal {S} _ {+}} (s _ {i} + \frac {1}{\beta} g _ {i} (\mathbf {w}; s _ {i}) - s ^ {\prime}) _ {+}. +$$ + +The reason is that $(\min_x f(x) - s)_+ = \min_x (f(x) - s)_+$ . Using the conjugate of $[\cdot]_+$ , we have + +$$ +\min_{\mathbf{w},\mathbf{s}\in \mathbb{R}^{n + },s^{\prime}}\max_{\mathbf{u}\in [0,1]^{n + }}\underbrace{s^{\prime} + \frac{1}{n_{+}\alpha}\sum_{\mathbf{x}_{i}\in\mathcal{S}_{+}}u_{i}(s_{i} + \frac{1}{\beta} g_{i}(\mathbf{w};s_{i}) - s^{\prime})}_{F(\mathbf{w},\mathbf{s},s^{\prime},\mathbf{u})}. +$$ + +Let $\bar{\mathbf{w}} = (\mathbf{w},\mathbf{s},s^{\prime})$ . We consider the function $F(\bar{\mathbf{w}},\mathbf{u})$ , which can be proved to be weakly convex and concave. Hence, we can use the stagewise proximal point method to solve the problem (Rafique et al., 2020). At the $k$ -th stage, we solve the following problem approximately: + +$$ +\min _ {\bar {\mathbf {w}}} \max _ {\mathbf {u} \in [ 0, 1 ]} F _ {k} (\bar {\mathbf {w}}, \mathbf {u}) = F (\bar {\mathbf {w}}, \mathbf {u}) + \frac {1}{2 \gamma} \| \bar {\mathbf {w}} - \bar {\mathbf {w}} _ {1} ^ {k} \| ^ {2} +$$ + +We will use stochastic primal-dual algorithm for solving $F_{k}$ . However, for s we use stochastic coordinate gradient descent update, and for u we also use stochastic coordinate gradient descent update. Let $\nabla_1F$ , $\nabla_2F$ , $\nabla_3F$ , $\nabla_4F$ denote the partial + +![](images/8af39c7efb59946462efea5ee5e0d5dc3f764879a03cd64427d468a5f4f63460.jpg) + +# Algorithm 4 SOTA + +1: Set $\mathbf{s}_0 = 0, s_0' = 0, \mathbf{u}_0 = 1$ and initialize $\mathbf{w}_0$ +2: for $k = 1, \dots, K$ do +3: Let $\mathbf{w}_1^k = \mathbf{w}_{k-1}, \mathbf{s}_1^k = \mathbf{s}_{k-1}, s'_k = s'_k, \mathbf{u}_1^k = \mathbf{u}_{k-1}$ +4: for $t = 1, \dots, T_k$ do +5: Sample $\mathcal{B}_{+} \subset \mathcal{S}_{+}$ and $\mathcal{B}_{-} \subset \mathcal{S}_{-}$ +6: Update $\mathbf{w}_{t + 1},\mathbf{s}_{t + 1},s_{t + 1}^{\prime},\mathbf{u}_{t + 1}$ according to (21) +7: end for +8: Let $\mathbf{w}_k, \mathbf{s}_k, s_k', \mathbf{u}_k$ be the average of $\mathbf{w}_t, \mathbf{s}_t, s_t', \mathbf{u}_t$ , respectively +9: end for + +gradient of $F$ in terms of $\mathbf{w},\mathbf{s},s^{\prime},\mathbf{u}$ , respectively. We consider the following update: + +$$ +\mathbf {w} _ {t + 1} = \arg \min _ {\mathbf {w}} \mathbf {w} ^ {\top} \nabla_ {1} F (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \boldsymbol {\xi} _ {t}) + \frac {1}{2 \eta_ {1}} \| \mathbf {w} - \mathbf {w} _ {t} \| ^ {2} + \frac {1}{2 \gamma} \| \mathbf {w} - \mathbf {w} _ {1} ^ {k} \| ^ {2} +$$ + +$$ +s _ {t + 1, i} = \arg \min _ {s} s U _ {i} \nabla_ {2} F \left(\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}\right) + \frac {1}{2 \eta_ {2}} \left| s - s _ {t, i} \right| ^ {2} + \frac {1}{2 \gamma} \left| s - s _ {1, i} ^ {k} \right| ^ {2}, \forall \mathbf {x} _ {i} \in \mathcal {B} _ {+} \tag {21} +$$ + +$$ +s _ {t + 1} ^ {\prime} = \arg \min _ {s ^ {\prime}} \nabla_ {3} F (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}) + \frac {1}{2 \eta_ {3}} | s ^ {\prime} - s _ {t} ^ {\prime} | ^ {2} + \frac {1}{2 \gamma} | s ^ {\prime} - s _ {k, 1} ^ {\prime} | ^ {2} +$$ + +$$ +u _ {t + 1, i} = \left[ u _ {t, i} + \frac {n _ {+}}{B _ {+}} \eta_ {4} U _ {i} \nabla_ {4} F (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}) \right] _ {[ 0, 1 ]}, \forall \mathbf {x} _ {i} \in \mathcal {B} _ {+}, +$$ + +where $U_{i} \in \mathbb{R}^{1 \times d}$ denotes an operation that chooses the $i$ -th coordinate of a vector. Note that different from (Rafique et al., 2020), we use stochastic coordinate descent (ascent) to update $\mathbf{s}_{t+1}(\mathbf{u}_{t+1})$ . + +Next, we present the stochastic gradients. + +$$ +\nabla_ {1} F (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}) = \frac {1}{B _ {+} B _ {-} \alpha \beta} \sum_ {\mathbf {x} _ {i} \in \mathcal {B} _ {+}} \sum_ {\mathbf {x} _ {j} \in \mathcal {B} _ {-}} u _ {i} \mathbb {I} (L (\mathbf {w} _ {t}; \mathbf {x} _ {i}, \mathbf {x} _ {j}) - s _ {t, i} > 0) \nabla L (\mathbf {w} _ {t}; \mathbf {x} _ {i}, \mathbf {x} _ {j}) +$$ + +$$ +U _ {i} \nabla_ {2} F (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}) = \frac {1}{n + \alpha} u _ {t, i} \left(1 - \frac {1}{B _ {-} \beta} \sum_ {\mathbf {x} _ {j} \in \mathcal {B} _ {-}} \mathbb {I} (L (\mathbf {w} _ {t}; \mathbf {x} _ {i}, \mathbf {x} _ {j})) > s _ {t, i}\right) +$$ + +$$ +\nabla_ {3} F (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}) = 1 - \frac {1}{B _ {+} \alpha} \sum_ {\mathbf {x} _ {i} \in \mathcal {B} _ {+}} u _ {t, i} +$$ + +$$ +U _ {i} \nabla_ {4} F (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}) = \frac {1}{n _ {+} \alpha} (s _ {t, i} - s _ {t} ^ {\prime} + \frac {1}{B _ {-} \beta} \sum_ {\mathbf {x} _ {j} \in \mathcal {B} _ {-}} (L (\mathbf {w} _ {t}; \mathbf {x} _ {i}, \mathbf {x} _ {j}) - s _ {t, i}) _ {+}) +$$ + +We have + +$$ +\operatorname {E} \left[ \nabla_ {1} F _ {k} (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}) \right] = \nabla_ {1} F _ {k} (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}), \quad \operatorname {E} \left[ \| \nabla_ {1} F _ {k} (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}) \| ^ {2} \right] \leq \frac {C}{\alpha^ {2} \beta^ {2}} +$$ + +$$ +\operatorname {E} \left[ n _ {+} U _ {i} ^ {\top} U _ {i} \nabla_ {2} F _ {k} (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}) \right] = \nabla_ {2} F _ {k} (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}), \quad \operatorname {E} \left[ \| U _ {i} \nabla_ {2} F _ {k} (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}) \| ^ {2} \right] \leq \frac {1}{n _ {+} ^ {2} \alpha^ {2}} (1 + \frac {1}{\beta}) ^ {2} +$$ + +$$ +\operatorname {E} \left[ \nabla_ {3} F _ {k} (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}) \right] = \nabla_ {3} F _ {k} (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}), \quad \operatorname {E} \left[ \| \nabla_ {3} F _ {k} (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}) \| ^ {2} \right] \leq (1 + \frac {1}{\alpha}) ^ {2} +$$ + +$$ +\operatorname {E} \left[ n _ {+} U _ {i} ^ {\top} U _ {i} \nabla_ {4} F _ {k} (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}) \right] = \nabla_ {4} F _ {k} (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}), \quad \operatorname {E} [ \| U _ {i} \nabla_ {4} F (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}) \| ^ {2} ] \leq \frac {4 C ^ {2}}{n _ {+} ^ {2} \alpha^ {2}} (1 + \frac {1}{\beta}) ^ {2} +$$ + +where we assume $\max (|s_t'|, |s_{t,i}|, L(\mathbf{w}_t; \mathbf{x}_i, \mathbf{x}_j), \| \nabla L(\mathbf{w}_t; \mathbf{x}_i, \mathbf{x}_j) \|) \leq C$ . The algorithm is shown in Algorithm 4. + +# C.1. Analysis + +Theorem 6. Assume there exists $C > 0$ such that $\max (|s_t'|, |s_{t,i}|, L(\mathbf{w}_t; \mathbf{x}_i, \mathbf{x}_j), \| \nabla L(\mathbf{w}_t; \mathbf{x}_i, \mathbf{x}_j) \|) \leq C$ at every stage. Let $1 / \gamma \geq \rho$ , $\eta_1^k = \eta_3^k = \eta_4^k = \eta_2^k B_+ / n_+ = \eta_k \propto 1 / k$ , $T_k \propto k^2$ . SOTA ensures that after $T = O(1 / \epsilon^6)$ iterations we can find an $\epsilon$ -nearly stationary solution for $\min_{\mathbf{w}, \mathbf{s}, s'} F(\mathbf{w}, \mathbf{s}, s')$ . + +We first show that $F(\bar{\mathbf{w}}, \mathbf{u})$ is weakly convex in terms of $\bar{\mathbf{w}}$ for any $\mathbf{u}$ . + +Lemma 12. Under Assumption 2, then $F(\bar{\mathbf{w}}, \mathbf{u})$ is $\rho / (\alpha \beta)$ -weakly convex in terms of $\bar{\mathbf{w}}$ for any $\mathbf{u}$ , where $\rho$ is equal to the smoothness parameter of $L(\mathbf{w}; \mathbf{x}_i, \mathbf{x}_j)$ . + +Proof. Following similar analysis of Lemma 2, we can show that $F(\bar{\mathbf{w}}, \mathbf{u}) + \frac{\rho}{2\alpha\beta} \| \bar{\mathbf{w}} \|^2 = F(\bar{\mathbf{w}}, \mathbf{u}) + \frac{1}{n + \alpha} \sum_i u_i \left( \frac{\rho}{2\beta} \| \mathbf{w} \|^2 + \frac{\rho}{2\beta} |s_i|^2 + \frac{\rho}{2\beta} |s'|^2 \right) + \frac{\rho}{2n + \alpha\beta} \sum_i (1 - u_i) \left( \| \mathbf{w} \|^2 + |s_i|^2 + |s'|^2 \right) + \frac{(n_+ - 1)}{2n + \alpha\beta} \| \mathbf{s} \|^2$ is jointly convex in terms of $\mathbf{w}, \mathbf{s}, s'$ for any $\mathbf{u} \in [0,1]$ . Then $F(\bar{\mathbf{w}}, \mathbf{u})$ is $\rho' = \frac{\rho}{\alpha\beta}$ -weakly convex in terms of $\bar{\mathbf{w}}$ for any $\mathbf{u}$ . + +We need the following lemma for analysis. + +Lemma 13. Consider the proximal gradient update + +$$ +\mathbf {x} _ {t + 1} = \arg \min \mathbf {x} ^ {\top} G _ {t} + \frac {1}{2 \eta} \| \mathbf {x} - \mathbf {x} _ {t} \| ^ {2} + g (\mathbf {x}), +$$ + +we have + +$$ +\begin{array}{l} \left(\mathbf {x} _ {t} - \mathbf {x}\right) ^ {\top} G _ {t} + g \left(\mathbf {x} _ {t}\right) - g (\mathbf {x}) + \frac {1}{2 \gamma} \left\| \mathbf {x} - \mathbf {x} _ {t + 1} \right\| ^ {2} \\ \leq \eta \| G _ {t} \| ^ {2} + \frac {1}{2 \eta} (\| \mathbf {x} - \mathbf {x} _ {t} \| ^ {2} - \| \mathbf {x} - \mathbf {x} _ {t + 1} \| ^ {2}) + g (\mathbf {x} _ {t}) - g (\mathbf {x} _ {t + 1}) - \frac {1}{4 \eta} \| \mathbf {x} _ {t + 1} - \mathbf {x} _ {t} \| ^ {2} \\ \end{array} +$$ + +Proof. Due to the update of $\mathbf{x}_{t + 1}$ , we have + +$$ +\begin{array}{l} \mathbf {x} _ {t + 1} ^ {\top} G _ {t} + \frac {1}{2 \eta} \| \mathbf {x} _ {t + 1} - \mathbf {x} _ {t} \| ^ {2} + g (\mathbf {x} _ {t + 1}) + \left(\frac {1}{2 \eta} + \frac {1}{2 \gamma}\right) \| \mathbf {x} - \mathbf {x} _ {t + 1} \| ^ {2} \\ \leq \mathbf {x} ^ {\top} G _ {t} + \frac {1}{2 \eta} \| \mathbf {x} - \mathbf {x} _ {t} \| ^ {2} + g (\mathbf {x}) \\ \end{array} +$$ + +As a result, we have + +$$ +\begin{array}{l} \left(\mathbf {x} _ {t} - \mathbf {x}\right) ^ {\top} G _ {t} + g (\mathbf {x} _ {t}) - g (\mathbf {x}) + \frac {1}{2 \gamma} \left\| \mathbf {x} - \mathbf {x} _ {t + 1} \right\| ^ {2} \\ \leq \left(\mathbf {x} _ {t} - \mathbf {x} _ {t + 1}\right) ^ {\top} G _ {t} + \frac {1}{2 \eta} \left(\left\| \mathbf {x} - \mathbf {x} _ {t} \right\| ^ {2} - \left\| \mathbf {x} - \mathbf {x} _ {t + 1} \right\| ^ {2}\right) + g (\mathbf {x} _ {t}) - g (\mathbf {x} _ {t + 1}) - \frac {1}{2 \eta} \left\| \mathbf {x} _ {t + 1} - \mathbf {x} _ {t} \right\| ^ {2} \\ \leq \eta \| G _ {t} \| ^ {2} + \frac {1}{2 \eta} (\| \mathbf {x} - \mathbf {x} _ {t} \| ^ {2} - \| \mathbf {x} - \mathbf {x} _ {t + 1} \| ^ {2}) + g (\mathbf {x} _ {t}) - g (\mathbf {x} _ {t + 1}) - \frac {1}{4 \eta} \| \mathbf {x} _ {t + 1} - \mathbf {x} _ {t} \| ^ {2} \\ \end{array} +$$ + +Below, we let $g_{1}(\mathbf{w}) = \frac{1}{2\gamma}\| \mathbf{w} - \mathbf{w}_{1}^{k}\|^{2}$ , $g_{2}(\mathbf{s}) = \frac{1}{2\gamma}\| \mathbf{s} - \mathbf{s}_{1}^{k}\|^{2}$ , and $g_{3}(s^{\prime}) = \frac{1}{2\gamma}\| s^{\prime} - s_{k,1}^{\prime}\|^{2}$ . Applying the above Lemma to $\mathbf{w}_{t + 1}$ , we have + +$$ +\begin{array}{l} \left(\mathbf {w} _ {t} - \mathbf {w}\right) ^ {\top} \nabla_ {1} F \left(\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}\right) + g _ {1} \left(\mathbf {w} _ {t}\right) - g _ {1} \left(\mathbf {w}\right) \\ \leq \eta_ {1} \| \nabla_ {1} F (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}) \| ^ {2} + \frac {1}{2 \eta_ {1}} \left(\| \mathbf {w} - \mathbf {w} _ {t} \| ^ {2} - \| \mathbf {w} - \mathbf {w} _ {t + 1} \| ^ {2}\right) + g _ {1} (\mathbf {w} _ {t}) - g _ {1} (\mathbf {w} _ {t + 1}) \\ \end{array} +$$ + +Assume $\mathbf{w}$ is independent of noise and taking expectation on both sides, we have + +$$ +\begin{array}{l} \operatorname {E} \left[ \left(\mathbf {w} _ {t} - \mathbf {w}\right) ^ {\top} \nabla_ {1} F \left(\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}\right) + g _ {1} \left(\mathbf {w} _ {t}\right) - g _ {1} (\mathbf {w}) \right] \\ \leq \operatorname {E} [ \eta_ {1} \| \nabla_ {1} F (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}) \| ^ {2} + \frac {1}{2 \eta_ {1}} (\| \mathbf {w} - \mathbf {w} _ {t} \| ^ {2} - \| \mathbf {w} - \mathbf {w} _ {t + 1} \| ^ {2}) + g _ {1} (\mathbf {w} _ {t}) - g _ {1} (\mathbf {w} _ {t + 1}) ] \\ \end{array} +$$ + +Applying the above Lemma to $s_{t + 1,i}$ , we have + +$$ +\begin{array}{l} \left(s _ {t, i} - s _ {i}\right) ^ {\top} U _ {i} \nabla_ {2} F (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}) + g _ {2} \left(s _ {t, i}\right) - g _ {2} \left(s _ {i}\right) \\ \leq \eta_ {2} \| U _ {i} \nabla_ {2} F (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}) \| ^ {2} + \frac {1}{2 \eta_ {2}} (\| s _ {i} - s _ {t, i} \| ^ {2} - \| s _ {i} - s _ {t + 1, i} \| ^ {2}) + g _ {2} (s _ {t, i}) - g _ {2} (s _ {t + 1, i}) \\ \end{array} +$$ + +Summing the above inequality over $\mathbf{x}_i\in \mathcal{B}_+$ , assuming $\mathbf{s}$ is independent of noise and taking expectation on both sides, we have + +$$ +\begin{array}{l} \frac {B _ {+}}{n _ {+}} \mathrm {E} (\mathbf {s} _ {t} - \mathbf {s}) ^ {\top} \nabla_ {2} F (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}) + g _ {2} (\mathbf {s} _ {t}) - g _ {2} (\mathbf {s}) ] \\ = \operatorname {E} \left[ \eta_ {2} \sum_ {i \in \mathcal {B} _ {+}} \| U _ {i} \nabla_ {2} F (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}) \| ^ {2} + \frac {1}{2 \eta_ {2}} \left(\| \mathbf {s} - \mathbf {s} _ {t} \| ^ {2} - \| \mathbf {s} - \mathbf {s} _ {t + 1} \| ^ {2}\right) + g _ {2} (\mathbf {s} _ {t}) - g _ {2} (\mathbf {s} _ {t + 1}) \right] \\ \end{array} +$$ + +Applying the above lemma to $s_{t+1}'$ , we have + +$$ +\begin{array}{l} \left(s _ {t} ^ {\prime} - s ^ {\prime}\right) ^ {\top} \nabla_ {3} F (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}) + g _ {3} \left(s _ {t} ^ {\prime}\right) - g _ {3} \left(s ^ {\prime}\right) \\ \leq \eta_ {2} \| \nabla_ {3} F (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}) \| ^ {2} + \frac {1}{2 \eta_ {2}} (\| s ^ {\prime} - s _ {t} ^ {\prime} \| ^ {2} - \| s ^ {\prime} - s _ {t + 1} ^ {\prime} \| ^ {2}) + g _ {3} (s _ {t} ^ {\prime}) - g _ {3} (s _ {t + 1} ^ {\prime}) \\ \end{array} +$$ + +Assume $\mathbf{s}'$ is independent of noise and taking expectation on both sides, we have + +$$ +\begin{array}{l} \mathrm {E} \left[ \left(s _ {t} ^ {\prime} - s ^ {\prime}\right) ^ {\top} \nabla_ {3} F (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}) + g _ {3} \left(s _ {t} ^ {\prime}\right) - g _ {3} \left(s ^ {\prime}\right) \right] \\ \leq \operatorname {E} \left[ \eta_ {2} \| \nabla_ {3} F (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}) \right] ^ {2} + \frac {1}{2 \eta_ {2}} \left(\| s ^ {\prime} - s _ {t} ^ {\prime} \| ^ {2} - \| s ^ {\prime} - s _ {t + 1} ^ {\prime} \| ^ {2}\right) + g _ {3} \left(s _ {t} ^ {\prime}\right) - g _ {3} \left(s _ {t + 1} ^ {\prime}\right) ] \\ \end{array} +$$ + +Adding the above inequalities for $\mathbf{w},\mathbf{s},s^{\prime}$ together we have + +$$ +\begin{array}{l} \mathrm {E} \left[ \sum_ {t} \left(\bar {\mathbf {w}} _ {t} - \bar {\mathbf {w}}\right) ^ {\top} \nabla_ {\bar {\mathbf {w}}} F \left(\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}\right) + g \left(\bar {\mathbf {w}} _ {t}\right) - g \left(\bar {\mathbf {w}}\right) \right] \\ \leq \eta_ {1} C _ {1} ^ {2} T + \eta_ {2} n _ {+} C _ {2} ^ {2} T + \eta_ {3} C _ {3} ^ {2} T \\ + \frac {1}{2 \eta_ {1}} (\| \mathbf {w} - \mathbf {w} _ {1} \| ^ {2}) + \frac {n _ {+}}{2 \eta_ {2} B _ {+}} (\| \mathbf {s} - \mathbf {s} _ {1} \| ^ {2}) + \frac {1}{2 \eta_ {3}} (\| s ^ {\prime} - s _ {1} ^ {\prime} \| ^ {2}) + g _ {1} (\mathbf {w} _ {1}) + \frac {n _ {+}}{B _ {+}} g _ {2} (\mathbf {s} _ {1}) + g _ {3} (s _ {1} ^ {\prime}) \\ \end{array} +$$ + +As a result, + +$$ +\begin{array}{l} \operatorname {E} \left[ \sum_ {t} F _ {k} \left(\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}\right) - F _ {k} \left(\bar {\mathbf {w}}, \mathbf {u} _ {t}\right) \right] \leq \eta_ {1} C _ {1} ^ {2} T + \eta_ {2} n _ {+} C _ {2} ^ {2} T + \eta_ {3} C _ {3} ^ {2} T \\ + \frac {1}{2 \eta_ {1}} \left(\| \mathbf {w} - \mathbf {w} _ {1} \| ^ {2}\right) + \frac {n _ {+}}{2 \eta_ {2} B _ {+}} \left(\| \mathbf {s} - \mathbf {s} _ {1} \| ^ {2}\right) + \frac {1}{2 \eta_ {3}} \left(\| s ^ {\prime} - s _ {1} ^ {\prime} \| ^ {2}\right) \\ \end{array} +$$ + +For the update of $\mathbf{u}$ , it is equivalent to + +$$ +\mathbf {u} _ {t + 1} = \arg \min _ {\mathbf {u} \in [ 0, 1 ]} \mathbf {u} ^ {\top} \widetilde {\nabla} _ {4} F (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}) + \frac {1}{2 \eta_ {4}} \| \mathbf {u} - \mathbf {u} _ {t} \| ^ {2} +$$ + +where $\widetilde{\nabla}_4F(\bar{\mathbf{w}}_t,\mathbf{u}_t;\xi_t) = \frac{n_+}{B_+}\sum_{i\in \mathcal{B}_+}U_i^\top U_i\nabla_4F(\bar{\mathbf{w}}_t,\mathbf{u}_t;\xi_t)$ . It is easy to show that $\operatorname {E}[\widetilde{\nabla}_4F(\bar{\mathbf{w}}_t,\mathbf{u}_t;\xi_t)] = \nabla_4F(\bar{\mathbf{w}}_t,\mathbf{u}_t)$ . Applying the same analysis to the update of $\mathbf{u}_t$ , we have + +$$ +\begin{array}{l} \left(\mathbf {u} - \mathbf {u} _ {t}\right) ^ {\top} \tilde {\nabla} _ {4} F \left(\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}\right) \\ \leq \eta_ {4} \| \tilde {\nabla} _ {4} F (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}) \| ^ {2} + \frac {1}{2 \eta_ {4}} (\| \mathbf {u} - \mathbf {u} _ {t} \| ^ {2} - \| \mathbf {u} - \mathbf {u} _ {t + 1} \| ^ {2}) \\ \end{array} +$$ + +We do not assume $\mathbf{u}$ is independent of the randomness in order to derive the primal objective gap. As a result, + +$$ +\begin{array}{l} \left(\mathbf {u} - \mathbf {u} _ {t}\right) ^ {\top} \nabla_ {4} F (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}) \\ = \eta_ {4} \| \widetilde {\nabla} _ {4} F (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}) \| ^ {2} + \frac {1}{2 \eta_ {4}} \left(\| \mathbf {u} - \mathbf {u} _ {t} \| ^ {2} - \| \mathbf {u} - \mathbf {u} _ {t + 1} \| ^ {2}\right) \\ + \left(\mathbf {u} - \mathbf {u} _ {t}\right) ^ {\top} \left(\nabla_ {4} F \left(\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}\right) + \tilde {\nabla} _ {4} F \left(\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}\right)\right) \\ \end{array} +$$ + +Following previous analysis (e.g., Proposition A.1 in (Rafique et al., 2020)), we have + +$$ +\begin{array}{l} \left(\mathbf {u} - \tilde {\mathbf {u}} _ {t}\right) ^ {\top} \left(\nabla_ {4} F \left(\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}\right) - \nabla_ {4} F \left(\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}\right)\right) \\ \leq \eta_ {4} \| \nabla_ {4} F (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}) - \nabla_ {4} F (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}; \xi_ {t}) \| ^ {2} + \frac {1}{2 \eta_ {4}} (\| \mathbf {u} - \tilde {\mathbf {u}} _ {t} \| ^ {2} - \| \mathbf {u} - \tilde {\mathbf {u}} _ {t + 1} \| ^ {2}) \\ \end{array} +$$ + +Hence for any $\mathbf{u}$ , we have + +$$ +\mathrm {E} (\mathbf {u} - \mathbf {u} _ {t}) ^ {\top} \nabla_ {4} F (\bar {\mathbf {w}} _ {t}, \mathbf {u} _ {t}) ] \leq \frac {2 n _ {+} ^ {2}}{B _ {+}} \eta_ {4} C _ {4} ^ {2} + \frac {1}{\eta_ {4}} \| \mathbf {u} - \mathbf {u} _ {1} \| ^ {2} +$$ + +As a result, for any $\mathbf{u}$ we have + +$$ +\operatorname {E} \left[ \sum_ {t} F _ {k} (\mathbf {u}, \bar {\mathbf {w}} _ {t}) - F _ {k} (\mathbf {u} _ {t}, \bar {\mathbf {w}} _ {t}) \right] \leq \frac {2 n _ {+} ^ {2}}{B _ {+}} \eta_ {4} C _ {4} ^ {2} + \frac {1}{\eta_ {4}} \| \mathbf {u} - \mathbf {u} _ {1} \| ^ {2} +$$ + +As a result, + +$$ +\begin{array}{l} \operatorname {E} \left[ \sum_ {t} F _ {k} (\bar {\mathbf {w}} _ {t}, \mathbf {u}) - F _ {k} (\bar {\mathbf {w}}, \mathbf {u} _ {t}) \right] \leq \eta_ {1} C _ {1} ^ {2} T + \eta_ {2} n _ {+} C _ {2} ^ {2} T + \eta_ {3} C _ {3} ^ {2} T + \frac {2 n _ {+} ^ {2}}{B _ {+}} \eta_ {4} C _ {4} ^ {2} \\ + \frac {1}{2 \eta_ {1}} (\| \mathbf {w} - \mathbf {w} _ {1} \| ^ {2}) + \frac {n _ {+}}{2 \eta_ {2} B _ {+}} (\| \mathbf {s} - \mathbf {s} _ {1} \| ^ {2}) + \frac {1}{2 \eta_ {3}} (\| s ^ {\prime} - s _ {1} ^ {\prime} \| ^ {2}) + \frac {1}{\eta_ {4}} \| \mathbf {u} - \mathbf {u} _ {1} \| ^ {2} \\ \end{array} +$$ + +Let $\eta_{1} = \eta_{3} = \eta_{2}B_{+} / n_{+} = \eta ,\eta_{4} = \eta$ . Then we have + +$$ +\begin{array}{l} \operatorname {E} [ \sum_ {t} F _ {k} (\bar {\mathbf {w}} _ {t}, \mathbf {u}) - F _ {k} (\bar {\mathbf {w}}, \mathbf {u} _ {t}) ] \leq \eta C _ {1} ^ {2} T + \eta \frac {n _ {+} ^ {2}}{B _ {+}} C _ {2} ^ {2} T + \eta C _ {3} ^ {2} T + \frac {2 n _ {+} ^ {2}}{B _ {+}} \eta C _ {4} ^ {2} \\ + \frac {1}{2 \eta} (\| \bar {\mathbf {w}} - \bar {\mathbf {w}} _ {1} \| ^ {2}) + \frac {1}{\eta} \\ \end{array} +$$ + +Then we have + +$$ +\begin{array}{l} \operatorname {E} \left[ \max _ {\mathbf {u}} F _ {k} \left(\widehat {\mathbf {w}} _ {T}, \mathbf {u}\right) - F _ {k} \left(\bar {\mathbf {w}} ^ {*}, \widehat {\mathbf {u}} _ {t}\right) \right] \leq \eta C _ {1} ^ {2} T + \eta \frac {n _ {+} ^ {2}}{B _ {+}} C _ {2} ^ {2} + \eta C _ {3} ^ {2} + 2 \frac {n _ {+} ^ {2}}{B _ {+}} \eta C _ {4} ^ {2} \\ + \frac {1}{2 \eta T} (\| \bar {\mathbf {w}} ^ {*} - \bar {\mathbf {w}} _ {1} \| ^ {2}) + \frac {1}{\eta T} \\ \end{array} +$$ + +where $\widehat{\mathbf{w}}_T$ is the average of $\bar{\mathbf{w}}_t, t = 1,\dots,T$ and $\widehat{\mathbf{u}}_T$ is the averaged solution of $\mathbf{u}_t$ , $\bar{\mathbf{w}}^*$ is the optimal solution to $F_{k}(\bar{\mathbf{w}})$ . The above implies that + +$$ +\begin{array}{l} \operatorname {E} [ F _ {k} (\widehat {\mathbf {w} _ {T}}) - \min _ {\bar {\mathbf {w}}} F _ {k} (\bar {\mathbf {w}}) ] \leq \eta (\frac {C}{\alpha^ {2} \beta^ {2}} + \frac {n _ {+} ^ {2}}{B _ {+}} \frac {1}{n _ {+} ^ {2} \alpha^ {2}} (1 + \frac {1}{\beta}) ^ {2} + (1 + \frac {1}{\alpha}) ^ {2} + 2 \frac {n _ {+} ^ {2}}{B _ {+}} \frac {4 C ^ {2}}{n _ {+} ^ {2} \alpha^ {2}} (1 + \frac {1}{\beta}) ^ {2}) \\ + \frac {1}{2 \eta} (\| \bar {\mathbf {w}} ^ {*} - \bar {\mathbf {w}} _ {1} \| ^ {2}) + \frac {1}{\eta T} \\ \leq \eta O \left(\frac {C}{\alpha^ {2} \beta^ {2}}\right) + \frac {1}{2 \eta} \left(\| \bar {\mathbf {w}} ^ {*} - \bar {\mathbf {w}} _ {1} \| ^ {2}\right) + \frac {1}{\eta T} \\ \end{array} +$$ + +It remains to apply the analysis in (Rafique et al., 2020, Theorem 4.1) to derive the convergence for the Moreau envelope of $F(\mathbf{w},\mathbf{s},s^{\prime})$ with a complexity in the order of $O(1 / \epsilon^6)$ by setting $\eta_{k}\propto 1 / k$ and $T_{k}\propto k^{2}$ and the total number of stages $K = O(1 / \epsilon^2)$ . \ No newline at end of file diff --git a/whenaucmeetsdrooptimizingpartialaucfordeeplearningwithnonconvexconvergenceguarantee/images.zip b/whenaucmeetsdrooptimizingpartialaucfordeeplearningwithnonconvexconvergenceguarantee/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..c9e4130a17c9e3a0767ee9df0df7b38cfb7f3212 --- /dev/null +++ b/whenaucmeetsdrooptimizingpartialaucfordeeplearningwithnonconvexconvergenceguarantee/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9a96624ad4f44e4d78bad5355ca74fbc14b7fea9d8371112f604b1074160e913 +size 2958329 diff --git a/whenaucmeetsdrooptimizingpartialaucfordeeplearningwithnonconvexconvergenceguarantee/layout.json b/whenaucmeetsdrooptimizingpartialaucfordeeplearningwithnonconvexconvergenceguarantee/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..bdb3f6bcd505c4f3269cc48c7fe254deedbd0ae0 --- /dev/null +++ b/whenaucmeetsdrooptimizingpartialaucfordeeplearningwithnonconvexconvergenceguarantee/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ef67e8da8124608830b4ced0edb617835621c296ffef62c1f9fc3a7796b8cd0b +size 1273362 diff --git a/whyshoulditrustyoubellmanthebellmanerrorisapoorreplacementforvalueerror/4315ef48-a286-46b8-a6bf-6bd456108739_content_list.json b/whyshoulditrustyoubellmanthebellmanerrorisapoorreplacementforvalueerror/4315ef48-a286-46b8-a6bf-6bd456108739_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..d5b8f9c110f4c4cd5328af16cfb4db812c034c34 --- /dev/null +++ b/whyshoulditrustyoubellmanthebellmanerrorisapoorreplacementforvalueerror/4315ef48-a286-46b8-a6bf-6bd456108739_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5dc7858d9dad5335ee9280c6f7be1dc7807f3e8f41a6b6e6844a52d0142c8286 +size 172469 diff --git a/whyshoulditrustyoubellmanthebellmanerrorisapoorreplacementforvalueerror/4315ef48-a286-46b8-a6bf-6bd456108739_model.json b/whyshoulditrustyoubellmanthebellmanerrorisapoorreplacementforvalueerror/4315ef48-a286-46b8-a6bf-6bd456108739_model.json new file mode 100644 index 0000000000000000000000000000000000000000..6f50c2130d16ba1d8d40a3083c3e361b59803a39 --- /dev/null +++ b/whyshoulditrustyoubellmanthebellmanerrorisapoorreplacementforvalueerror/4315ef48-a286-46b8-a6bf-6bd456108739_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a25c3640fdef37a436d4e129b2427fab1cfcd6c694589155c4ac135c479f02d1 +size 205764 diff --git a/whyshoulditrustyoubellmanthebellmanerrorisapoorreplacementforvalueerror/4315ef48-a286-46b8-a6bf-6bd456108739_origin.pdf b/whyshoulditrustyoubellmanthebellmanerrorisapoorreplacementforvalueerror/4315ef48-a286-46b8-a6bf-6bd456108739_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..62fc355c5985aba7cb6506cea505426bc0618843 --- /dev/null +++ b/whyshoulditrustyoubellmanthebellmanerrorisapoorreplacementforvalueerror/4315ef48-a286-46b8-a6bf-6bd456108739_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a22f54d2015e590156b57e46bdf9927a8751468511d06001b70887f73cbca8e4 +size 10232608 diff --git a/whyshoulditrustyoubellmanthebellmanerrorisapoorreplacementforvalueerror/full.md b/whyshoulditrustyoubellmanthebellmanerrorisapoorreplacementforvalueerror/full.md new file mode 100644 index 0000000000000000000000000000000000000000..a5ab5aa14f55d5eb597a3a0480b83bb62696fed7 --- /dev/null +++ b/whyshoulditrustyoubellmanthebellmanerrorisapoorreplacementforvalueerror/full.md @@ -0,0 +1,924 @@ +# Why Should I Trust You, Bellman? The Bellman Error is a Poor Replacement for Value Error + +Scott Fujimoto $^{12}$ David Meger $^{1}$ Doina Precup $^{13}$ Ofir Nachum $^{2}$ Shixiang Shane Gu $^{2}$ + +# Abstract + +In this work, we study the use of the Bellman equation as a surrogate objective for value prediction accuracy. While the Bellman equation is uniquely solved by the true value function over all state-action pairs, we find that the Bellman error (the difference between both sides of the equation) is a poor proxy for the accuracy of the value function. In particular, we show that (1) due to cancellations from both sides of the Bellman equation, the magnitude of the Bellman error is only weakly related to the distance to the true value function, even when considering all state-action pairs, and (2) in the finite data regime, the Bellman equation can be satisfied exactly by infinitely many suboptimal solutions. This means that the Bellman error can be minimized without improving the accuracy of the value function. We demonstrate these phenomena through a series of propositions, illustrative toy examples, and empirical analysis in standard benchmark domains. + +# 1. Introduction + +In reinforcement learning (RL), value functions are a measure of performance of a target policy. Value functions are an important quantity in RL as they can be used to inform decision-making. Consequently, many modern RL algorithms rely on a value function in some capacity (Mnih et al., 2015; Gu et al., 2016; Schulman et al., 2017; Fujimoto et al., 2018; Badia et al., 2020). + +The Bellman equation is a fundamental relationship in RL which relates the value of a state-action pair to the state-action pair that follows and is uniquely satisfied over all state-action pairs by the true value function. The existence of the Bellman equation suggests a straightforward approach + +to approximate value function learning, where a function is trained to minimize the Bellman error (the difference of both sides of the equation). The Bellman equation has played a prominent role in many historically significant approaches (Schweitzer & Seidmann, 1985; Baird, 1995; Bradtke & Barto, 1996; Antos et al., 2008; Sutton et al., 2009), as well as the more modern family of deep RL algorithms (Mnih et al., 2015; Lillicrap et al., 2015; Gu et al., 2016; Hessel et al., 2018). + +This work aims to better understand the relationship between the Bellman error and the accuracy of value functions through theoretical analysis and empirical study. We do so by focusing on the setting of policy evaluation, which presents the task of learning the value function of a target policy with data gathered from a possibly separate and unknown behavior policy. Policy evaluation, which is a subcomponent of many RL algorithms, is an ideal setting for evaluating value functions as it provides a clear metric of performance (value error: the distance to the true value function) and provides consistency across trials (via a fixed dataset and policy). Our key discoveries are as follows: + +The Bellman error is a poor replacement for value error. We find that given an arbitrary value function, low Bellman error does not indicate low value error. This problem is highlighted by experiments which show that value functions trained to minimize the Bellman error directly (Baird, 1995) have lower average Bellman error, but higher average value error, than value functions trained by iterative methods (Ernst et al., 2005). This inverse relationship holds even when evaluated over on-policy data (Figure 2), and only worsens further with off-policy data (Table 1). We show that this breakdown between Bellman error and value error is due to the following two phenomena. + +The magnitude of the Bellman error hides bias. The Bellman error of a value function is the difference between the value estimates on each side of the Bellman equation. If the value error of these estimates share the same sign (i.e. they are biased in the same direction), then they can cancel each other out. As a result, biased value functions will have lower Bellman error than unbiased value functions, even if they have the same absolute value error. + +Missing transitions breaks the Bellman equation. The Bellman equation is meant to consider the entire MDP and all state-action pairs. We show that when the Bellman equation is instead evaluated over an incomplete dataset, it can be satisfied exactly by infinitely many suboptimal solutions. It follows that minimizing the Bellman error over a finite dataset is not guaranteed to improve the accuracy of a value function. In our practical experiments, we show that when trained with off-policy data, methods which directly reduce the Bellman error find value functions that have near zero Bellman error, but large value error, for any state-action pair in the dataset. + +We demonstrate the existence of these phenomena through theoretical analysis, toy examples (Section 3), and experimentation in standard benchmarks (Section 4). We find that these problems extend beyond carefully designed counterexamples, as they are consistent across domains, and can appear in a clear, and often extreme, manner while using common algorithms with standard hyperparameters. + +Our work highlights problems with using the Bellman error as a signal or objective, particularly in the off-policy setting. We aim to provide a better understanding of performance gaps in RL methods: "why does directly minimizing the Bellman error perform poorly?" and Bellman equation-based loss functions: "why does the loss function not correspond with performance?" Our findings point to an underappreciation of the importance of finite data in widely used objectives and we encourage the community to place a higher emphasis on practical settings. + +# 2. Background + +Reinforcement learning (RL) is an optimization framework for tasks of a sequential nature (Sutton & Barto, 1998). Typically, tasks are defined as a Markov decision process $(\mathcal{S}, \mathcal{A}, \mathcal{R}, p, d_0, \gamma)$ , with state space $\mathcal{S}$ , action space $\mathcal{A}$ , reward function $\mathcal{R}$ , transition dynamics $p$ , initial state distribution $d_0$ , and discount factor $\gamma \in [0,1)$ . Actions are selected according to a policy $\pi$ (Puterman, 1994). + +The performance of a policy is measured by its discounted return $\mathbb{E}_{\pi}[\sum_{t}^{\infty}\gamma^{t}r(s_{t},a_{t})]$ . Policy evaluation is the task of approximating the value function $Q^{\pi}(s,a) = \mathbb{E}_{\pi}[\sum_{t}^{\infty}\gamma^{t}r(s_{t},a_{t})|s_{0} = s,a_{0} = a]$ of a target policy, given samples from an arbitrary dataset. A fundamental relationship regarding value functions is the Bellman equation (Bellman, 1957; Sutton & Barto, 1998): + +$$ +Q ^ {\pi} (s, a) = \mathbb {E} _ {r, s ^ {\prime} \sim p, a ^ {\prime} \sim \pi} [ r + \gamma Q ^ {\pi} \left(s ^ {\prime}, a ^ {\prime}\right) ], \tag {1} +$$ + +which relates the value of the current state-action pair to an expectation over the next state-action pair. Given an approximate value function $Q$ (distinguished from the true value function $Q^{\pi}$ by dropping the $\pi$ superscript) of a target + +policy $\pi$ , we denote the Bellman error $\epsilon(s, a)$ : + +$$ +\epsilon_ {Q} (s, a) := Q (s, a) - \mathbb {E} _ {r, s ^ {\prime} \sim p, a ^ {\prime} \sim \pi} \left[ r + \gamma Q \left(s ^ {\prime}, a ^ {\prime}\right) \right]. \tag {2} +$$ + +In policy evaluation, the main objective of interest is a loss (such as the MSE or L1) over the value error $\Delta_Q(s,a)$ , the distance of an approximate value function $Q$ to the true value function $Q^{\pi}$ of the target policy $\pi$ : + +$$ +\Delta_ {Q} (s, a) := Q (s, a) - Q ^ {\pi} (s, a). \tag {3} +$$ + +Value error is often unmeasurable, as the true value function $Q^{\pi}$ is unobtainable without the underlying MDP. While both the Bellman error and the value error are defined with respect to $Q$ , for simplicity we drop the subscript when the error terms are not in reference to a specific value function. + +A standard result is the Bellman equation is uniquely solved by the true value function (Bertsekas & Tsitsiklis, 1996). This can be re-framed in terms of Bellman and value error. + +Proposition 1. The Bellman error $\epsilon(s, a) = 0$ for all state-action pairs $(s, a) \in S \times \mathcal{A}$ , if and only if the value error $\Delta(s, a) = 0$ for all state-action pairs $(s, a) \in S \times \mathcal{A}$ . + +The Bellman equation can be used as an operator $\mathcal{T}Q(s,a) = \mathbb{E}_{r,s'\sim p,a'\sim \pi}[r + \gamma Q(s',a')]$ , which when applied repeatedly to any function over all state-action pairs will converge to the true value function (Puterman, 1994). + +Proposition 2. Let $Q_{1}, Q_{2}$ be value functions, where $Q_{2} = \mathcal{T}Q_{1}$ . $\max_{(s,a)} |\Delta_{Q_2}(s,a)| \leq \gamma \cdot \max_{(s,a)} |\Delta_{Q_1}(s,a)|$ . + +In instances where we cannot compute the Bellman error exactly, we can instead use the temporal difference (TD) error $\delta(i)$ , a sample-based approximation to the Bellman error which is computed over a transition $i := (s, a, r, s')$ , $\delta(i) := Q(s, a) - (r + \gamma Q(s', a'))$ , where $a' \sim \pi$ (Sutton, 1988). Note that the expected TD error is the Bellman error $\epsilon(s, a) = \mathbb{E}_{r, s', a'}[\delta(i)]$ , where the two errors are identical if the environment and policy are deterministic. + +A related concept is the projected Bellman error (Sutton & Barto, 1998; Patterson et al., 2022). Since a given function approximator (particularly linear functions) may be unable to represent value functions with low Bellman error, the projected Bellman error is a projection into the space that is representable by the function approximator. In our work, we consider expressive deep neural networks which can fully represent low Bellman error solutions (as shown by our experiments in Section 4), allowing us to consider the true Bellman error, and avoid the need for projections. + +We focus largely on two algorithms based on the Bellman equation, which update an approximate value function $Q$ , using samples from a finite dataset $\mathcal{D}$ . Bellman residual minimization (BRM) (Baird, 1995) directly minimizes the Bellman error over samples in the dataset $\mathcal{D}$ : + +$$ +\mathcal {L} _ {\mathrm {B R M}} (Q) := \frac {1}{| \mathcal {D} |} \sum_ {\mathcal {D}} \left(Q (s, a) - \left(r + \gamma Q \left(s ^ {\prime}, a ^ {\prime}\right)\right)\right) ^ {2}. \tag {4} +$$ + +Fitted Q-Evaluation (FQE) (Ernst et al., 2005; Le et al., 2019) is an iterative method with a similar update: + +$$ +\mathcal {L} _ {\mathrm {F Q E}} (Q) := \frac {1}{| \mathcal {D} |} \sum_ {\mathcal {D}} \left(Q (s, a) - \left(r + \gamma \bar {Q} \left(s ^ {\prime}, a ^ {\prime}\right)\right)\right) ^ {2}. \tag {5} +$$ + +The key distinction between the two algorithms is that BRM updates both $Q(s, a)$ and $Q(s', a')$ , while FQE only updates $Q(s, a)$ . This is because FQE uses $\bar{Q}(s', a')$ , a fixed target value function updated by $\bar{Q} \gets Q$ after a set number of time steps (possibly including every time step). + +# 3. Bellman Error as a Proxy for Value Error + +In this section, we analyze the relationship between the Bellman error and value error. Recall the key idea behind the Bellman equation is that it is uniquely satisfied by the true value function over all state-action pairs. In policy evaluation, the Bellman error of an approximate value function, computed over a set of state-action pairs, is used as a measurable proxy objective to the value error, the typically unmeasurable, true objective. + +While the Bellman error of the true value function is zero for all state-action pairs, in this section we show that the magnitude of the Bellman error of an approximate value function is only loosely related to the value error, even when considering the entire MDP. We show this breakdown by highlighting two fundamental problems with using the Bellman error as a surrogate for value error. + +# 3.1. (Infinite Data Analysis) Problem 1: The Magnitude of the Bellman Error Hides Bias + +The first problem is that the magnitude of the Bellman error is not guaranteed to correspond with the magnitude of the value error. This is because the Bellman error of a state-action pair is the difference between two values, which means there can exist cancellations in error terms, resulting in deceptively low Bellman error. + +To see this cancellation, consider the following: + +Observation 1. (Bellman error as a function of value error). For any state-action pair $(s, a) \in S \times \mathcal{A}$ , the Bellman error $\epsilon(s, a)$ can be defined as a function of the value error $\Delta$ + +$$ +\epsilon (s, a) = \Delta (s, a) - \gamma \mathbb {E} _ {s ^ {\prime}, \pi} [ \Delta (s ^ {\prime}, a ^ {\prime}) ]. \tag {6} +$$ + +Which follows directly from the Bellman equation: + +$$ +\begin{array}{l} \epsilon (s, a) = Q (s, a) - \mathcal {T} Q (s, a) (7) \\ = Q ^ {\pi} (s, a) + \Delta (s, a) - \mathcal {T} \left(Q ^ {\pi} (s, a) + \Delta (s, a)\right) (8) \\ = \Delta (s, a) - \gamma \mathbb {E} _ {s ^ {\prime}, \pi} [ \Delta (s ^ {\prime}, a ^ {\prime}) ]. (9) \\ \end{array} +$$ + +While this does mean that smaller value error terms (in magnitude) does result in smaller Bellman error, the sign of the + +value error terms can have a much larger impact. Keeping this relationship in mind, we can construct examples where the correspondence between the magnitude of the Bellman error and value error breaks down. + +Example 1. (Same value error, different Bellman error). Let $Q^{\pi}$ be the true value function for some MDP and policy $\pi$ . We define the following approximate value functions: + +$$ +Q _ {1} = Q ^ {\pi} + 1 \quad (\text {e r r o r i s c o r r e l a t e d}), \tag {10} +$$ + +$$ +Q _ {2} = Q ^ {\pi} \pm 1 \quad (\text {e r r o r i s u n c o r r e l a t e d}), \tag {11} +$$ + +where $\pm 1$ is a random variable with equal probability of being positive or negative. In both cases, the absolute value error will be 1 for any state-action pair. However, following Observation 1, for all state-action pairs, the Bellman error of $Q_{1}$ will be $1 - \gamma$ , while the expected absolute Bellman error of $Q_{2}$ will be much larger at $|\pm 1 - \gamma \mathbb{E}[\pm 1]| = 1$ . + +Example 2. (Same Bellman error, different value error). Suppose instead that we define $Q_{1} = Q^{\pi} + \frac{1}{1 - \gamma}$ . Then by Observation 1, the expected absolute Bellman error of $Q_{1}$ and $Q_{2}$ will both be 1 for any state-action pair, but the value error of $Q_{1}$ will be $\frac{1}{1 - \gamma}$ . For a common $\gamma = 0.99$ and any state-action pair this would make the value error of $Q_{1}$ be 100, compared to the value error of $Q_{2}$ at 1. + +In fact, we can also define $Q_{1}$ and $Q_{2}$ such that the magnitude of the Bellman error and value error appear inversely correlated. + +Proposition 3. (An inverse relationship between Bellman error and value error). For any MDP, discount factor $\gamma \in (0,1)$ , and $C > 0$ , we can define a value function $Q_{1}$ and a stochastic value function $Q_{2}$ such that for any state-action pair $(s,a) \in S \times \mathcal{A}$ + +$$ +\begin{array}{l} I. \left| \Delta_ {Q _ {1}} (s, a) \right| - \left| \Delta_ {Q _ {2}} (s, a) \right| > C, \\ 2. \mathbb {E} _ {Q _ {2}} \left[ | \epsilon_ {Q _ {2}} (s, a) | \right] - | \epsilon_ {Q _ {1}} (s, a) | > C. \\ \end{array} +$$ + +This means that when comparing value functions, lower absolute Bellman error over all state-action pairs does not guarantee lower value error for any state-action pair. + +However, there does exist a relationship between the value error of a given state-action pair, and the Bellman error of all relevant state-action pairs of an MDP. Let $d^{\pi}(s', a'|s, a)$ be the conditional discounted state-action occupancy $(1 - \gamma)\sum_{t=0}^{\infty}\gamma^{t}p^{\pi}((s, a) \to s', t)\pi(a'|s')$ , where $p^{\pi}((s, a) \to s', t)$ is the probability of leaving the state-action pair $(s, a)$ and visiting the state $s$ after $t$ time steps. + +Theorem 1. (Value error as a function of Bellman error). For any state-action pair $(s, a) \in S \times \mathcal{A}$ , the value error $\Delta(s, a)$ can be defined as a function of the Bellman error $\epsilon$ + +$$ +\Delta (s, a) = \frac {1}{1 - \gamma} \mathbb {E} _ {\left(s ^ {\prime}, a ^ {\prime}\right) \sim d ^ {\pi} (\cdot | s, a)} [ \epsilon \left(s ^ {\prime}, a ^ {\prime}\right) ]. \tag {12} +$$ + +Theorem 1 provides an upper bound on the absolute value + +![](images/2fa6fbcf9098632072982e84ab1e3fe5f8db5548e166346e94460834e09462b5.jpg) +Figure 1: A basic MDP. If $(s_0, a)$ is contained in the dataset but $(s_1, a)$ is not, by selecting the values $Q(s_0, a)$ and $Q(s_1, a)$ , we can construct examples where the Bellman error over the dataset is 0, but the value error is arbitrarily large, and vice-versa. + +error by considering the expected absolute Bellman error of future state-action pairs (according to $d^{\pi}$ ) + +$$ +| \Delta (s, a) | \leq \frac {1}{1 - \gamma} \mathbb {E} _ {\left(s ^ {\prime}, a ^ {\prime}\right) \sim d ^ {\pi} (\cdot | s, a)} [ | \epsilon \left(s ^ {\prime}, a ^ {\prime}\right) | ]. \tag {13} +$$ + +Since the right-hand side of this bound corresponds to the on-policy Bellman residual minimization objective with a L1 loss, this shows how the magnitude of on-policy Bellman error can be used as an objective for policy evaluation. However, we remark that this also highlights how the absolute Bellman error can correspond to a wide range of possible value error terms by also considering the lower bound. Let $d^{\pi}$ be the expected discounted state-action occupancy $\mathbb{E}_{s_0}[d^\pi (s,a|s_0)]$ over the initial state distribution. + +Proposition 4. (Bounds on value error). Let $C_{\text{max}} = \max_{s,a} |\epsilon(s,a)|$ and $C_{\text{avg}} = \mathbb{E}_{(s,a) \sim d^{\pi}} [|\epsilon(s,a)|]$ . + +1. $\frac{C_{\text{max}}}{1 + \gamma} \leq \max_{s, a} |\Delta(s, a)| \leq \frac{C_{\text{max}}}{1 - \gamma}$ , +2. $\frac{C_{avg}}{1 + \gamma} \leq \mathbb{E}_{(s,a) \sim d^{\pi}}[|\Delta(s,a)|] \leq \frac{C_{avg}}{1 - \gamma}$ , + +Furthermore, for any MDP and policy, there exists a value function such that the upper bound is an equality, and there exists a MDP, policy, and value function such that the lower bound is an equality. + +Similarly to Example 2, Proposition 4 says that if the average absolute Bellman error is 1, and the discount factor $\gamma = 0.99$ , then the average value error will fall somewhere between $\approx 0.5$ and 100. Consequently, this wide range of value error suggests that it is difficult to make meaningful comparisons between value functions using the magnitude of the Bellman error alone. + +# 3.2. (Finite Data Analysis) Problem 2: Missing Transitions Breaks the Bellman Equation + +A direct consequence of Theorem 1 is the uniqueness property of the Bellman equation. That is, if the Bellman error is 0 for all relevant state-action pairs which may be visited by the target policy, then the value error must also be 0 for these state-action pairs. However, if we examine a finite dataset instead of the entire MDP, this relationship also highlights that if any relevant transitions are missing, the Bellman equation, evaluated over the dataset, will no longer have a unique solution. This means that when considering a finite dataset, there can exist infinitely many suboptimal solutions which satisfy the Bellman equation exactly. + +Corollary 1. (The Bellman equation is not unique over incomplete datasets). If there exists a state-action pair $(s', a')$ not contained in the dataset $\mathcal{D}$ , where the state-action occupancy $d^{\pi}(s', a'|s, a) > 0$ for some $(s, a) \in \mathcal{D}$ , then there exists a value function and $C > 0$ such that + +1. For all $(\hat{s},\hat{a})\in \mathcal{D}$ , the Bellman error $\epsilon (\hat{s},\hat{a}) = 0$ +2. There exists $(s,a)\in \mathcal{D}$ , such that the value error $\Delta (s,a) = C$ + +We can find examples of this phenomenon in very simple MDPs. Consider the two-state MDP defined in Figure 1, with reward $r = 0$ for all state-action pairs. If the dataset contains the sole transition $(s_0, a, r, s_1)$ , then we can construct examples where for all transitions in the dataset (the sole transition in this instance) the Bellman error is 0 but the value error is arbitrarily large, and conversely, where the Bellman error is arbitrarily large but the value error is 0. + +Example 1. (0 Bellman error, $C$ value error). Since the reward is 0 everywhere, the true value of any state-action pair must be 0. However, by choosing the value of the missing transition $Q(s_{1}, a)$ to cancel with the value of the transition in the dataset $Q(s_{0}, a)$ , the Bellman error of the sole state-action pair in the dataset is 0. + +$$ +Q \left(s _ {0}, a\right) = C, \quad \epsilon \left(s _ {0}, a\right) = C - \gamma \frac {1}{\gamma} C = 0, \tag {14} +$$ + +$$ +Q (s _ {1}, a) = \frac {1}{\gamma} C. \quad \longrightarrow \quad \Delta (s _ {0}, a) = Q (s _ {0}, a) = C. +$$ + +Example 2. ( $C$ Bellman error, 0 value error). Similarly, we can set the value of the state-action pair in the dataset $Q(s_0, a)$ to be the correct value of 0, and instead choose the value of the missing state-action pair $Q(s_1, a)$ to make the Bellman error of $(s_0, a)$ equal $C$ . + +$$ +Q \left(s _ {0}, a\right) = 0, \quad \epsilon \left(s _ {0}, a\right) = 0 + \gamma \frac {1}{\gamma} C = C, \tag {15} +$$ + +$$ +Q (s _ {1}, a) = - \frac {1}{\gamma} C. \quad \Longrightarrow \quad \Delta (s _ {0}, a) = Q (s _ {0}, a) = 0. +$$ + +Note that these examples do not involve modifying the environment in an extreme adversarial manner, and instead occur due to the value estimate of the missing state-action pair. As a result, methods which directly minimize the Bellman error may influence target values to achieve low Bellman error over the dataset without necessarily improving the value function. Even when the target value is not directly modified, scenarios such as Example 1, where the current and missing values are similar, can cause deceptively low Bellman error, without an accurate value function. + +# 4. Experiments + +Everything we have discussed thus far has suggested that the Bellman error may not be a representative surrogate for value error. We now examine if these problems occur in practice. Recall our main observations are (1) the magnitude of the Bellman error is smaller for biased value functions + +![](images/b2f3b22edf8b58b8e9490eabb20e9c6a3c44fe86662df914d1c94dba97e3a9bf.jpg) + +![](images/7191f267946adf724e7e6bcbbd788ff1a1a25968e6efa9db5cc63477d7ec61b1.jpg) + +![](images/9b5e39ce3cd515a2713561a455cb2af3fb1a5a6e6ed04912be9b57bddcc5260a.jpg) + +![](images/d8e8d1cf3e22f8d3cca2032e86df384aaa116a7f712e83815454021c43040949.jpg) + +![](images/aa06898c4586b0e1b6030a3918ca56f17cf194a0ee459fb9c70352a4d8077e55.jpg) + +![](images/d37fc9fe5b97c012d5da3d0b70e6147add6730516232c8e4d5211e452bef70fe.jpg) +Figure 2: Can the on-policy Bellman error be used as a proxy for value error? We compare the mean squared Bellman error (top row) with the normalized absolute value error (bottom row) of learning curves of value functions trained with a dataset of 1m on-policy transitions. While clearly the Bellman error is lowest for BRM (which directly minimizes Bellman error) followed by FQE (which indirectly minimizes Bellman error) followed by MC (which minimizes the Monte-Carlo estimate of value error), this ordering is not reflected in value error. This shows overfitting of the Bellman error objective is possible even with on-policy data and that we cannot determine value prediction accuracy by examining the magnitude of Bellman error alone. + +![](images/2f41f38fa11afc4de39fee2370a2699411a46917a0502d9a00235fea6d7d829b.jpg) +BRM + +![](images/b3b1ed57f51011ea662fdb6adb30ef15519d2f833ca6884f609f280859eb70c9.jpg) +FQE + +![](images/d60c974d12c462b520211c89bf69e464e01c0d5b31846cca49bde6c5e1f399c6.jpg) +MC + +![](images/79b2d34d187a94c81682f0c1e242efbd88329c62746157e85aa255ff98771620.jpg) + +due to cancellations caused from both sides of the Bellman equation (Section 3.1) and (2) the relationship between Bellman error and value error is broken if the dataset is missing relevant transitions (Section 3.2). We find that both of these concerns exist clearly in standard benchmark environments. + +Our experiments also demonstrate the effectiveness of Fitted Q-Evaluation (FQE) (Ernst et al., 2005; Le et al., 2019) as a policy evaluation method, irrespective of its tendency to find value functions with high Bellman error. While FQE is also based on the Bellman equation, we argue that its objective is not to directly minimize the Bellman error, but rather to imitate the Bellman operator, meaning that low error to an accurate target can be a more important factor than the Bellman error (Section 4.4). + +# 4.1. Experimental Design + +We first outline the experimental choices used in our empirical evaluation. Our experiments consider the setting of policy evaluation. Comprehensive details can be found in Appendix E. The task can be broken down as follows: + +1. The target policy is generated from an off-the-shelf RL algorithm. +2. The behavior policy collects a training and test dataset. +3. The value function is trained using the dataset, target policy, and policy evaluation algorithm. +4. Metrics of the value function are computed over the test dataset. + +Policies. The target policy is an expert deterministic policy from a fully trained TD3 agent (Fujimoto et al., 2018). The behavior policy is a noisy version of the target policy. Each dataset is assigned a noise value corresponding to both the probability of selecting a uniformly random action, as well as the standard deviation of Gaussian noise added to the actions (noting that actions are normalized to be in the range $[-1, 1]$ ). We use uniformly random actions to ensure that not all actions in the dataset are centered around the target policy, and Gaussian noise to ensure that every action is distinct from actions selected by the target policy. The on-policy behavior is generated without noise. + +Algorithms. We use Bellman residual minimization (BRM) (Baird, 1995), Fitted Q-Evaluation (FQE) (Ernst et al., 2005; Le et al., 2019), and Monte Carlo estimates (MC) (Sutton & Barto, 1998). We use these algorithms due to their prevalence in the literature, and to highlight differences between methods which minimize the Bellman error, directly (BRM) or indirectly (FQE), and methods which minimize value error (MC). + +Metrics. We compare the mean squared Bellman error, due to its common use (Baird, 1995; Sutton & Barto, 1998), with the absolute value error. For better interpretability across tasks, we normalize the value error by dividing by a constant term equal to the average true value function sampled on-policy. The true value function is estimated with on-policy rollouts from the target policy. In Appendix D.1 we report results with variations of these metrics. + +![](images/602d163ee915b000f5455482cdc48ce9079ad3ee7748fbf645725186aa8e35e5.jpg) +Figure 3: Does bias explain the non-correspondence between the Bellman error and value error? We train value functions over a single on-policy trajectory in the HalfCheetah environment (1000 transitions, with termination). As a result, every relevant transition is contained in the dataset. We display the Bellman error (left) and unnormalized value error (right) for every transition in the trajectory. In the table, we record the average absolute Bellman error (BE), value error (VE), and ratio between these terms. By Proposition 4, with a discount $\gamma = 0.99$ , the ratio between mean absolute Bellman and value error is bounded by [0.503, 100]. Our results show that both the upper and lower bound can be approached in practice. Visually, we can see that the magnitude of the Bellman error is influenced more by the clusters of similar value error (size and direction) for ■ BRM and ■ FQE than the magnitude of the value error. This experiment is repeated with different domains in Appendix A.3. + +**Environments.** Our experiments consider standard benchmark continuous-action tasks through the MuJoCo simulator (Todorov et al., 2012; Brockman et al., 2016), as it is deterministic and high-dimensional. Determinism in the dynamics is desirable as it, alongside a deterministic policy, makes the TD error identical to the Bellman error. This means we can compute the Bellman error exactly and ignore the double sampling issue (Baird, 1995). + +# 4.2. The On-Policy Bellman Error is a Poor Metric + +In Section 3.1, we showed that it is possible for a biased value function to have lower Bellman error over all possible state-action pairs, while having higher value error, than an unbiased value function. In this section we show that this problem exists in practical settings. This means that the magnitude of Bellman error is a poor metric for comparing value functions, even when working with on-policy data. + +We begin by comparing the Bellman error and the value error of value functions trained, and evaluated, with on-policy data. The results are displayed in Figure 2. + +Methods which minimize the Bellman error have lower Bellman error. BRM directly minimizes the Bellman error, FQE uses an iterative approach based on the Bellman equation, and MC does not use the Bellman equation in its objective. Therefore it is unsurprising that in Figure 2, the value functions trained by BRM have the lowest average Bellman error, followed by FQE, and then MC. + +Lower Bellman error does not mean lower value error. Although the value functions trained by FQE and MC have much higher average absolute Bellman error over the on-policy dataset (especially in Ant and Humanoid) than BRM, the value functions trained by BRM typically have the highest average value error. The learning curves in Figure 2 demonstrate that it is possible to find value functions where the relative ordering in Bellman error is not respected by the relative ordering in value error, even when working with large (1M) on-policy datasets. + +Methods which minimize the Bellman error have correlated error (and thereby have a higher ratio of value error to Bellman error). To better understand the importance of bias in minimizing the Bellman error, we train value functions over a single trajectory. This allows us to consider a dataset without missing transitions and examine the error terms of every transition in the trajectory. We display the results in Figure 3. As the Bellman error is determined by the difference between the value error of the current and succeeding state (Observation 1), Figure 3 shows the magnitude of the Bellman error is influenced more by correlated bias than the magnitude the value error. + +The Bellman error is a valid on-policy objective. In Appendix A.1 we display the correlation coefficient between the average absolute Bellman error and value error, when isolating functions by the algorithm which trained them. We find that when the error terms are evaluated on-policy, there is a strong correlation between the error terms for a fixed algorithm. This corroborates with Equation (13) which shows that the expected absolute Bellman error of on-policy samples upper bounds value error, and suggests that when we isolate by algorithm, value functions are biased similarly. This means that even if the Bellman error is a poor metric for comparison, the Bellman error can be a usable objective for on-policy evaluation and explains the decent value prediction accuracy of BRM in Figure 2. + +Variations of the Bellman error as a metric. In Section 3.1, we showed the magnitude of the Bellman error hides bias and is therefore a poor metric for comparing value functions. Conceivably, one could incorporate a measure of bias into the Bellman error. For example, following Theo + +
AlgorithmDatasetHalfCheetahHopperWalker2dAntHumanoid
BEVEBEVEBEVEBEVEBEVE
BRMOn-Policy0.960.03√0.170.08√< 0.01< 0.01√2.540.16√1.110.06√
0.12.020.363.500.472.100.375.360.810.530.69
0.20.700.471.860.611.070.451.270.680.280.80
0.30.340.491.110.620.550.430.630.620.160.70
0.40.180.481.080.600.330.410.380.620.130.63
0.50.090.500.230.630.260.430.350.560.070.63
FQEOn-Policy38.960.03√0.090.01√0.05< 0.01√37.950.11√45.580.02√
0.11375.710.13√17.560.03√88.750.04√838.390.11√137.830.03√
0.22441.750.12√57.240.05√147.770.07√984.950.14√342.160.06√
0.31219.080.1895.720.07√113.130.11708.500.19√633.680.09√
0.4244.470.21214.920.40139.460.12522.050.26575.560.09√
0.5144.040.25169.780.2235.380.21343.370.30483.690.10√
+ +Table 1: Is the Bellman error an effective off-policy objective? We display the final mean squared Bellman error (BE) and the final normalized absolute value error (VE) of functions trained with datasets gathered by increasingly noisy versions of the target policy. The value of the dataset refers to the noise level. $\checkmark$ is used to mark if performance is within 0.1 normalized value error of the on-policy value error. FQE consistently outperforms BRM while having significantly higher Bellman error, particularly when off-policy. Additionally, while the value error of BRM increases substantially from on-policy to off-policy datasets, the Bellman error remains low for all datasets, showing that it is possible to train a function with low Bellman error, regardless of its accuracy with respect to the true value function. + +rem 1, the exact value error can be computed from on-policy data. However, when working with incomplete datasets we can always find functions which have zero Bellman error and arbitrarily high value error for any state-action pair in the dataset (Corollary 1). Consequently, there cannot exist a metric without failure cases for finite off-policy datasets. + +# 4.3. The Off-Policy Bellman Error is a Poor Objective + +In the previous section, we showed that the Bellman error cannot be used to rank arbitrary value functions according to their accuracy. Regardless, the on-policy accuracy of BRM is competitive (albeit weaker) with FQE and MC. This suggests the possibility that the Bellman error could be used as an objective for off-policy evaluation as well, irrespective of its shortcomings as a metric. In this section we show that this is not the case: the Bellman error makes for a poor off-policy objective. + +Recall in Section 3.2 we showed that if there are missing transitions in the dataset, the Bellman equation can be satisfied exactly by infinitely many suboptimal solutions. This is largely a problem for finite datasets generated off-policy, as they are guaranteed to be missing relevant transitions. Consequently, the Bellman error, evaluated over an off-policy dataset, should not be a meaningful objective for policy evaluation. In Table 1 we confirm this observation, by repeating the policy evaluation experiment from the previous section with various off-policy datasets. + +The Bellman error is an ineffective off-policy objective. Table 1 shows the performance of BRM suffers a clear drop when moving to the off-policy datasets. Furthermore, despite this performance drop, the average Bellman error of + +value functions trained by BRM remains low for all datasets, which shows that the empirical Bellman error, evaluated over an off-policy dataset, can be optimized independently of value error. Moreover, we remark that our experiments are in deterministic domains, and as such, this problem is independent from the double sampling problem with BRM (Baird, 1995). These results support our theoretical analysis (Corollary 1) which showed that with missing transitions, the Bellman error is no longer guaranteed to relate to value error. + +We also include results of the FQE algorithm on these datasets. While FQE also suffers in performance with additional noise added to the behavior policy, this performance drop is much less drastic. On every off-policy dataset, FQE outperforms BRM, and in some instances, even outperforms BRM trained with the on-policy dataset. The success of FQE shows that the failure of BRM is due to its objective (of Bellman error), rather than the difficulty of the task. + +# 4.4. Additional Insights about FQE + +The success of FQE for policy evaluation is supported by many examples in the literature (Voloshin et al., 2021; Fu et al., 2021; Fujimoto et al., 2021), as well as control (Mnih et al., 2015; Lillicrap et al., 2015; Hessel et al., 2018). The results in the previous sections may raise new questions surrounding the performance, and behavior, of FQE. + +Does FQE provide a better metric? In Appendix A.2 we examine the relationship of the FQE loss function to value error. This loss bears no closer relationship to value error than the Bellman error does. This is not contradictory to the success of FQE because the objective is iterative and evolves during training. As a result, the objective of FQE + +is not to minimize the Bellman error, but rather to imitate the Bellman operator, where the Bellman equation is used to construct a regression target. This means that FQE does not provide a better metric than the Bellman error, only a better optimization process. + +How does FQE handle missing data? The success of FQE is best understood as the repeated application of the Bellman operator. Recall the Bellman operator, applied globally to every state-action pair, ensures a reduction in the max value error (Proposition 2). We can instead consider the Bellman operator applied over a finite dataset $\mathcal{D}$ . + +Proposition 5. (FQE improvement condition). Let $Q_{1}, Q_{2}$ be value functions, where $Q_{2} = \mathcal{T}Q_{1}$ . If $\gamma \cdot \max_{(s,a) \in \mathcal{D}} |\mathbb{E}_{(s',a') \sim p(\cdot | s,a),\pi}[\Delta_{Q_{1}}(s',a')]| < \max_{(s,a) \in \mathcal{D}} |\Delta_{Q_{1}}(s,a)|$ then $\max_{(s,a) \in \mathcal{D}} |\Delta_{Q_{2}}(s,a)| < \max_{(s,a) \in \mathcal{D}} |\Delta_{Q_{1}}(s,a)|$ . + +Informally, Proposition 5 says that if the target used by FQE is sufficiently accurate relative to the accuracy of the value function over state-action pairs in the dataset, then an iteration of FQE will improve the value estimate over the dataset. This means that FQE can overcome missing data through generalization and explains the strong performance of FQE in some of the off-policy settings in Table 1. BRM on the other hand, inhibits generalization in the target, as the target can be directly modified to reduce Bellman error, which can result in overfitting. + +FQE relies on generalization during training. While the importance of generalization to FQE is a simple observation, it has significant implications. Firstly, this means the Bellman equation requires generalization during training. This is distinct from typical machine learning settings, where generalization is an exercise which occurs after training. This is problematic because if it is difficult to ensure good generalization after training, it is only more difficult to ensure good generalization during training. This highlights the importance of feature learning (Jaderberg et al., 2016; Yang & Nachum, 2021), as neural network features are unlikely to be relevant early in training. + +Another implication is hyperparameter sensitivity. It is a well known problem that RL algorithms are sensitive to small adjustments (Henderson et al., 2017; Engstrom et al., 2019). A necessity of generalization at training time causes the significance of correct hyperparameters to be amplified. + +# 5. Related Work + +The role of the Bellman error has been considered in depth in the literature, in the context of bounds on the performance of a greedy policy in relation to the norm of the Bellman error (Williams & Baird, 1993; Singh & Yee, 1994; Bertsekas & Tsitsiklis, 1996; Heger, 1996; Munos, 2003; 2007; Farahmand et al., 2010). + +In a similar vein to our work, Kolter (2011) remarks that with off-policy sampling, the projected solution to linear TD can have arbitrarily large Bellman error, but focuses on the approximate fixed point, rather than any discrepancy between Bellman error and value error. Geist et al. (2017) evaluate the Bellman error as an objective for policy optimization. Although they examine a different setting, they arrive at a related conclusion, the signal from the Bellman error is only meaningful if the sampling distribution corresponds to the optimal policy. + +The Bellman error has additional concerns that our paper does not discuss. The double sampling problem (Baird, 1995) is that the gradient of the Bellman error is biased if estimated from a single transition in a stochastic MDP. The double sampling issue provides motivation for many recent BRM methods (Feng et al., 2019; Zhu & Ying, 2020; Zhang et al., 2020; Bas-Serrano et al., 2021). We avoid this issue in our analysis by focusing on deterministic environments, but remark that BRM is likely to perform worse with stochasticity. Sutton & Barto (1998) show that in scenarios where the representation of states is not uniquely defined, there exist examples where the Bellman error is not learnable, as the structure of the MDP can not be determined from data alone, and thus the true Bellman error cannot be computed. + +The success of FQE is supported by many examples in the literature for off-policy evaluation tasks (Voloshin et al., 2021; Fu et al., 2021; Fujimoto et al., 2021), as well as control applications with deep RL (Mnih et al., 2015; Lillicrap et al., 2015; Hessel et al., 2018). Our results help explain the effectiveness of FQE, but also highlights challenges of the importance of generalization during training. + +Our observations connect strongly to offline RL (Lange et al., 2012; Levine et al., 2020), where offline policy evaluation is used in conjunction with policy learning. Previous work has observed that the value function of FQE methods can diverge when computed offline due to poor estimates in the target (Fujimoto et al., 2019b;a). Similar to our work, empirical properties of deep value functions which induce instability or divergence have been studied (Fu et al., 2019; Achiam et al., 2019) but have not considered the role of the objective itself. Several recent papers examined the sample complexity of offline RL, noting that without access to on-policy data, the number of necessary transitions is exponential with respect to the horizon (Wang et al., 2020; Zanette, 2021; Chen et al., 2021; Xiao et al., 2021). + +In the context of offline model selection, several papers have observed that TD error is a weak baseline with poor correspondence to policy performance, remarking that it is a measure of value function accuracy rather than quality of the policy, but provide little analysis (Irpan et al., 2019; Paine et al., 2020; Tang & Wiens, 2021). Our findings help explain these results by showing that Bellman (and + +TD) error are not an effective measure of value accuracy, and cannot rank models, even with on-policy data. These empirically minded observations caution against traditional results which suggest Bellman error as a metric for model selection (Farahmand & Szepesvári, 2011). + +# 6. Conclusion + +In this paper, we study the effectiveness of the Bellman error as a proxy for value error. We focus on two problems. Firstly, the magnitude of the Bellman error is lower for biased value functions, as there are cancellations for temporally correlated error terms. This means that the magnitude of the Bellman error is not viable metric for selecting functions with lower value error, even when considering all state-action pairs. Secondly, the Bellman equation is only uniquely solved by the true value function when computed over the entire MDP. When working with finite or incomplete datasets, we show there exists infinitely many suboptimal value functions which satisfy the Bellman equation. This means the Bellman error is not a viable objective over incomplete datasets, such as the off-policy setting. + +We demonstrate these problems theoretically, with toy problems, and empirically on standard benchmark environments. The lack of correlation between Bellman error and value error is highlighted by an empirical comparison between Bellman Residual Minimization (BRM) (Baird, 1995) and Fitted Q-Evaluation (FQE) (Ernst et al., 2005; Le et al., 2019), which shows that value functions trained with BRM consistently have much lower Bellman error, but much higher value error than value functions trained with FQE. + +While much of the modern literature surrounding Bellman error minimization emphasizes the double sampling problem (Dai et al., 2018; Feng et al., 2019; Saleh & Jiang, 2019; Bas-Serrano et al., 2021), our analysis shows much more fundamental problems; Bellman error is not guaranteed to closely correspond with value error and solving the Bellman equation over a finite dataset does not guarantee an accurate value function. While such problems may be alluded to in prior work (Kolter, 2011; Geist et al., 2017; Irpan et al., 2019), to the best of our knowledge we are the first to formalize theorems and propositions in both infinite and finite data regimes, list out illustrative examples, and evaluate empirically on practical settings. We hope our findings provide a better understanding of Bellman equation-based objectives to both practitioners and theorists alike. + +# Acknowledgements + +Scott Fujimoto is supported by a NSERC scholarship. We would like to thank Dale Schuurmans, Pablo Samuel Castro, Esther Ugolini, Edward Smith, and Wei-Di Chang for helpful feedback and discussions. + +# References + +Achiam, J., Knight, E., and Abbeel, P. Towards characterizing divergence in deep q-learning. arXiv preprint arXiv:1903.08894, 2019. +Antos, A., Szepesvári, C., and Munos, R. Learning near-optimal policies with bellman-residual minimization based fitted policy iteration and a single sample path. Machine Learning, 71(1):89-129, 2008. +Badia, A. P., Piot, B., Kapturowski, S., Sprechmann, P., Vitvitskyi, A., Guo, Z. D., and Blundell, C. Agent57: Outperforming the atari human benchmark. In International Conference on Machine Learning, pp. 507-517. PMLR, 2020. +Baird, L. Residual algorithms: Reinforcement learning with function approximation. In Machine Learning Proceedings 1995, pp. 30-37. Elsevier, 1995. +Bas-Serrano, J., Curi, S., Krause, A., and Neu, G. Logistic q-learning. In International Conference on Artificial Intelligence and Statistics, pp. 3610-3618. PMLR, 2021. +Bellman, R. Dynamic Programming. Princeton University Press, 1957. +Bertsekas, D. P. and Tsitsiklis, J. N. Neuro-Dynamic Programming. Athena scientific Belmont, MA, 1996. +Bradtke, S. J. and Barto, A. G. Linear least-squares algorithms for temporal difference learning. Machine learning, 22(1):33-57, 1996. +Brockman, G., Cheung, V., Pettersson, L., Schneider, J., Schulman, J., Tang, J., and Zaremba, W. Openai gym, 2016. +Chen, L., Scherrer, B., and Bartlett, P. L. Infinite-horizon offline reinforcement learning with linear function approximation: Curse of dimensionality and algorithm. arXiv preprint arXiv:2103.09847, 2021. +Dai, B., Shaw, A., Li, L., Xiao, L., He, N., Liu, Z., Chen, J., and Song, L. Sbeed: Convergent reinforcement learning with nonlinear function approximation. In International Conference on Machine Learning, pp. 1125-1134. PMLR, 2018. +Engstrom, L., Ilyas, A., Santurkar, S., Tsipras, D., Janoos, F., Rudolph, L., and Madry, A. Implementation matters in deep rl: A case study onppo and trpo. In International Conference on Learning Representations, 2019. +Ernst, D., Geurts, P., and Wehenkel, L. Tree-based batch mode reinforcement learning. Journal of Machine Learning Research, 6(Apr):503-556, 2005. + +Farahmand, A.-m. and Szepesvári, C. Model selection in reinforcement learning. Machine learning, 85(3):299-332, 2011. +Farahmand, A. M., Munos, R., and Szepesvári, C. Error propagation for approximate policy and value iteration. In Advances in Neural Information Processing Systems, 2010. +Feng, Y., Li, L., and Liu, Q. A kernel loss for solving the bellman equation. Advances in Neural Information Processing Systems, 32:15456-15467, 2019. +Fu, J., Kumar, A., Soh, M., and Levine, S. Diagnosing bottlenecks in deep q-learning algorithms. In International Conference on Machine Learning, pp. 2021-2030. PMLR, 2019. +Fu, J., Norouzi, M., Nachum, O., Tucker, G., Wang, Z., Novikov, A., Yang, M., Zhang, M. R., Chen, Y., Kumar, A., Paduraru, C., Levine, S., and Paine, T. Benchmarks for deep off-policy evaluation. In International Conference on Learning Representations, 2021. +Fujimoto, S., van Hoof, H., and Meger, D. Addressing function approximation error in actor-critic methods. In International Conference on Machine Learning, volume 80, pp. 1587-1596. PMLR, 2018. +Fujimoto, S., Conti, E., Ghavamzadeh, M., and Pineau, J. Benchmarking batch deep reinforcement learning algorithms. arXiv preprint arXiv:1910.01708, 2019a. +Fujimoto, S., Meger, D., and Precup, D. Off-policy deep reinforcement learning without exploration. In International Conference on Machine Learning, pp. 2052-2062, 2019b. +Fujimoto, S., Meger, D., and Precup, D. A deep reinforcement learning approach to marginalized importance sampling with the successor representation. In Proceedings of the 38th International Conference on Machine Learning, volume 139, pp. 3518-3529. PMLR, 2021. +Geist, M., Piot, B., and Pietquin, O. Is the bellman residual a bad proxy? In Proceedings of the 31st International Conference on Neural Information Processing Systems, pp. 3208-3217, 2017. +Gu, S., Lillicrap, T., Sutskever, I., and Levine, S. Continuous deep q-learning with model-based acceleration. In International Conference on Machine Learning, pp. 2829-2838, 2016. +Haarnoja, T., Zhou, A., Abbeel, P., and Levine, S. Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor. In International Conference on Machine Learning, volume 80, pp. 1861-1870. PMLR, 2018a. + +Haarnoja, T., Zhou, A., Hartikainen, K., Tucker, G., Ha, S., Tan, J., Kumar, V., Zhu, H., Gupta, A., Abbeel, P., et al. Soft actor-critic algorithms and applications. arXiv preprint arXiv:1812.05905, 2018b. +Heger, M. The loss from imperfect value functions in expectation-based and minimax-based tasks. Machine Learning, 22(1):197-225, 1996. +Henderson, P., Islam, R., Bachman, P., Pineau, J., Precup, D., and Meger, D. Deep reinforcement learning that matters. In AAAI Conference on Artificial Intelligence, 2017. +Hessel, M., Modayil, J., Van Hasselt, H., Schaul, T., Ostrovski, G., Dabney, W., Horgan, D., Piot, B., Azar, M., and Silver, D. Rainbow: Combining improvements in deep reinforcement learning. In Thirty-second AAAI conference on artificial intelligence, 2018. +Irpan, A., Rao, K., Bousmalis, K., Harris, C., Ibarz, J., and Levine, S. Off-policy evaluation via off-policy classification. Advances in Neural Information Processing Systems, 32:5437-5448, 2019. +Jaderberg, M., Mnih, V., Czarnecki, W. M., Schaul, T., Leibo, J. Z., Silver, D., and Kavukcuoglu, K. Reinforcement learning with unsupervised auxiliary tasks. arXiv preprint arXiv:1611.05397, 2016. +Kakade, S. and Langford, J. Approximately optimal approximate reinforcement learning. In International Conference on Machine Learning, volume 2, pp. 267-274, 2002. +Kingma, D. and Ba, J. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. +Kolter, J. Z. The fixed points of off-policy td. In Advances in Neural Information Processing Systems, 2011. +Lange, S., Gabel, T., and Riedmiller, M. Batch reinforcement learning. In Reinforcement learning, pp. 45-73. Springer, 2012. +Le, H., Voloshin, C., and Yue, Y. Batch policy learning under constraints. In International Conference on Machine Learning, pp. 3703-3712. PMLR, 2019. +Levine, S., Kumar, A., Tucker, G., and Fu, J. Offline reinforcement learning: Tutorial, review, and perspectives on open problems. arXiv preprint arXiv:2005.01643, 2020. +Lillicrap, T. P., Hunt, J. J., Pritzel, A., Heess, N., Erez, T., Tassa, Y., Silver, D., and Wierstra, D. Continuous control with deep reinforcement learning. arXiv preprint arXiv:1509.02971, 2015. + +Mnih, V., Kavukcuoglu, K., Silver, D., Rusu, A. A., Veness, J., Bellemare, M. G., Graves, A., Riedmiller, M., Fidjeland, A. K., Ostrovski, G., et al. Human-level control through deep reinforcement learning. Nature, 518(7540): 529-533, 2015. +Munos, R. Error bounds for approximate policy iteration. In ICML, volume 3, pp. 560-567, 2003. +Munos, R. Performance bounds in 1_p-norm for approximate value iteration. SIAM journal on control and optimization, 46(2):541-561, 2007. +Paine, T. L., Paduraru, C., Michi, A., Gulcehre, C., Zolna, K., Novikov, A., Wang, Z., and de Freitas, N. Hyperparameter selection for offline reinforcement learning. arXiv preprint arXiv:2007.09055, 2020. +Paszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J., Chanan, G., Killeen, T., Lin, Z., Gimelshein, N., Antiga, L., et al. Pytorch: An imperative style, high-performance deep learning library. In Advances in Neural Information Processing Systems, pp. 8024-8035, 2019. +Patterson, A., White, A., and White, M. A generalized projected bellman error for off-policy value estimation in reinforcement learning. Journal of Machine Learning Research, 23(145):1-61, 2022. +Puterman, M. L. Markov Decision Processes: Discrete Stochastic Dynamic Programming. John Wiley & Sons, Inc., 1994. +Saleh, E. and Jiang, N. Deterministic bellman residual minimization. In Proceedings of Optimization Foundations for Reinforcement Learning Workshop at NeurIPS, 2019. +Schulman, J., Wolski, F., Dhariwal, P., Radford, A., and Klimov, O. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017. +Schweitzer, P. J. and Seidmann, A. Generalized polynomial approximations in markovian decision processes. Journal of mathematical analysis and applications, 110(2):568-582, 1985. +Singh, S. P. and Yee, R. C. An upper bound on the loss from approximate optimal-value functions. Machine Learning, 16(3):227-233, 1994. +Sutton, R. S. Learning to predict by the methods of temporal differences. Machine learning, 3(1):9-44, 1988. +Sutton, R. S. and Barto, A. G. Reinforcement learning: An introduction, volume 1. MIT press Cambridge, 1998. +Sutton, R. S., Maei, H. R., Precup, D., Bhatnagar, S., Silver, D., Szepesvári, C., and Wiewiora, E. Fast gradient-descent methods for temporal-difference learning with + +linear function approximation. In Proceedings of the 26th Annual International Conference on Machine Learning, pp. 993-1000, 2009. +Tang, S. and Wiens, J. Model selection for offline reinforcement learning: Practical considerations for healthcare settings. In Machine Learning for Healthcare Conference, pp. 2-35. PMLR, 2021. +Todorov, E., Erez, T., and Tassa, Y. Mujoco: A physics engine for model-based control. In IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pp. 5026-5033. IEEE, 2012. +Voloshin, C., Le, H. M., Jiang, N., and Yue, Y. Empirical study of off-policy policy evaluation for reinforcement learning. In Thirty-fifth Conference on Neural Information Processing Systems Datasets and Benchmarks Track (Round 1), 2021. +Wang, R., Foster, D., and Kakade, S. M. What are the statistical limits of offline rl with linear function approximation? In International Conference on Learning Representations, 2020. +Williams, R. J. and Baird, L. Tight performance bounds on greedy policies based on imperfect value functions. Technical report, Northeastern University, College of Computer Science, 1993. +Xiao, C., Lee, I., Dai, B., Schuurmans, D., and Szepesvari, C. On the sample complexity of batch reinforcement learning with policy-induced data. arXiv preprint arXiv:2106.09973, 2021. +Yang, M. and Nachum, O. Representation matters: Offline pretraining for sequential decision making. In Self-Supervision for Reinforcement Learning Workshop-ICLR 2021, 2021. +Zanette, A. Exponential lower bounds for batch reinforcement learning: Batch rl can be exponentially harder than online rl. In International Conference on Machine Learning, pp. 12287-12297. PMLR, 2021. +Zhang, S., Boehmer, W., and Whiteson, S. Deep residual reinforcement learning. In Proceedings of the 19th International Conference on Autonomous Agents and MultiAgent Systems, pp. 1611-1619, 2020. +Zhu, Y. and Ying, L. Borrowing from the future: An attempt to address double sampling. In Mathematical and scientific machine learning, pp. 246-268. PMLR, 2020. + +# A. Additional Figures + +# A.1. Is the Bellman error a valid on-policy objective? + +
Train DataTest DataAlgorithmHalfCheetahHopperWalker2dAntHumanoid
AllOn-PolicyBRM0.950.740.960.990.98
FQE0.810.760.720.790.11
All0.1BRM-0.46-0.83-0.74-0.75-0.65
FQE0.570.85-0.90-0.600.20
0.10.1BRM0.110.04-0.470.46-0.48
FQE0.920.29-0.140.580.05
+ +# A.2. Does FQE provide a better metric? + +Table 2: Is there a correlation between Bellman error and value error? We display Pearson's correlation coefficient of the final Bellman error and value error of functions trained with either only BRM or only FQE. Warm colors are used to show positive correlation and cold colors are used for negative correlation. The error terms are computed over held-out rollouts. The functions are trained using datasets of varying noise levels, where all refers to the set (0.1, 0.2, 0.3, 0.4, 0.5) with 10 seeds, $(6 \times 10$ functions), 0.1 refers to the subset of functions trained on the 0.1 dataset (10 functions). While there is high correlation between the on-policy empirical Bellman error and value error when comparing functions trained with the same algorithm, this relationship is not strong when evaluated with an off-policy dataset (0.1). + +
Train DataTest DataMetricHalfCheetahHopperWalker2dAntHumanoid
AllOn-PolicyBE0.810.760.720.790.11
LFQE0.810.790.600.810.22
All0.1BE0.570.85-0.90-0.600.20
LFQE0.620.84-0.90-0.590.21
+ +# A.3. Additional Single Trajectory Experiments + +Table 3: Is there a correlation between the FQE loss and value error? Pearson's correlation coefficient of the Bellman error (BE) and the FQE objective $(\mathcal{L}_{\mathrm{FQE}})$ with the value error of functions trained by FQE. Warm colors are used to show positive correlation and cold colors are used for negative correlation. The error terms are computed over held-out rollouts. The functions are trained using datasets of varying noise levels, where all refers to the set (0.1, 0.2, 0.3, 0.4, 0.5) with 10 seeds, $(6\times 10$ functions), 0.1 refers to the subset of functions trained on the 0.1 dataset (10 functions). We can see that the difference between BE and $\mathcal{L}_{\mathrm{FQE}}$ is minimal. This means that the FQE loss function is not a better metric than BE. This is logical as it is non-stationary and dependent on the current value function. + +
BRMFQEMC
BEVERatioBEVERatioBEVERatio
HalfCheetah0.4123.3956.930.768.8911.722.762.751.00
Hopper0.075.5477.430.121.139.330.360.501.39
Walker2d0.168.8756.560.161.9211.790.190.291.50
Ant0.4216.0238.170.200.331.680.140.151.09
Humanoid0.124.5037.640.330.300.930.090.060.72
+ +Table 4: Does bias explain the non-correspondence between the Bellman error and value error? We train value functions over a single on-policy trajectory (1000 transitions, with termination). As a result, every relevant transition is contained in each dataset. We report the average absolute Bellman error (BE) and value error (VE), and ratio between these terms. By Proposition 4, with a discount $\gamma = 0.99$ , the ratio between mean absolute Bellman and value error is bounded by (0.5, 100). The tabular results show that both the upper and lower bound can be approached in practice. + +![](images/d5b443229f73d1d56f773657d68a7f64fc6dc5fe40a812563c51f039da68f19b.jpg) + +![](images/d0c81d9898154e86d72d54815e926ebe9ef3194bb1c2fe551f52cf39f5921b13.jpg) + +![](images/ae8cc7cb3f21963968586cfdf1a5bd65b9a2cece038247cc5bed2560dcfa80a9.jpg) + +![](images/6d68390cd4052e93de5e436d1d2e98e12884973de99d2813e00949c15fbef91a.jpg) + +![](images/73ad08c2bee52579c80fb27e4048221aed0001d9a3ef4ba54d9f7e54768803b3.jpg) + +![](images/8696c7d3d247eeb2fd23dee8e688a159d5671e5a813627da97639caf8f9e6533.jpg) + +![](images/f78ecc599d47fb1e886dbca086fb35f103894c21d31b8a0df99035ae95a299c3.jpg) + +![](images/91b54bcac866978d73bc129faf9a07ac183ccdaa1667ebd9e7ffc8565527a008.jpg) + +(c) Walker2d +Figure 4: Does bias explain the non-correspondence between the Bellman error and value error? We train value functions over a single on-policy trajectory (1000 transitions, with termination). As a result, every relevant transition is contained in each dataset. We display the Bellman error (left) and unnormalized value error (right) for every transition in the trajectory. Visually, we can see that the clusters of similar value error (size and direction) can cause lower magnitude Bellman error for BRM and FQE. +![](images/04c6755e2def2629c629879beef9d29139f2630ab36a1eda7e675d47dc6c019c.jpg) +BRM + +(e) Humanoid +![](images/b2be583deca6828a30513c95d38962bc6b70dc279387465c6f6505009fd16bbe.jpg) +FQE +MC + +![](images/d3052c2a0fa1b9c5884e5715ca793bd19eeb071faa79e3e92adc0ec367edd3f5.jpg) +A.4. BRM Behaves Predictably +Figure 5: Visualizing the final value estimated by BRM after training on different datasets corresponding to varying noise levels. The true value of the target policy and the behavior policy are displayed to provide reference, as well as BRM when trained to evaluate a suboptimal policy (corresponding to TD3 trained for $300\mathrm{k}$ time steps rather than $3\mathrm{m}$ ). Error bars capture the standard deviation over 10 seeds (but are visually hard to see as the deviation is low). We can see that $\bullet$ BRM typically converges to a value which is closer to the $\triangle$ behavior policy rather than the $\triangledown$ target policy, and typically prefers values which are close to 0. Interestingly, the BRM trained to evaluate the suboptimal target policy $\blacksquare$ converges to the same value on the noisiest datasets, suggesting that the influence of the target policy on what value BRM converges to is reduced with increased distribution shift. + +# B. Proofs + +# B.1. Proposition 1 + +Proposition 1. The Bellman error $\epsilon(s, a) = 0$ for all state-action pairs $(s, a) \in S \times \mathcal{A}$ , if and only if the value error $\Delta(s, a) = 0$ for all state-action pairs $(s, a) \in S \times \mathcal{A}$ . + +Proof. + +$\Rightarrow$ : This is a direct consequence of Theorem 1. + +$\Leftarrow$ : If for all $(s, a) \in S \times \mathcal{A}$ , $\Delta(s, a) = Q(s, a) - Q^{\pi}(s, a) = 0$ then $Q(s, a) = Q^{\pi}(s, a)$ for all $(s, a) \in S \times \mathcal{A}$ . From the Bellman equation it follows that + +$$ +\begin{array}{l} Q (s, a) = Q ^ {\pi} (s, a) (16) \\ = \mathcal {T} Q ^ {\pi} (s, a) (17) \\ = \mathcal {T} Q (s, a). (18) \\ \end{array} +$$ + +# B.2. Proposition 2 + +Proposition 2. Let $Q_{1}, Q_{2}$ be value functions, where $Q_{2} = \mathcal{T}Q_{1}$ . $\max_{(s,a)} |\Delta_{Q_2}(s,a)| \leq \gamma \cdot \max_{(s,a)} |\Delta_{Q_1}(s,a)|$ . + +Proof. + +For all $(s,a)\in S\times \mathcal{A}$ + +$$ +\begin{array}{l} \Delta_ {2} (s, a) = \mathcal {T} Q _ {1} (s, a) - Q ^ {\pi} (s, a) (19) \\ = \mathcal {T} Q _ {1} (s, a) - \mathcal {T} Q ^ {\pi} (s, a) (20) \\ = \mathbb {E} _ {s ^ {\prime}, a ^ {\prime}} [ \gamma (Q _ {1} (s ^ {\prime}, a ^ {\prime}) - Q ^ {\pi} (s ^ {\prime}, a ^ {\prime})) ] (21) \\ = \mathbb {E} _ {s ^ {\prime}, a ^ {\prime}} \left[ \gamma \Delta_ {1} \left(s ^ {\prime}, a ^ {\prime}\right) \right]. (22) \\ \end{array} +$$ + +It follows that for all $(s,a)\in S\times \mathcal{A}$ + +$$ +\begin{array}{l} \left| \Delta_ {2} (s, a) \right| \leq \max _ {(s, a)} \gamma \left| \Delta_ {1} (s, a) \right| (23) \\ \Rightarrow \max _ {(s, a)} | \Delta_ {2} (s, a) | \leq \max _ {(s, a)} \gamma | \Delta_ {1} (s, a) |. (24) \\ \end{array} +$$ + +# B.3. Proposition 3 + +Proposition 3. (An inverse relationship between Bellman error and value error). For any MDP, discount factor $\gamma \in (0,1)$ , and $C > 0$ , we can define a value function $Q_{1}$ and a stochastic value function $Q_{2}$ such that for any state-action pair $(s,a) \in S \times \mathcal{A}$ + +1. $|\Delta_{Q_1}(s,a)| - |\Delta_{Q_2}(s,a)| > C,$ +2. $\mathbb{E}_{Q_2}[|\epsilon_{Q_2}(s,a)|] - |\epsilon_{Q_1}(s,a)| > C.$ + +Proof. + +Let + +$$ +Q _ {1} (s, a) = Q ^ {\pi} (s, a) + \frac {k}{1 - \gamma}, \tag {25} +$$ + +$$ +Q _ {2} (s, a) = Q ^ {\pi} (s, a) \pm k (1 + \gamma). \tag {26} +$$ + +Then + +$$ +\left| \Delta_ {1} (s, a) \right| = \frac {k}{1 - \gamma}, \tag {27} +$$ + +$$ +\left| \Delta_ {2} (s, a) \right| = k (1 + \gamma), \tag {28} +$$ + +where $\frac{k}{1 - \gamma} > k(1 + \gamma)$ for all $\gamma \in (0,1)$ . + +And + +$$ +\epsilon_ {1} (s, a) = \frac {k}{1 - \gamma} - \frac {\gamma k}{1 - \gamma} = k, \tag {29} +$$ + +$$ +\mathbb {E} [ | \epsilon_ {2} (s, a) | ] = 0. 5 | k (1 + \gamma) - \gamma k (1 + \gamma) | + 0. 5 | k (1 + \gamma) + \gamma k (1 + \gamma) | \tag {30} +$$ + +$$ += k (1 + \gamma), \tag {31} +$$ + +where $k < k(1 + \gamma)$ for all $\gamma \in (0,1)$ + +Then we need + +$$ +\frac {k}{1 - \gamma} - k (1 + \gamma) > C \tag {32} +$$ + +$$ +\Rightarrow k \left(\frac {1}{1 - \gamma} - (1 + \gamma)\right) > C \tag {33} +$$ + +$$ +\Rightarrow k > \frac {C}{\frac {1}{1 - \gamma} - (1 + \gamma)} = \frac {C (1 - \gamma)}{\gamma^ {2}}. \tag {34} +$$ + +and + +$$ +k (1 + \gamma) - k > C \tag {35} +$$ + +$$ +\Rightarrow k \gamma > C \tag {36} +$$ + +$$ +\Rightarrow k > \frac {C}{\gamma}. \tag {37} +$$ + +Set $k = \max \left(\frac{C(1 - \gamma)}{\gamma^2},\frac{C}{\gamma}\right)$ + +# B.4. Theorem 1 + +Theorem 1. (Value error as a function of Bellman error). For any state-action pair $(s, a) \in S \times \mathcal{A}$ , the value error $\Delta(s, a)$ can be defined as a function of the Bellman error $\epsilon$ + +$$ +\Delta (s, a) = \frac {1}{1 - \gamma} \mathbb {E} _ {(s ^ {\prime}, a ^ {\prime}) \sim d ^ {\pi} (\cdot | s, a)} [ \epsilon (s ^ {\prime}, a ^ {\prime}) ]. \tag {38} +$$ + +Proof. Our proof follows similar steps to the proof of Lemma 6.1 in (Kakade & Langford, 2002) and likely others. + +First by definition: + +$$ +\Delta (s, a) := Q (s, a) - Q ^ {\pi} (s, a) \tag {39} +$$ + +$$ +\Rightarrow Q ^ {\pi} (s, a) = Q (s, a) - \Delta (s, a). \tag {40} +$$ + +Then we can decompose value error: + +$$ +\begin{array}{l} \Delta (s, a) = Q (s, a) - Q ^ {\pi} (s, a) (41) \\ = Q (s, a) - \left(r + \gamma \mathbb {E} _ {\pi} \left[ Q ^ {\pi} \left(s ^ {\prime}, a ^ {\prime}\right) \right]\right) (42) \\ = Q (s, a) - \left(r + \gamma \mathbb {E} _ {\pi} \left[ Q \left(s ^ {\prime}, a ^ {\prime}\right) - \Delta \left(s ^ {\prime}, a ^ {\prime}\right) \right]\right) (43) \\ = Q (s, a) - \left(r + \gamma \mathbb {E} _ {\pi} \left[ Q \left(s ^ {\prime}, a ^ {\prime}\right) \right]\right) + \gamma \mathbb {E} _ {\pi} \left[ \Delta \left(s ^ {\prime}, a ^ {\prime}\right) \right] (44) \\ = \epsilon (s, a) + \gamma \mathbb {E} _ {\pi} [ \Delta \left(s ^ {\prime}, a ^ {\prime}\right) ]. (45) \\ \end{array} +$$ + +By treating $\Delta(s, a)$ as a value function and $\epsilon(s', a')$ as the reward, we can see that: + +$$ +\Delta (s, a) = \frac {1}{1 - \gamma} \mathbb {E} _ {(s ^ {\prime}, a ^ {\prime}) \sim d ^ {\pi} (\cdot | s, a)} [ \epsilon (s ^ {\prime}, a ^ {\prime}) ]. \tag {46} +$$ + +Note that this theorem can also be applied to finite horizon MDPs, by either considering a definition of $d^{\pi}$ which accounts for the finite horizon, $d^{\pi}(s', a'|s, a) = \frac{1}{\sum_{t=0}^{T-1} \gamma^{t}} \sum_{t=0}^{T-1} \gamma^{t} p^{\pi}((s, a) \to s', t) \pi(a'|s')$ , or by transforming the finite horizon MDP into an infinite horizon MDP by considering episode termination to be a terminal state which loops infinitely upon itself. + +# B.5. Proposition 4 + +Proposition 4. (Bounds on value error). Let $C_{\text{max}} = \max_{s,a} |\epsilon(s,a)|$ and $C_{\text{avg}} = \mathbb{E}_{(s,a) \sim d^{\pi}} [|\epsilon(s,a)|]$ . + +1. $\frac{C_{\text{max}}}{1 + \gamma} \leq \max_{s, a} |\Delta(s, a)| \leq \frac{C_{\text{max}}}{1 - \gamma}$ , +2. $\frac{C_{avg}}{1 + \gamma} \leq \mathbb{E}_{(s,a) \sim d^{\pi}}[|\Delta(s,a)|] \leq \frac{C_{avg}}{1 - \gamma}$ , + +Furthermore, for any MDP and policy, there exists a value function such that the upper bound is an equality, and there exists a MDP, policy, and value function such that the lower bound is an equality. + +Proof. + +Upper bound on $\max_{s,a}|\Delta (s,a)|$ : For all $(s,a)\in S\times A$ + +$$ +\Delta (s, a) = \frac {1}{1 - \gamma} \mathbb {E} _ {\left(s ^ {\prime}, a ^ {\prime}\right) \sim d ^ {\pi} (\cdot | s, a)} [ \epsilon \left(s ^ {\prime}, a ^ {\prime}\right) ] \tag {47} +$$ + +$$ +\Rightarrow | \Delta (s, a) | = \left| \frac {1}{1 - \gamma} \mathbb {E} _ {\left(s ^ {\prime}, a ^ {\prime}\right) \sim d ^ {\pi} (\cdot | s, a)} [ \epsilon \left(s ^ {\prime}, a ^ {\prime}\right) ] \right| \tag {48} +$$ + +$$ +\leq \frac {1}{1 - \gamma} \mathbb {E} _ {\left(s ^ {\prime}, a ^ {\prime}\right) \sim d ^ {\pi} \left(\cdot | s, a\right)} \left[ \left| \epsilon \left(s ^ {\prime}, a ^ {\prime}\right) \right| \right] \tag {49} +$$ + +$$ +\leq \frac {1}{1 - \gamma} \max _ {(s, a) \in S \times A} | \epsilon (s, a) | \tag {50} +$$ + +$$ +\Rightarrow \max _ {(s, a)} | \Delta (s, a) | \leq \frac {1}{1 - \gamma} \max _ {(s, a) \in S \times A} | \epsilon (s, a) |. \tag {51} +$$ + +A proof of a similar relationship can also be found in Bertsekas & Tsitsiklis (1996), (Proposition 6.1, page 262). + +Lower bound on $\max_{s,a}|\Delta (s,a)|$ : For all $(s,a)\in S\times \mathcal{A}$ + +$$ +\epsilon (s, a) = \Delta (s, a) - \gamma \mathbb {E} _ {s ^ {\prime}, \pi} [ \Delta \left(s ^ {\prime}, a ^ {\prime}\right) ] \tag {52} +$$ + +$$ +\Rightarrow \Delta (s, a) = \epsilon (s, a) + \gamma \mathbb {E} [ \Delta \left(s ^ {\prime}, a ^ {\prime}\right) ] \tag {53} +$$ + +$$ +\Rightarrow | \Delta (s, a) | = | \epsilon (s, a) + \gamma \mathbb {E} [ \Delta \left(s ^ {\prime}, a ^ {\prime}\right) ] | \tag {54} +$$ + +$$ +\Rightarrow \max _ {(s, a)} | \Delta (s, a) | = \max _ {(s, a)} | \epsilon (s, a) + \gamma \mathbb {E} [ \Delta \left(s ^ {\prime}, a ^ {\prime}\right) ] | \tag {55} +$$ + +$$ +\geq \max _ {(s, a)} | \epsilon (s, a) | - \gamma | \mathbb {E} [ \Delta \left(s ^ {\prime}, a ^ {\prime}\right) ] | \tag {56} +$$ + +$$ +\geq \max _ {(s, a)} | \epsilon (s, a) | - \gamma \max _ {(s, a)} | \mathbb {E} [ \Delta \left(s ^ {\prime}, a ^ {\prime}\right) ] | \tag {57} +$$ + +$$ +\geq \max _ {(s, a)} | \epsilon (s, a) | - \gamma \max _ {(s, a)} | \Delta (s, a) | \tag {58} +$$ + +$$ +\Rightarrow (1 + \gamma) \max _ {(s, a)} | \Delta (s, a) | \geq \max _ {(s, a)} | \epsilon (s, a) | \tag {59} +$$ + +$$ +\Rightarrow \max _ {(s, a)} | \Delta (s, a) | \geq \frac {1}{1 + \gamma} \max _ {(s, a)} | \epsilon (s, a) |. \tag {60} +$$ + +Upper bound on $\mathbb{E}_{(s,a)\sim d^{\pi}}[|\Delta (s,a)|]$ : For all $(s,a)\in S\times A$ : + +$$ +\begin{array}{l} \Delta (s, a) = \frac {1}{1 - \gamma} \mathbb {E} _ {\left(s ^ {\prime}, a ^ {\prime}\right) \sim d ^ {\pi} (\cdot | s, a)} [ \epsilon \left(s ^ {\prime}, a ^ {\prime}\right) ] (62) \\ \Rightarrow | \Delta (s, a) | = \frac {1}{1 - \gamma} \left| \mathbb {E} _ {\left(s ^ {\prime}, a ^ {\prime}\right) \sim d ^ {\pi} (\cdot | s, a)} \left[ \epsilon \left(s ^ {\prime}, a ^ {\prime}\right) \right] \right| (63) \\ \Rightarrow \mathbb {E} _ {d ^ {\pi}} [ | \Delta (s, a) | ] = \frac {1}{1 - \gamma} \mathbb {E} _ {d ^ {\pi}} [ | \mathbb {E} _ {(s ^ {\prime}, a ^ {\prime}) \sim d ^ {\pi} (\cdot | s, a)} [ \epsilon (s ^ {\prime}, a ^ {\prime}) ] | ] (64) \\ \leq \frac {1}{1 - \gamma} \mathbb {E} _ {d ^ {\pi}} \left[ \mathbb {E} _ {(s ^ {\prime}, a ^ {\prime}) \sim d ^ {\pi} (\cdot | s, a)} [ | \epsilon (s ^ {\prime}, a ^ {\prime}) | ] \right] (65) \\ = \frac {1}{1 - \gamma} \mathbb {E} _ {d ^ {\pi}} [ | \epsilon \left(s ^ {\prime}, a ^ {\prime}\right) | ]. (66) \\ \end{array} +$$ + +Lower bound on $\mathbb{E}_{(s,a)\sim d^{\pi}}[|\Delta (s,a)|]$ : For all $(s,a)\in S\times \mathcal{A}$ + +$$ +\begin{array}{l} \epsilon (s, a) = \Delta (s, a) - \gamma \mathbb {E} _ {s ^ {\prime}, \pi} [ \Delta \left(s ^ {\prime}, a ^ {\prime}\right) ] (67) \\ \Rightarrow \Delta (s, a) = \epsilon (s, a) + \gamma \mathbb {E} [ \Delta \left(s ^ {\prime}, a ^ {\prime}\right) ] (68) \\ \Rightarrow | \Delta (s, a) | = | \epsilon (s, a) + \gamma \mathbb {E} [ \Delta \left(s ^ {\prime}, a ^ {\prime}\right) ] | (69) \\ \Rightarrow \mathbb {E} _ {d ^ {\pi}} [ | \Delta (s, a) | ] = \mathbb {E} _ {d ^ {\pi}} [ | \epsilon (s, a) + \gamma \mathbb {E} [ \Delta \left(s ^ {\prime}, a ^ {\prime}\right) ] | ] (70) \\ \geq \mathbb {E} _ {d \pi} [ | \epsilon (s, a) | - \gamma | \mathbb {E} [ \Delta \left(s ^ {\prime}, a ^ {\prime}\right) ] | ] (71) \\ = \mathbb {E} _ {d ^ {\pi}} [ | \epsilon (s, a) | ] - \gamma \mathbb {E} _ {d ^ {\pi}} [ | \mathbb {E} [ \Delta (s ^ {\prime}, a ^ {\prime}) ] | ] (72) \\ \Rightarrow (1 + \gamma) \mathbb {E} _ {d ^ {\pi}} [ | \Delta (s, a) | ] \geq \mathbb {E} _ {d ^ {\pi}} [ | \epsilon (s, a) | ] (73) \\ \Rightarrow \mathbb {E} _ {d ^ {\pi}} [ | \Delta (s, a) | ] \geq \frac {1}{1 + \gamma} \mathbb {E} _ {d ^ {\pi}} [ | \epsilon (s, a) | ]. (74) \\ \end{array} +$$ + +Equality on upper bound: For any MDP, policy $\pi$ , and constant $C$ , let $Q(s,a) = Q^{\pi} + \frac{C}{1 - \gamma}$ for all $(s,a)\in S\times \mathcal{A}$ . It follows that $\epsilon (s,a) = C$ and $\Delta (s,a) = \frac{C}{1 - \gamma}$ for all $(s,a)\in S\times \mathcal{A}$ . + +Equality on lower bound: Consider a two-state, single action MDP $\mathcal{S} = \{s_1,s_2\},\mathcal{A} = \{a\}$ such that $(s_{1},a)\to s_{2}$ and $(s_2,a)\rightarrow s_1$ . Let $Q(s_{1},a) = Q^{\pi} + \frac{C}{1 + \gamma}$ and $Q(s_{2},a) = Q^{\pi} - \frac{C}{1 + \gamma}$ for some constant $C$ . It follows that $|\epsilon (s,a)| = C$ and $|\Delta (s,a)| = \frac{C}{1 + \gamma}$ for all $(s,a)\in S\times \mathcal{A}$ + +# B.6. Corollary 1 + +Corollary 1. (The Bellman equation is not unique over incomplete datasets). If there exists a state-action pair $(s', a')$ not contained in the dataset $\mathcal{D}$ , where the state-action occupancy $d^{\pi}(s', a'|s, a) > 0$ for some $(s, a) \in \mathcal{D}$ , then there exists a value function and $C > 0$ such that + +1. For all $(\hat{s},\hat{a})\in \mathcal{D}$ , the Bellman error $\epsilon (\hat{s},\hat{a}) = 0$ +2. There exists $(s,a)\in \mathcal{D}$ , such that the value error $\Delta (s,a) = C$ + +Proof. This is a direct consequence of Theorem 1. Let $\mathcal{D}'$ contain the set of state-action pairs $(s', a')$ not contained in the dataset $\mathcal{D}$ , where the state-action occupancy $d^{\pi}(s', a'|s, a) > 0$ . Let $\mathcal{D}_{\mathrm{unique}}$ be the set of unique state-action pairs in $\mathcal{D}$ . It follows that + +$$ +\begin{array}{l} \Delta (s, a) = \frac {1}{1 - \gamma} \mathbb {E} _ {(s ^ {\prime}, a ^ {\prime}) \sim d ^ {\pi} (\cdot | s, a)} [ \epsilon (s ^ {\prime}, a ^ {\prime}) ] (75) \\ = \frac {1}{1 - \gamma} \sum_ {\left(s ^ {\prime}, a ^ {\prime}\right) \sim \mathcal {D} _ {\text {u n i q u e}}} d ^ {\pi} \left(s ^ {\prime}, a ^ {\prime} \mid s, a\right) \epsilon \left(s ^ {\prime}, a ^ {\prime}\right) + \frac {1}{1 - \gamma} \sum_ {\left(s ^ {\prime}, a ^ {\prime}\right) \sim \mathcal {D} ^ {\prime}} d ^ {\pi} \left(s ^ {\prime}, a ^ {\prime} \mid s, a\right) \epsilon \left(s ^ {\prime}, a ^ {\prime}\right). (76) \\ \end{array} +$$ + +Recall + +$$ +\epsilon (s, a) := Q (s, a) - \mathbb {E} _ {r, s ^ {\prime} \sim p, a ^ {\prime} \sim \pi} [ r + \gamma Q (s ^ {\prime}, a ^ {\prime}) ], \tag {77} +$$ + +and there exists at least one $Q(s,a)$ , such that $(s,a) \in \mathcal{D}'$ . Since the sets $\mathcal{D}$ and $\mathcal{D}'$ are distinct, it follows that there exists a function $Q$ such that $\epsilon(s,a) = 0$ for all $(s,a) \in \mathcal{D}$ , but $\frac{1}{1 - \gamma} \sum_{(s',a') \sim \mathcal{D}'} d^{\pi}(s',a'|s,a) \epsilon(s',a') = C$ . + +# B.7. Proposition 5 + +Proposition 5. (FQE improvement condition). Let $Q_{1}, Q_{2}$ be value functions, where $Q_{2} = \mathcal{T}Q_{1}$ . If $\gamma \cdot \max_{(s,a) \in \mathcal{D}} |\mathbb{E}_{(s',a') \sim p(\cdot | s,a),\pi}[\Delta_{Q_{1}}(s',a')]| < \max_{(s,a) \in \mathcal{D}} |\Delta_{Q_{1}}(s,a)|$ then $\max_{(s,a) \in \mathcal{D}} |\Delta_{Q_{2}}(s,a)| < \max_{(s,a) \in \mathcal{D}} |\Delta_{Q_{1}}(s,a)|$ . + +Proof. + +For all $(s,a)\in \mathcal{D}$ .. + +$$ +\Delta_ {2} (s, a) = \mathcal {T} Q _ {1} (s, a) - Q ^ {\pi} (s, a) \tag {78} +$$ + +$$ += \mathcal {T} Q _ {1} (s, a) - \mathcal {T} Q ^ {\pi} (s, a) \tag {79} +$$ + +$$ += \mathbb {E} _ {\left(s ^ {\prime}, a ^ {\prime}\right) \sim p (\cdot | s, a), \pi} [ \gamma \left(Q _ {1} \left(s ^ {\prime}, a ^ {\prime}\right) - Q ^ {\pi} \left(s ^ {\prime}, a ^ {\prime}\right)\right) ] \tag {80} +$$ + +$$ += \mathbb {E} _ {\left(s ^ {\prime}, a ^ {\prime}\right) \sim p \left(\cdot | s, a\right), \pi} \left[ \gamma \Delta_ {1} \left(s ^ {\prime}, a ^ {\prime}\right) \right] \tag {81} +$$ + +$$ +\Rightarrow | \Delta_ {2} (s, a) | = \gamma | \mathbb {E} _ {(s ^ {\prime}, a ^ {\prime}) \sim p (\cdot | s, a), \pi} [ \Delta_ {1} (s ^ {\prime}, a ^ {\prime}) ] |. \tag {82} +$$ + +It follows that for all $(s,a)\in \mathcal{D}$ if + +$$ +\begin{array}{l} \gamma \cdot \max _ {(s, a) \in \mathcal {D}} | \mathbb {E} _ {(s ^ {\prime}, a ^ {\prime}) \sim p (\cdot | s, a), \pi} [ \Delta_ {1} (s ^ {\prime}, a ^ {\prime}) ] | < \max _ {(s, a) \in \mathcal {D}} | \Delta_ {1} (s, a) | (83) \\ \Rightarrow \max _ {(s, a) \in \mathcal {D}} | \Delta_ {2} (s, a) | < \max _ {(s, a) \in \mathcal {D}} | \Delta_ {1} (s, a) |. (84) \\ \end{array} +$$ + +# C. Learning Curves + +![](images/05e57483141e6a68ecd0f2dcfb2a0286054230bcdd1e511d5806fe27fb006d7a.jpg) +C.1.BRM + +![](images/27332d915f2c07f62b2a5dfe70faf0208f36ed1bee9f477b58bbe7a87c52d80f.jpg) + +![](images/9b6dfc4b987fa9db66807aa2b820350c352c968eb76495d25b8b52ce3f10c52d.jpg) + +![](images/86bff314e5008e2a9508f067d9d7f9107c5ba021f51df92a44ae5648aa6f9efa.jpg) + +![](images/b960b02d7fa9959fd10e40cf4506f4e2d1ec9a738218e7a3067c5831d2a667d3.jpg) + +![](images/f6b1b05fb37646982ff74b17f52cdf2887ce491a834862bb2caf7d5158bc3852.jpg) + +![](images/4de77464a54f3736dcf8ca783409e49488b9ea9ad502cc8c6a6c8401102259c2.jpg) +(a) Evaluated with the Training Dataset + +![](images/5115fa21431e125538bf7ae3def1bcd1351ccbe71088eb9b5c9a9a2988fcf496.jpg) + +![](images/68fbed327319139b4e40a971c1b7ed3403d5cdd531fa416dfc74a758a4cad162.jpg) + +![](images/2ae40cf0f90b5d5c9af429ec3a4e4662ac855397f4443f9c1944c2a09f219a2f.jpg) + +![](images/ad9207c1401eb9e17695d3872fb982964beb62bc8b0543d116c351c240fc412c.jpg) + +![](images/d86b960040b35a0263c34e37f6cde3c4d44fa5034bec827f87976523a18f8460.jpg) + +![](images/880385014ad3f57721611242d0de987628c46a9bfd1ad21488fa866738921636.jpg) + +![](images/4e80c472e5050a4e00c8a8dc2a2632a6df3a902ee8a5683cd0f08a9e07b8a2b9.jpg) + +![](images/86b202274a0f35c1699552570ff3c6b7103cbc0124d2fc52d694e7640abb7811.jpg) + +![](images/5d008359e999d5c560fd1b5069655d8b449811178d8753b05919772610acc55c.jpg) +Figure 6: Visualizing the learning curves of the Bellman error and value error of value functions trained by BRM evaluated over the training dataset (used in Table 1) and on-policy dataset (used in Table 2). The shaded area captures the standard deviation over 10 seeds. + +![](images/59f7085daddf2e5f5bfb13998813ce40b3d67942445c6d5f582e03f8d85e11e6.jpg) +(b) Evaluated with the On-Policy Dataset + +![](images/7dcc5210eb86fd6ab1fffcf4c07c10fa6c969632933f90fe1a905589ba21d137.jpg) + +![](images/0ac0455af0af1d2319e323897c25a8f4fa757734a54de23533f1d04d21247de3.jpg) + +![](images/539923e989177f2e5d6a7863ca9980448f024eb5976ed01d0d42aebf76d44f30.jpg) + +Noise level: + +On-policy (0.0) + +0.1 + +0.2 + +0.3 + +0.4 + +0.5 + +![](images/d0e21776d514312ed57c58f5fa9f18417b3db6002749a8a9ecc76df89e8dbe55.jpg) +C.2.FQE + +![](images/3c9dfe35beb423347eb60a830de2705963443355678425ec523304eeae3be4c3.jpg) +(a) Evaluated with the Training Dataset +Figure 7: Visualizing the learning curves of the Bellman error and value error of value functions trained by FQE evaluated over the training dataset (used in Table 1) and on-policy dataset (used in Table 2). The shaded area captures the standard deviation over 10 seeds. The Bellman error of individual trials is clipped to $10\mathrm{k}$ for visual clarity (only relevant for HalfCheetah). + +# D. What if... + +# D.1. ...we compare the absolute Bellman error to absolute value error? + +![](images/aea0312d26fa5d0a07b938ea4a76dfb11fe97502c16e64ffbd7374b0b4f95e4d.jpg) +Figure 2 compares the mean squared Bellman error to the absolute value error. In Figure 8 we compare the absolute Bellman error with the absolute value error, and in Figure 9 we compare the mean squared Bellman error with the mean squared value error. We find that our observations regarding the relative ordering of the Bellman error and value error are unchanged. +Figure 8: Comparing the absolute Bellman error with the absolute value error. The shaded area captures the standard deviation over 10 seeds. Both algorithms are trained using on-policy data collected by the target policy. + +![](images/a1fff2a206d16d398a155c7815c47d7c32b91ee9c81599d3274aec1649489791.jpg) +Figure 9: Comparing the mean squared Bellman error with the mean squared value error. The shaded area captures the standard deviation over 10 seeds. Both algorithms are trained using on-policy data collected by the target policy. + +# D.2....we use less data? + +![](images/5c722a7d1e89f5c96a747c7d95c567750908cdaaf81e5cc71116f732ef0ce33c.jpg) +Figure 2 uses datasets of 1M transitions. In Figure 10 we repeat the experiment in Figure 2 with a dataset of 50k transitions. We find that our observations regarding the relative ordering of the Bellman error and value error are unchanged. +Figure 10: Comparing the mean squared Bellman error with the absolute value error, using a dataset of $50\mathrm{k}$ . The shaded area captures the standard deviation over 10 seeds. Both algorithms are trained using on-policy data collected by the target policy. + +# D.3. ...we use training error instead of test error? + +![](images/a4559116c1412f5f9b4d336b2fd4f04b55945799b6d1f1ac345e3ca2bf728883.jpg) +Figure 2 evaluates the Bellman error and the value error on a held-out test set. In Figure 11 we evaluate the error terms on the training dataset, rather than the held-out test set. We find that our observations regarding the relative ordering of the Bellman error and value error are unchanged. +Figure 11: Comparing the mean squared Bellman error with the absolute value error, evaluated on the training dataset, rather than a held-out test set. The shaded area captures the standard deviation over 10 seeds. Both algorithms are trained using on-policy data collected by the target policy. + +# D.4. ...we use train for longer? + +![](images/122bf640bb2dbed4e3891766db2e39d8431a08b900f0bddbbbfc0a5525d20f2f.jpg) +Figure 2 displays the learning curves for 1M time steps. In Figure 12 we train for 10M time steps (using the same dataset). We find that our observations regarding the relative ordering of the Bellman error and value error are unchanged. + +![](images/4e705baa761405422e2a06ab293cec48c7a709d4d0dff44342950d7a9a1ea880.jpg) + +![](images/b9f4b24899606a5b52906fb2eceb06fec02a5cfa79d2b566c17d44f6c1e7e650.jpg) + +![](images/a5ef222424bce19a7aa664649adb5bd6eb8a9b5b2af1555fe182db7069695327.jpg) + +![](images/688a43f38013e0dae780ccd2bac2015de65f3e260e4f7c9bc467354bf2553857.jpg) + +![](images/9f19f279762ba24e9266af29074c14ec4f1472777df3f5415666870091aec0cd.jpg) +Figure 12: Comparing the mean squared Bellman error with the absolute value error while training for 10M time steps (the dataset of 1M is unchanged from Figure 2). The shaded area captures the standard deviation over 10 seeds. Both algorithms are trained using on-policy data collected by the target policy. + +Time Steps (1e6) +![](images/2ea80c0586f35becc1479c495098938ee3780313b44e3c1e3c9d10afd85b1f34.jpg) +BRM + +Time Steps (1e6) +![](images/3d783f1932f6546980bfd67d67d45268311c9e9a70d160b824b5d2b3e410ecf5.jpg) +FQE + +Time Steps (1e6) +![](images/1b6a57940feaa85306f07288cdd9579e3a97289b2b945cc70e28a065d2d986da.jpg) +MC + +![](images/9f2c96b8e4019790e13f3c50fd92635cdf213aad875b48e2ccc4fe7cdd7c6e62.jpg) +Time Steps (1e6) + +# E. Experiment Details + +Software. Software versions used were as follows: + +- Python 3.6 +Pytorch 1.8.0 (Paszke et al., 2019) +Gym 0.17.0 (Brockman et al., 2016) +- MuJoCo $1.50^{1}$ (Todorov et al., 2012) +mujoco-py 1.50.1.1 + +-v3 versions of the MuJoCo environments were used. + +Hyperparameters. FQE and BRM used the same hyperparameters and architecture, as described in Table 5. These hyperparameters were chosen to match TD3 and SAC (Fujimoto et al., 2018; Haarnoja et al., 2018a), state of the art off-policy RL algorithms used in the MuJoCo domain. Following these algorithms, both FQE and BRM set the discount factor $\gamma$ to 0 for terminal states (and use 0.99 otherwise). FQE uses Polyak averaging for the target network update. Given parameters $\theta$ of the current network, the parameters of the target network $\bar{\theta}$ are updated by the following after each time step: + +$$ +\bar {\theta} \leftarrow (1 - \tau) \bar {\theta} + \tau \theta , \tag {85} +$$ + +where $\tau$ is the target update rate. This rule is a commonly-used update rule by many off-policy RL algorithms for continuous actions (Lillicrap et al., 2015; Fujimoto et al., 2018; Haarnoja et al., 2018b). + +
HyperparameterValue
Network HyperparametersOptimizerAdam (Kingma & Ba, 2014)
Learning rate3e-4
Mini-batch size256
Target update rate (FQE)5e-3
Discount factor0.99
Terminal Discount factor0.0
ArchitectureNetwork Hidden dim256
Network Hidden layers2
Activation functionReLU
+ +Table 5: Hyperparameters and architecture. + +Target policy. In each experiment, we evaluate the discounted return of a deterministic target policy taken from TD3 (Fuji-moto et al., 2018) trained for 3 million time steps. Our implementation of TD3 is based directly off of the author-provided Github (https://github.com/sfujim/TD3). For all experiments, the discounted return uses a discount factor of $\gamma = 0.99$ . + +Dataset and behavior policy. Datasets are collected by using a noisy variation of the target policy $\pi_t$ . For a noise level $n \in [0.0, 0.1, 0.2, 0.3, 0.4, 0.5]$ , the behavior policy $\pi_b$ is defined as: + +$$ +\pi_ {b} (s) = \left\{ \begin{array}{l l} \pi_ {t} (s) + \mathcal {N} (0, n), & \text {w i t h} p = n, \\ \text {u n i f o r m r a n d o m a c t i o n} & \text {w i t h} p = 1 - n. \end{array} \right. \tag {86} +$$ + +Unless stated otherwise, experiments use a dataset of 1 million transitions, matching the replay buffer size of TD3/SAC. + +Metrics and evaluation datasets. The main metrics used are the Bellman error and the value error. Given an evaluation dataset $\mathcal{D}_e$ and value function $Q$ , the mean-squared Bellman error is computed by: + +$$ +\frac {1}{\left| \mathcal {D} _ {e} \right|} \sum_ {(s, a, r, s ^ {\prime}) \sim \mathcal {D} _ {e}, a ^ {\prime} \sim \pi} \left(Q (s, a) - \left(r + \gamma Q \left(s ^ {\prime}, a ^ {\prime}\right)\right)\right) ^ {2}. \tag {87} +$$ + +Given an evaluation dataset $\mathcal{D}_e$ and value function $Q$ , the normalized absolute value error is computed by: + +$$ +\frac {1}{K \left| \mathcal {D} _ {e} \right|} \sum_ {(s, a, r, s ^ {\prime}) \sim \mathcal {D} _ {e}, a ^ {\prime} \sim \pi} | Q (s, a) - Q ^ {\pi} (s, a) |. \tag {88} +$$ + +$Q^{\pi}(s,a)$ is computed near exactly by resetting the MuJoCo environment to the specific state-action pair $(s,a)$ and running the policy for 1000 time steps (the environment and policy are deterministic, so one trajectory is sufficient to estimate the true value). Value error is normalized by a per-environment constant equal to the average true value $Q^{\pi}$ over the on-policy evaluation dataset $\mathcal{D}_{\mathrm{on - policy}}$ : + +$$ +K = \frac {1}{\left| \mathcal {D} _ {\text {o n - p o l i c y}} \right|} \sum_ {(s, a, r, s ^ {\prime}) \sim \mathcal {D} _ {\text {o n - p o l i c y}}} Q ^ {\pi} (s, a). \tag {89} +$$ + +We report the values of $K$ used in Table 6. + +
EnvironmentK
HalfCheetah1382.35
Hopper388.56
Walker2d529.12
Ant580.90
Humanoid571.29
+ +Table 6: Values of the per-environment normalizing constant $K$ ,used to normalize value error for better interpretability across tasks. + +Evaluation datasets are each collected by using the same set of behavior policies used to generate the training datasets, in other words with noise levels [0.0, 0.1, 0.2, 0.3, 0.4, 0.5]. Each evaluation dataset contains 1000 transitions, and is gathered by collecting 50k transitions, and then selecting 1000 of the 50k transitions with uniform probability. Error terms are computed over an evaluation dataset of 1000 transitions, generated in similar fashion as the training datasets. + +Termination. The MuJoCo environments are time-limited at 1000 time steps. Since using time-limited termination (which is not represented in the state) breaks the Markov property, we follow standard practice (Fujimoto et al., 2018; Haarnoja et al., 2018a) and only consider a state terminal if termination occurs before 1000 time steps. In other words, $\gamma = 0$ if a state $s_t$ is both terminal and $t < 1000$ , and $\gamma = 0.99$ otherwise. + +Outliers. In the experiments for Table 1, for HalfCheetah with the 0.1 and 0.2 datasets the value function trained by FQE diverged on several seeds (see Section C.2 for visualization), these trials were removed when computing the values in the table. Note that this does not affect the conclusions made, as we are interested in the existence of problems with the Bellman error, not comparing the performance of BRM and FQE. + +Tables (2 & 3) report Pearson's correlation coefficient. Since this measure is not robust to outliers, for FQE we remove the $30\%$ of data points with the highest Bellman error terms (functions trained with BRM had no obvious outliers). + +Single trajectory experiments. In Figure 3 and Section A.3 experiments were performed over a single on-policy trajectory. This trajectory was collected by the expert target policy. Unlike the other experiments, termination was used so that the dataset was complete (contained every relevant transition). To reduce the importance of propagating values, we added the average reward in the dataset, scaled by the horizon (i.e. $\frac{1}{1 - \gamma} = 100$ ), to the terminal reward $r_{T-1} \gets r_{T-1} + \frac{\gamma}{(1 - \gamma)T} \sum_{i=0}^{T-1} r_i$ , where $T = 1000$ is the total numbers of transitions in the trajectory. Additionally, algorithms were trained for 250k time steps rather than 1M. \ No newline at end of file diff --git a/whyshoulditrustyoubellmanthebellmanerrorisapoorreplacementforvalueerror/images.zip b/whyshoulditrustyoubellmanthebellmanerrorisapoorreplacementforvalueerror/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..41464300dbe05104845177b0c337179a8148d892 --- /dev/null +++ b/whyshoulditrustyoubellmanthebellmanerrorisapoorreplacementforvalueerror/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:955b5448dcf76186260b6937009742e4b722ec6ce8c83b4979de730b9458dc6f +size 2118264 diff --git a/whyshoulditrustyoubellmanthebellmanerrorisapoorreplacementforvalueerror/layout.json b/whyshoulditrustyoubellmanthebellmanerrorisapoorreplacementforvalueerror/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..31ed3b188889827f0275f0c984cf29145202d9c7 --- /dev/null +++ b/whyshoulditrustyoubellmanthebellmanerrorisapoorreplacementforvalueerror/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6e67ec4d57a67db70585c52a6a960320457304065e3c19b62c700e1e1641c3cb +size 943838 diff --git a/whytherichgetricheronthebalancednessofrandompartitionmodels/2888b6c3-37a2-4f93-8693-b501bfddb82e_content_list.json b/whytherichgetricheronthebalancednessofrandompartitionmodels/2888b6c3-37a2-4f93-8693-b501bfddb82e_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..63765cf307980c32f7b2c3ab7f0b5cefa13ed9d2 --- /dev/null +++ b/whytherichgetricheronthebalancednessofrandompartitionmodels/2888b6c3-37a2-4f93-8693-b501bfddb82e_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4d6ec8d323c2df1ac5fba7be2cdce1cc0fdccbeecbd5b236bc4ef3ce2f975b8a +size 161061 diff --git a/whytherichgetricheronthebalancednessofrandompartitionmodels/2888b6c3-37a2-4f93-8693-b501bfddb82e_model.json b/whytherichgetricheronthebalancednessofrandompartitionmodels/2888b6c3-37a2-4f93-8693-b501bfddb82e_model.json new file mode 100644 index 0000000000000000000000000000000000000000..257395c4e20968cf563bca2f9bdedb6622d1c7f9 --- /dev/null +++ b/whytherichgetricheronthebalancednessofrandompartitionmodels/2888b6c3-37a2-4f93-8693-b501bfddb82e_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:93758c0019fbb04f4cf7b65bb61caa48e8289ce2e2a877ad4624f4c39eded551 +size 197264 diff --git a/whytherichgetricheronthebalancednessofrandompartitionmodels/2888b6c3-37a2-4f93-8693-b501bfddb82e_origin.pdf b/whytherichgetricheronthebalancednessofrandompartitionmodels/2888b6c3-37a2-4f93-8693-b501bfddb82e_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..1ed3bd2774120be37925d65a847352bb79b999c0 --- /dev/null +++ b/whytherichgetricheronthebalancednessofrandompartitionmodels/2888b6c3-37a2-4f93-8693-b501bfddb82e_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:903f2b45016af20c7c7564e4f8764a1a5da6f44e569f995a3ad40eb75f7352f0 +size 3295499 diff --git a/whytherichgetricheronthebalancednessofrandompartitionmodels/full.md b/whytherichgetricheronthebalancednessofrandompartitionmodels/full.md new file mode 100644 index 0000000000000000000000000000000000000000..a5482fc7addcf8143b9900ed8dba852a07769392 --- /dev/null +++ b/whytherichgetricheronthebalancednessofrandompartitionmodels/full.md @@ -0,0 +1,709 @@ +# Why the Rich Get Richer? On the Balancedness of Random Partition Models + +Changwoo J. Lee1 Huiyan Sang1 + +# Abstract + +Random partition models are widely used in Bayesian methods for various clustering tasks, such as mixture models, topic models, and community detection problems. While the number of clusters induced by random partition models has been studied extensively, another important model property regarding the balancedness of partition has been largely neglected. We formulate a framework to define and theoretically study the balancedness of exchangeable random partition models, by analyzing how a model assigns probabilities to partitions with different levels of balancedness. We demonstrate that the "rich-get-richer" characteristic of many existing popular random partition models is an inevitable consequence of two common assumptions: product-form exchangeability and projectivity. We propose a principled way to compare the balancedness of random partition models, which gives a better understanding of what model works better and what doesn't for different applications. We also introduce the "rich-get-poorer" random partition models and illustrate their application to entity resolution tasks. + +# 1. Introduction + +Bayesian formulation of clustering problems has gained considerable attention, especially when the number of clusters is unknown. By assigning a prior distribution on the partition space, Bayesian clustering methods give not only flexibility in the number of clusters but also an uncertainty quantification of latent clustering structure. Popular examples include random partition models induced by discrete random probability measures, such as Dirichlet process (DP; Ferguson, 1973), Pitman-Yor process (PYP; Perman et al., 1992; + +$^{1}$ Department of Statistics, Texas A&M University, Texas, USA. Correspondence to: Changwoo J. Lee . + +Proceedings of the $39^{th}$ International Conference on Machine Learning, Baltimore, Maryland, USA, PMLR 162, 2022. Copyright 2022 by the author(s). + +Pitman & Yor, 1997), and the mixture of finite mixtures (MFM; Miller & Harrison, 2018), to name a few. These random partition models reflect the prior belief on the clusters' characteristics, such as how the number of clusters $K_{n}^{+}$ grows as the number of datapoints $n$ increases, and how datapoints are distributed among clusters. For example, it is well known that $K_{n}^{+} \asymp \log n$ under the Chinese restaurant process (CRP), the distribution of partition induced by DP. + +While the behavior of the number of clusters $K_{n}^{+}$ under various random partition models has been studied extensively (Gnedin & Pitman, 2005; Lijoi et al., 2007; Favaro et al., 2009; De Blasi et al., 2015; Camerlenghi et al., 2018; Lijoi et al., 2020; Fruhwirth-Schnatter et al., 2021), the balancedness of random partition (i.e. probabilities of partitions with different levels of balancedness) has been largely uninvestigated. Nevertheless, there has been awareness of the crucial effect of the balancedness of random partitions on cluster inference. The most prominent example is the CRP prior that is known to yield the posterior estimate with few big and many small extra clusters (Petrone & Raftery, 1997), intuitively due to the prediction rule of CRP that assumes a new datapoint falls into an existing cluster with probability proportional to its size. This "rich-get-richer" characteristic of preferring unbalanced partitions is shared across many other random partition models, such as those induced by PYP, MFM, and Dirichlet-multinomial allocation (Green & Richardson, 2001), yet there is a less theoretical understanding of when and why this property arises. + +There are many important questions surrounding the balancedness of random partition models that are not well studied in the literature. First, how to define a rigorous theoretical framework that is applicable to systematically studying the balancedness properties for a broad class of random partition models? The answer to this question would be crucial to understand the root causes of the "rich-get-richer" property: the product-form exchangeability and projectivity assumptions which we shall demonstrate later. Also, it provides deeper insight into the suitable application scenario of each model. The success of latent Dirichlet allocation (LDA; Blei et al., 2003) in topic modeling is partially attributed to the fact that per-document topic proportions are inherently unbalanced, and hence unbalanced random partition models are naturally suitable for topic modeling. + +Second, how to compare and quantify the balancedness of different random partition models? The answer to this question helps to understand the cost and benefits of choosing one model over the other. For example, many practitioners choose DP-based models since it does not require the number of components to be fixed in advance, and indeed many methods incorporating DP emphasize this as a key feature (Teh et al., 2006; Kemp et al., 2006). However, this benefit comes with a cost: compared to the Dirichlet-multinomial allocation model, the random partition induced by DP is more unbalanced, which explains why the DP mixture model typically yields too many tiny clusters compared to the finite mixture or MFM (Green & Richardson, 2001; Miller & Harrison, 2018). Also, community detection results based on the Bayesian stochastic blockmodel (Nowicki & Snijders, 2001; Geng et al., 2019) are reported to be sensitive to the choice of the latent random partition model (Legramanti et al., 2022), and this may be partly explained by the balancedness of random partition prior; see Section 3.3 for the detailed discussion. + +Finally, beyond the sea of models that implicitly favor unbalanced partitions, are there flexible models that favor balancedness or have no preference on the balancedness? There have been some efforts to follow a sequential construction of random partition and redesign prediction rules to change the "rich-get-richer" property (Jensen & Liu, 2008; Wallach et al., 2010; Lu et al., 2018; Poux-Médard et al., 2021), but these sequential construction methods (i.e. species sampling models) often no longer guarantee exchangeability of the resulting random partition model (Lee et al., 2013), a crucial assumption that the distribution of random partition is invariant of the permutation of indices. Indeed, there are many application scenarios for which such models are more suitable. In this paper, we illustrate with an entity resolution (ER) task which aims to find clusters of records that refer to the same individual in a noisy database where we do not expect a small number of clusters dominates the whole. + +Scope and Contributions. First, we formulate the balancedness of exchangeable random partitions and study the related properties, which is crucial to check or build the model having the desired balancedness property. Especially, we focus on Gibbs partition models (Gnedin & Pitman, 2005), a very general class of exchangeable random partition models. Second, we provide the complete family of balance-neutral random partitions that is both exchangeable and projective, which can serve as a noninformative prior in terms of balancedness. Third, we define $B$ -sequence to compare the strength of balancedness between Gibbs partitions and offer its intuitive explanation. Finally, we provide an in-depth example of a balance-seeking random partition model and demonstrate its application to the ER task. + +# 2. Backgrounds + +# 2.1. Notations + +Let $[n] = \{1, \dots, n\}$ denote the index set of datapoints. A partition of $[n]$ is a collection of unordered nonempty subsets (clusters) $\Pi_n = \{S_1, \dots, S_k\}$ with $\cup_j S_j = [n]$ and $S_j \cap S_\ell = \emptyset$ for $j \neq \ell$ . Let $\mathcal{P}_{[n]}^k$ denote the set of partitions of $[n]$ into $k$ blocks, and $\mathcal{P}_{[n]} = \cup_{k=1}^n \mathcal{P}_{[n]}^k$ be the set of all partitions of $[n]$ . We use notations $n_j = |S_j|$ and $\mathbf{n} = (n_1, \dots, n_k)$ to denote the cluster sizes and $k = |\Pi_n|$ to denote the number of clusters in partition $\Pi_n$ . Let $z_i \in \{1, \dots, k\}$ be a cluster membership of $i$ -th datapoint and $\mathbf{z} = (z_1, \dots, z_n)$ be a cluster membership vector. Further, let $\mathcal{I}_n^k$ be a collection of integer partitions of $n$ into $k$ parts, a nonincreasing $k$ -tuple of positive integers $\mathbf{n} = (n_1, \dots, n_k)$ whose sum is $n$ . Similarly, define $\mathcal{I}_n = \cup_{k=1}^n \mathcal{I}_n^k$ . For a single $\mathbf{n} \in \mathcal{I}_n^k$ , there are $n! / (\prod_{i=1}^n (i!)^{m_i} m_i!$ number of partitions in $\mathcal{P}_{[n]}^k$ whose nonincreasing cluster sizes correspond to $\mathbf{n}$ , where $m_i = \sum_{j=1}^k 1(n_j = i)$ is the number of clusters of size $i$ . + +# 2.2. Comparison of Balancedness Between Partitions + +Next we consider how to compare the balancedness of two fixed partitions with cluster sizes $\mathbf{n} = (n_1, \dots, n_k)$ and $\mathbf{n}' = (n_1', \dots, n_k')$ . We restrict our attention to the case when both partitions have $k$ clusters. A diversity index (Hill, 1973) is a measure to quantify the evenness of species distribution widely used in the ecology literature. To compare the balancedness of two partitions using the diversity index, we treat the proportion of cluster sizes $\{n_j / n\}_{j=1}^k$ as species distribution. Popular examples are the Shannon index (with base $e$ ) and the Gini-Simpson index: + +$$ +H (\boldsymbol {n}) := - \sum_ {j = 1} ^ {k} \left(n _ {j} / n\right) \log \left(n _ {j} / n\right) \quad \text {(S h a n n o n)} \tag {1} +$$ + +$$ +G (\boldsymbol {n}) := 1 - \sum_ {j = 1} ^ {k} \left(n _ {j} / n\right) ^ {2} \quad \text {(G i n i - S i m p s o n)} \tag {2} +$$ + +Other examples include the Rényi index and the Hill numbers (Daly et al., 2018).1 A higher diversity index indicates a partition is more balanced (has clusters with similar sizes), and the index is maximized when all $n_j / n$ are equal. + +However, different diversity indices do not always give a consistent ordering (Hurlbert, 1971), and they may not provide meaningful comparisons for some pairs of partitions. For instance, consider partitions of [10] with cluster sizes $\pmb{n} = (6,2,2)$ and $\pmb{n}' = (5,4,1)$ . It is not clear which one is more balanced than the other because both can be obtained by moving one data from a larger cluster of the partition (6,3,1) to a smaller cluster, and diversity indices are inconsistent: $H(\pmb{n}) \approx 0.95 > 0.94 \approx H(\pmb{n}')$ but $G(\pmb{n}) \approx 0.56 < 0.58 \approx G(\pmb{n}')$ . Instead, without refer + +ring to indices, Patil & Taillie (1982) proposed intrinsic diversity ordering, a partial order relation to compare diversity between two species distribution. When it comes to the discrete space $\mathcal{I}_n^k$ , intrinsic diversity ordering now corresponds to the reverse dominance order. + +Definition 2.1 (Reverse dominance order). Let $\pmb{n} = (n_1, \dots, n_k)$ and $\pmb{n}' = (n_1', \dots, n_k')$ be two integer partitions of $n$ into $k$ parts. By Brylawski (1973), the following statements are equivalent definitions of partial order $\prec$ on $\mathcal{I}_n^k$ where $\pmb{n} \prec \pmb{n}'$ represents $\pmb{n}'$ is more balanced than $\pmb{n}$ : + +(a) (reverse dominance ordering) Write $\mathbf{n} \prec \mathbf{n}'$ if $\sum_{j=1}^{J} n_j \geq \sum_{j=1}^{J} n_j'$ for $J = 1, \ldots, k$ and $\mathbf{n} \neq \mathbf{n}'$ . +(b) (one-step downshift) Write $\pmb{n} \prec \pmb{n}'$ if $\pmb{n}$ leads to $\pmb{n}'$ by a finite sequence of one-step downshifts: $(n_{1},\ldots ,n_{k}) \mapsto (n_{1},\ldots ,n_{u} - 1,\ldots ,n_{v} + 1,\ldots ,n_{k})$ provided that $n_u - 1 \geq n_v + 1$ , where $1 \leq u < v \leq k$ . +(c) (covering relation) $\prec$ is induced by the following covering relation: $n^{\prime}$ covers $n$ (i.e. no $n''$ exist s.t. $n\prec n^{\prime \prime}\prec n^{\prime}$ ) if $n_u^\prime = n_u - 1,n_v^\prime = n_v + 1$ for some $u < v$ , $n_j = n_j^\prime$ for all $j\in \{1,\ldots ,k\} \backslash \{u,v\}$ , and either $(*)v = u + 1$ or $(**)n_u' = n_v'$ , or both. + +See Figure 1 for an example of $\prec$ . Although Definition 2.1 can be extended to the set $\mathcal{I}_n = \cup_{k=1}^n \mathcal{I}_n^k$ , we shall only focus on the ordering between integer partitions with the same $k$ to study the balancedness of random partition models. + +# 2.3. Gibbs Partitions + +Random partition of $[n]$ is a discrete probability distribution on the space of partitions $\mathcal{P}_{[n]}$ . There are two common assumptions on random partition models: finite exchangeability and projectivity. A random partition $\Pi_{n}$ on $[n]$ is called finitely exchangeable if probabilities remain unchanged under any permutation of the indices of datapoints, which is a natural assumption unless one wants to take account of data dependence structures. Next, a sequence of random partitions $(\Pi_{n})_{n=1}^{\infty}$ satisfies projectivity if the restriction of $\Pi_{n}$ to $[m]$ is $\Pi_{m}$ for any $m < n$ , which is also called the addition rule, self-consistency, or marginal invariance property. We call $(\Pi_{n})$ infinitely exchangeable if $\Pi_{n}$ is finitely exchangeable for each $n$ and satisfies projectivity. + +In this paper, we always assume finite exchangeability but not necessarily projectivity, as advocated in Welling (2006). Under the finite exchangeability, we can express the probability mass function of $\Pi_{n}$ using the exchangeable partition probability function (EPPF) (Pitman, 1995). + +Definition 2.2 (EPPF). A symmetric function $p^{(n)}$ is an EPPF of an exchangeable random partition $\Pi_n$ of $[n]$ if + +$$ +\mathbb {P} \left(\Pi_ {n} = \left\{S _ {1}, \dots , S _ {k} \right\}\right) = p ^ {(n)} \left(| S _ {1} |, \dots , | S _ {k} |\right) +$$ + +![](images/feb22746cd6ceb96500e2d394f4d0ed93ca2b93a13e6c166e4969f1f9b3e0166.jpg) +Figure 1. Diagram representing the partial order $\prec$ on $\mathcal{I}_{10}^{3}$ . For example, $(8,1,1) \prec (7,2,1)$ which indicates $(7,2,1)$ is more balanced than $(8,1,1)$ . The vertical position corresponds to the Shannon index $H$ . Edges between two partitions represent the upper can be reached from the lower by a one-step downshift. Thick edges represent the covering relation in Definition 2.1(c). Especially, colored thick edges correspond to $(**)$ -covering with $n_u' = n_v' = 2$ (red) and $n_u' = n_v' = 3$ (blue); see Section 3.3 and Figure 4 for the detailed discussion on colored edges. + +Since EPPF is symmetric of its arguments, the values of EPPF on integer partition $n \in \mathcal{I}_n$ completely determine the probability mass function of random partition. Next, we introduce the Gibbs (or Gibbs-type) partition (Pitman, 2006), a wide class of exchangeable random partition model. + +Definition 2.3 (Gibbs partition). Given two nonnegative sequences $\mathbf{V} = (V_{n,k})_{k\leq n}$ and $\mathbf{W} = (W_{s})_{s\geq 1}$ with $V_{1,1} = W_{1} = 1$ , we say $\Pi_n\sim \mathrm{Gibbs}_{[n]}(\mathbf{V},\mathbf{W})$ if its EPPF is + +$$ +p ^ {(n)} \left(n _ {1}, \dots , n _ {k}\right) = V _ {n, k} \prod_ {j = 1} ^ {k} W _ {n _ {j}} \tag {3} +$$ + +That is, the probability mass function has a product form that ensures finite exchangeability as well as mathematical tractability. While some authors define Gibbs partition with projectivity assumption (see Proposition 2.4), our definition following Pitman (2006) does not assume projectivity. The family of Gibbs partition is broad (Lomelí et al., 2017, Fig.1), encompassing not only random partitions induced by DP, PYP, normalized generalized gamma process (Lijoi et al., 2007), and $\sigma$ -stable Poisson-Kingman partitions (Pitman, 2003), but also those induced by parametric models such as Dirichlet-multinomial and MFM. To ensure Gibbs partition also satisfies projectivity (i.e., infinitely exchangeable), Gnedin & Pitman (2005); Lijoi et al. (2007) provided the following necessary and sufficient conditions. + +Proposition 2.4. A $\mathrm{Gibbs}_{[n]}(\mathbf{V},\mathbf{W})$ partition for $n\in \mathbb{N}$ excluding partition of singletons and one-block partition, satisfies projectivity if and only if for some $\sigma \in [-\infty ,1)$ , the following two conditions are both satisfied: + +(i) $W_{s} = \Gamma (s - \sigma) / \Gamma (1 - \sigma),\quad s = 1,2,\ldots .$ +(ii) $V_{n,k} = (n - \sigma k)V_{n + 1,k} + V_{n + 1,k + 1},\quad 1\leq k\leq n$ + +When $\sigma = -\infty$ , replace $W_{s} \equiv 1$ and $(n - \sigma k)$ by $k$ in (ii). + +The most important subclass of infinitely exchangeable Gibbs partitions is the Ewens-Pitman two-parameter family (Ewens, 1972; Pitman, 2006) with parameters $(\sigma, \theta)$ where + +$$ +V _ {n, k} = \frac {\prod_ {i = 1} ^ {k - 1} (\theta + i \sigma)}{(\theta + 1) \cdots (\theta + n - 1)}, \quad W _ {s} = \frac {\Gamma (s - \sigma)}{\Gamma (1 - \sigma)} \tag {4} +$$ + +with exception of $V_{n,1} = 1 / ((\theta + 1) \cdots (\theta + n - 1))$ for $n \geq 2$ and $V_{1,1} = 1$ . The range of $(\sigma, \theta)$ is either (a) $\sigma \in [0,1)$ , $\theta > -\sigma$ which corresponds to the random partition induced by DP and PYP, (b) $\sigma < 0$ , $\theta = K|\sigma|$ for $K \in \mathbb{N}$ which corresponds to Dirichlet-multinomial allocation model, or (c) $\sigma = -\infty$ , replacing $W_s \equiv 1$ and $V_{n,k} = K(K - 1) \cdots (K - k + 1) / K^n$ for some $K \in \mathbb{N}$ leads to the coupon-collector's partition. See Pitman (2006); De Blasi et al. (2015) for the detailed treatments. + +# 3. Balancedness of Gibbs Partition and Related Properties + +# 3.1. Why the Rich Get Richer? + +First, we define the balancedness of a finitely exchangeable random partition using the ordering $\prec$ in Definition 2.1. + +Definition 3.1. Let $p^{(n)}$ be an EPPF of a finitely exchangeable random partition $\Pi_n$ on $[n]$ . Then call $\Pi_n$ and $p^{(n)}$ + +- balance-averse if $\pmb{n} \prec \pmb{n}' \implies p^{(n)}(\pmb{n}) \geq p^{(n)}(\pmb{n}')$ +- balance-seeking if $\pmb{n} \prec \pmb{n}' \implies p^{(n)}(\pmb{n}) \leq p^{(n)}(\pmb{n}')$ + +for any fixed $k \leq n$ and $\pmb{n}, \pmb{n}' \in \mathcal{I}_n^k$ . Also, call $\Pi_n$ balance-neutral if $\Pi_n$ is both balance-averse and balance-seeking. + +The definition has a straightforward interpretation: $\Pi_{n}$ is balance-averse (seeking) when it assigns a lower (higher) probability to a more balanced partition in terms of $\prec$ . + +Now we present the necessary and sufficient conditions which characterize the balancedness of Gibbs partitions, where the proof is deferred to Appendix A. + +Theorem 3.2. Let $p^{(n)}$ be an EPPF of $\operatorname{Gibbs}_{[n]}(V, W)$ . Then for any $n = 1, 2, \ldots$ , $p^{(n)}$ is + +- balance-averse if and only if $\mathbf{W}$ is log-convex, +- balance-seeking if and only if $W$ is log-concave, + +where the sequence $\mathbf{W} = (W_{s})_{s = 1}^{\infty}$ is called log-convex if $W_{s}^{2}\leq W_{s - 1}W_{s + 1}$ for $s\geq 2$ , and is called log-concave if $W_{s}^{2}\geq W_{s - 1}W_{s + 1}$ for $s\geq 2$ and has no internal zeros. + +Thus, to check the balancedness of a Gibbs partition, it is not necessary to verify the conditions in Definition 3.1, and one only needs to analyze the log-convexity of $W$ . + +Gibbs partition admits a simple form of reallocation rule (prediction rule if projectivity holds) thanks to the product-form EPPF. The following corollary draws an explicit connection between the "rich-get-richer" metaphor and the balancedness of Gibbs partition based on Definition 3.1; see Appendix A for the details. + +Corollary 3.3. Let $\Pi_{n+1} \sim \mathrm{Gibbs}_{[n+1]}(\mathbf{V}, \mathbf{W})$ . Given the cluster memberships of the first $n$ datapoints $\mathbf{z}_{1:n}$ with $k$ clusters, the reallocation rule for the next datapoint is + +$$ +\mathbb {P} \left(z _ {n + 1} = j \mid \mathbf {z} _ {1: n}\right) \propto \left\{ \begin{array}{l l} f \left(n _ {j}\right) & i f j = 1, \dots , k \\ g (n, k) & i f j = k + 1 \end{array} \right. \tag {5} +$$ + +Then $f$ is an increasing (decreasing) function over $\mathbb{N}$ if and only if $\Pi_{n+1}$ is balance-averse (seeking) for any $n \in \mathbb{N}$ . + +In addition to the finite exchangeability, many existing random partition model also assumes projectivity (aforementioned examples of Gibbs partitions in Section 2.3 are all infinitely exchangeable). By Proposition 2.4, the following corollary states that infinitely exchangeable Gibbs partitions are always balance-averse. + +Corollary 3.4. Let $p^{(n)}$ be an EPPF of infinitely exchangeable Gibbs partition. Then $p^{(n)}$ is always balance-averse; i.e., for two integer partitions $\mathbf{n}, \mathbf{n}' \in \mathcal{I}_n^k$ with $k \leq n$ , + +$$ +\boldsymbol {n} \prec \boldsymbol {n} ^ {\prime} \Longrightarrow p ^ {(n)} (\boldsymbol {n}) \geq p ^ {(n)} \left(\boldsymbol {n} ^ {\prime}\right) +$$ + +with equality holds only if $\sigma = -\infty$ + +To see this, $W_{s} = \Gamma (s - \sigma) / \Gamma (1 - \sigma), s = 1,2,\ldots$ is strictly log-convex for any $\sigma \in (-\infty ,1)$ and $W_{s}\equiv 1$ for $\sigma = -\infty$ . Figure 2 depicts the behavior of $\log p^{(n)}$ for the three different Ewens-Pitman two-parameter models in (4). The x-axis is the Shannon index $H$ , which satisfies $n\prec n^{\prime}\Rightarrow H(n) < H(n^{\prime})$ . All scatterplots show a decreasing pattern for each $k$ as $H$ increases (i.e., partitions become more balanced), since two-parameter models are all infinitely exchangeable and thus balance-averse. + +Corollary 3.4 answers why the "rich-get-richer" property is shared across many existing random partition models. At the same time, it also implies that one should sacrifice projectivity to get a more flexible class of exchangeable random partition models with the balance-seeking property. The cost of sacrificing projectivity depends on the application. When the cluster membership of the future datapoint is a primary interest, lack of projectivity leads to an undesirable consequence that the implied joint distribution on the current dataset changes as we get more data. However, it has little impact if the primary goal is to make an inference on the given dataset such as entity resolution, and opens up a wide range of possible models with different balancedness. + +![](images/c1732e8954a09c4410fa4fb8949335c1a594d435429deeee649fcb538bb1ce67.jpg) +(a) $(\sigma, \theta) = (-2, 20)$ + +![](images/a3b982ed2cc24f3190377e932ffb25f331718ed107651072350960d9e17907da.jpg) +(c) $(\sigma, \theta) = (0, 1)$ + +![](images/7a83268bdc15ea6f1944fad587afcb79244951d880983a221ca20567b98417d0.jpg) +(e) $(\sigma, \theta) = (0.8, 1)$ + +![](images/a357a7d2ad8eb40183d5f268e01b022b52440e2e65244d61f7ef0b740dd366cf.jpg) +nccluster (k) + +![](images/3a646d855f5900259cf1cc7ca72c5acaefad0da4fd4d15f07f5e1c6d5c4f9747.jpg) +(b) $(\sigma, \theta) = (-2, 40)$ + +![](images/9d6aa0a8d894abe2059cd5996ab40a80d1d847a2d6b8ee21493ffda4b0377d2f.jpg) +(d) $(\sigma, \theta) = (0, 4)$ + +![](images/e2d54bb4deac5b450af0ac06da6c1e77b309ed0a2ed7eab0660c596aecfbef73.jpg) +(f) $(\sigma, \theta) = (0.8, 4)$ +Figure 2. log-EPPF plots against Shannon index $H$ of Ewens-Pitman two-parameter models when $n = 10$ , colored by the number of clusters. (a,b) Random partitions induced by Dirichlet-multinomial with symmetric Dirichlet parameter $|\sigma| = 2$ and number of components $K = 10, 20$ respectively. (c,d) Chinese restaurant process with concentration parameters 1 and 4 respectively. (e,f) Random partitions induced by Pitman-Yor process with common discount parameter $\sigma = 0.8$ and concentration parameters 1 and 4 respectively. + +![](images/15fb3b09850a7ff403a3b5a80d206333d1e409252f41a6b422e7e05590d44f63.jpg) + +Theorem 3.2 can be extended to the Gibbs partitions with additional hierarchical structure on $\mathbf{V}$ or $\mathbf{W}$ . + +Theorem 3.5. We say $\Pi_n$ is a mixture of Gibbs partition if it is finitely exchangeable and its EPPF $p^{(n)}$ has a form + +$$ +p ^ {(n)} (n _ {1}, \dots , n _ {k}) = \int V _ {n, k} (\vartheta) \prod_ {j = 1} ^ {k} W _ {n _ {j}} (\vartheta) \nu (d \vartheta) \tag {6} +$$ + +where $\vartheta$ is a mixing parameter which may be either discrete or continuous. Then for any $n = 1,2,\ldots ,p^{(n)}$ is + +- balance-averse if $(W_{s}(\vartheta))$ is log-convex for each $\vartheta$ , +- balance-seeking if $(W_{s}(\vartheta))$ is log-concave for each $\vartheta$ . + +It provides sufficient conditions for (6) being balance-averse or balance-seeking; see Appendix A for the proof. Examples include random partitions induced by DP with prior on the concentration parameter $\theta$ , PYP with prior on the discount parameter $\sigma$ (Lijoi et al., 2007), and generalized MFM recently proposed by Frühwirth-Schnatter et al. (2021). + +# 3.2. Balance-neutral Random Partition Model + +There have been some efforts to develop random partitions that do not exhibit the "rich-get-richer" property (Jensen & Liu, 2008; Wallach et al., 2010) or control its rate (Lu et al., 2018; Poux-Médard et al., 2021) but at the cost of sacrificing exchangeability. Here we show that there does exist an exchangeable, projective random partition model that is balance-neutral, and Theorem 3.6 provides its only possible form of EPPF; see Appendix A for the proof. + +Theorem 3.6. Let $p^{(n)}$ be an EPPF of balance-neutral infinitely exchangeable random partition. Then there exist some mixing distribution $q$ on the number of components $K \in \mathbb{N}$ so that + +$$ +p ^ {(n)} (n _ {1}, \dots , n _ {k}) = \sum_ {K = k} ^ {\infty} q (K) \frac {K (K - 1) \cdots (K - k + 1)}{K ^ {n}} \tag {7} +$$ + +Figure 3 (left) gives an example when $q$ is Poisson(3) shifted by 1, showing the flat EPPF pattern for each $k$ . It can be also viewed as the limiting case of the random partition induced by MFM when $|\sigma| \to \infty$ . The prediction rule is + +$$ +\mathbb {P} \left(z _ {n + 1} = j \mid \mathbf {z} _ {1: n}\right) \propto \left\{ \begin{array}{l l} 1 & \text {i f} j = 1, \dots , k \\ \frac {V _ {n + 1 , k + 1} (q)}{V _ {n + 1 , k} (q)} & \text {i f} j = k + 1 \end{array} \right. \tag {8} +$$ + +where $V_{n,k}(q)$ is the RHS of (7) and these can be precomputed in advance; see Miller & Harrison (2018) for details. This balance-neutral random partition model can serve as a noninformative prior choice in terms of balancedness, as it assigns uniform probabilities for each $\Pi_n \in \mathcal{P}_{[n]}^k$ while $q$ controls the creation of new clusters. + +# 3.3. Comparing the Strength of Balancedness with B-sequence + +Theorem 3.2 indicates that the log-convexity/concavity of sequence $(W_{s})_{s = 1}^{\infty}$ determines the balancedness of Gibbs partition. Then a natural question arises: how to compare the balancedness between two random partitions? Which Gibbs partition is more balanced over the other? + +![](images/26b6016bc590071bf4f176ce423d103f1eef16a8462ab2acbcfce81ca1a4056f.jpg) +Figure 3. Two examples of log-EPPF plots, see Figure 2 for the legend. (Left) Balance-neutral, when $q = 1 + \text{Poisson}(3)$ . (Right) Balance-seeking, when ESC model with $\mu = \text{Binom}^+(10, 1/4)$ . + +![](images/2be82edbd1660a0675b8621427e1a83d6306cb1365bf1c8f5558441662150a9f.jpg) +Figure 4. Graphical interpretation of B-sequence via (10), where $n = 10$ and $W$ in (4) is parameterized by $\sigma$ . Subplots (a), (b) are zoomed portion of Figure 2(c), (e) respectively. Red segments correspond to $(*)$ -covering relation with $s = 2$ , and blue with $s = 3$ (see also Figure 1). Approximately, the slope of red segments are $nB_{2}(\sigma = 0)$ (left) and $nB_{2}(\sigma = 0.8)$ (right), and blue segments are $nB_{3}(\sigma = 0)$ (left) and $nB_{3}(\sigma = 0.8)$ (right). As $\sigma$ increases, slopes become steeper and the EPPF becomes more unbalanced. + +Assuming $(W_{s})$ has no internal zeros, we can use the concept of relative log-concavity ordering $\leq_{\mathrm{lc}}$ (Whitt, 1985; Yu, 2010) which is a preorder satisfying reflexivity and transitivity. $W$ is called log-concave relative to $W^{\prime}$ , written as $W\leq_{\mathrm{lc}}W^{\prime}$ , if $\operatorname {supp}(W)\subseteq \operatorname {supp}(W^{\prime})$ and $(\log (W_s / W_s'))$ is concave in $\operatorname {supp}(W)$ , the support of $W$ . While the comparison of $W$ in ordering $\leq_{\mathrm{lc}}$ itself can be used to compare the balancedness, there is also a need to define an intuitive measure that quantifies the balancedness so that we propose $B$ -sequence as follows. + +Definition 3.7 (B-sequence). $(B_{s}(\boldsymbol{W}))_{s\geq 2}$ is a B-sequence of Gibbs $_{[n]}$ ( $\boldsymbol{V}, \boldsymbol{W}$ ) for $n \in \mathbb{N}$ , a sequence of extended real numbers which only depends on $\boldsymbol{W}$ , defined as + +$$ +B _ {s} (\boldsymbol {W}) = - s \left(\log W _ {s + 1} - 2 \log W _ {s} + \log W _ {s - 1}\right) \tag {9} +$$ + +with the provision that $B_{s}(\mathbf{W}) = +\infty$ if $W_{s+1} = 0$ . + +This definition is closely related to the slope of log-EPPF against the Shannon index $H$ . Recall the covering relation from Definition 2.1(c) corresponding to the case $(\ast)$ . If $\pmb{n}, \pmb{n}' \in \mathcal{I}_n^k$ and $\pmb{n}'$ is a $(\ast)$ -cover of $\pmb{n}$ , then there exists some $s \geq 2$ such that $s = n_u' = n_u - 1 = n_v' = n_v + 1$ with $u < v$ . We prove that $nB_s(\pmb{W})$ is an approximation of the slope along this covering relation as shown in Figure 4: + +$$ +\frac {\log p ^ {(n)} \left(\boldsymbol {n} ^ {\prime}\right) - \log p ^ {(n)} (\boldsymbol {n})}{H \left(\boldsymbol {n} ^ {\prime}\right) - H (\boldsymbol {n})} \approx n B _ {s} (\boldsymbol {W}), \tag {10} +$$ + +where we defer the detailed derivation of approximation to Appendix B. That is, B-sequence represents the strength of balancedness by measuring the derivative of log-EPPF against Shannon index $H$ , the part which is invariant of $n$ . + +Here $B_{s}(\mathbf{W}) \equiv 0$ is equivalent to the Gibbs partition being balance-neutral which serves as the origin, and $B_{s}(\mathbf{W}) \geq 0$ ( $\leq 0$ ) for all $s$ is equivalent to the Gibbs partition being balance-seeking (balance-averse) respectively. The part of (9) inside the parenthesis is the discrete second derivative of the sequence $(\log W_{s})$ and naturally relates to log-convexity. Indeed, we have $\mathbf{W} \leq_{\mathrm{lc}} \mathbf{W}'$ if and only if $B_{s}(\mathbf{W}) \geq B_{s}(\mathbf{W}')$ for all $s \geq 2$ . See Appendix B for the proof. + +![](images/7566c29aebd63d92dce4dc36f87b5195c7f30e0588c0fabd29a5fa7ec60b08aa.jpg) + +![](images/44bfbcd98578ef3b7c2b9a24b2a84e6ffc64bcf7bff657fcffb7935ecc1285f7.jpg) + +Examples. Consider Ewens-Pitman two-parameter family (4) where $W$ is parameterized by $\sigma$ . Then, for $\sigma < \sigma' < 1$ , the corresponding B-sequences $(B_s(\sigma))$ and $(B_s(\sigma'))$ satisfy $B_s(\sigma') < B_s(\sigma) < 0$ for all $s \geq 2$ . It implies that Dirichlet-multinomial or MFM $(\sigma < 0)$ based random partition model is more balanced than CRP $(\sigma = 0)$ induced by DP, and CRP is more balanced than the one induced by PYP $(\sigma \in (0,1))$ . The slope interpretation in (10) well matches with the pattern shown in Figure 2; the negative slope becomes steeper as $\sigma$ increases. This result is also consistent with the comparisons in Green & Richardson (2001); Miller & Harrison (2018) on the mixture modeling tasks, where CRP typically yields small extraneous clusters compared to Dirichlet-multinomial or MFM. + +The effect of balancedness can be also found in topic model applications. Although the difference between LDA (Blei et al., 2003) and hierarchical DP (HDP; Teh et al., 2006) is often emphasized in terms of the limited/unlimited number of topics, it is almost always neglected that the prior on the per-document topic distribution of HDP is more unbalanced than those of LDA. As an example of the effect of balancedness, Shi et al. (2019) studied how stopwords (e.g. "a", "the", ...) affect the performance of topic modeling algorithms. As the proportion of stopwords increases, the performance of HDP deteriorates significantly compared to LDA since stopwords make the per-document topic proportion more balanced. It also suggests the importance of the hyperparameter choice which affects the balancedness of the model (Asuncion et al., 2009). + +For the community detection problems, Legramanti et al. (2022) utilized infinitely exchangeable Gibbs partitions as a prior on the partition of nodes. In their simulation studies with true clusters being fairly balanced, a random partition prior with $\sigma = -1$ (Gnedin, 2010) performed the best com + +pared to other more unbalanced priors with $\sigma > -1$ . Also see Schmidt & Morup (2013) for a real network data application of the CRP prior (Kemp et al., 2006), which yields many tiny community estimates. To sum up, the balancedness of random partition models can help understand these findings and choose random partition models with desired balancedness to tackle these problems. + +Remark. The comparison of balancedness between some special cases of random partitions has been discussed before (Miller & Harrison, 2018; Fruhwirth-Schnatter et al., 2021) but from a different perspective. They considered the aggregated probabilities $\sum_{\Pi_n \in \mathcal{A}} \mathbb{P}(\Pi_n = \{S_1, \ldots, S_k\})$ with $\mathcal{A} = \{\Pi_n \in \mathcal{P}_{[n]}^k : \Pi_n$ has cluster sizes $(n_1, \ldots, n_k)\}$ (or equivalently, the distribution of labeled cluster sizes), instead of the probability mass of each partition $\mathbb{P}(\Pi_n = \{S_1, \ldots, S_k\}) = p^{(n)}(|S_1|, \ldots, |S_k|)$ , the EPPF. Comparison of aggregated probabilities has a somewhat unnatural interpretation when it comes to explaining the prior effect of random partition models on the posterior estimate. The probability mass of individual partition (EPPF) is what contributes to the posterior, not the aggregated probability. While the distribution of functionals over the labeled cluster sizes, such as mean and variance of the Shannon index (Greve et al., 2022), could be indicative of comparison regarding balancedness, comparison of EPPF provides a more direct interpretation of the prior effect on the posterior estimate which is often a point of interest. + +# 4. Balance-seeking Random Partition Models + +# 4.1. Entity Resolution and ESC Model + +Entity resolution (ER) is the process of matching records that describe the same individual when there are no unique identifiers available (such as due to privacy reasons). Assuming each record corresponds to one individual, ER can be understood as a clustering task where each cluster corresponds to each individual; see Binette & Steorts (2022) for the most recent review of ER literature. + +Databases have many noisy records, where reasons include address changes, name changes, measurement/transcription errors among many others. To deal with such distortions with uncertainty quantification, Steorts et al. (2016) developed a full Bayesian hierarchical model, and we briefly describe the model here. Assume $n$ records $(x_{i})_{i = 1}^{n}$ contain $L$ categorical fields with entries $(x_{i\ell})$ . Let $D_{\ell}$ be the number of categories in the $\ell$ th field and let the corresponding probabilities $\theta_{\ell} = (\theta_{\ell 1},\dots,\theta_{\ell D_{\ell}})$ . Also let the cluster indicators be $(z_{i})_{i = 1}^{n}$ , where the total number of individuals $K^{+}$ is unknown. Assuming the latent entities $(y_{k\ell})_{k = 1}^{K^{+}}$ are drawn from Categorical $(\theta_{\ell})$ , the generative process of entries is $x_{i\ell} = y_{z_i\ell}$ with probability $1 - \beta_{\ell}$ (non-distorted), and $x_{i\ell}\sim \mathrm{Categorical}(\theta_{\ell})$ with probability $\beta_{\ell}$ (distorted). + +Table 1. An example database with categorical entities $(x_{i\ell})$ . Here $z_{i}$ are assumed to be unknown. Reds are 'distorted' entities, modeled with distortion probabilities $(\beta_{\ell})$ and latent entities $(y_{k\ell})$ . + +
iSEXSURNAMESTATEzi
1FSMITHCA···1
2FJOHNSONCA···1
3FJOHNSONCA···1
4MWILLIAMSTX···2
5MWILLIAMSTX···2
6MWILLIAMSFL···2
:::::
+ +See Table 1 for an example. With this Bayesian hierarchical model, by assigning a prior on the partition represented by cluster indicators $(z_{i})$ , one can obtain a posterior estimate of $z_{i}$ with uncertainty quantification of record matches. + +However, many traditional random partition models assume infinite exchangeability and thus are not suitable for ER tasks, since it leads to the behavior that the number of datapoints in each cluster grows linearly with $n$ , by Kingman's paintbox representation theorem (Kingman, 1978). To overcome this problem, Miller et al. (2015); Zanella et al. (2016) formalized the microclustering property: $M_{n} / n \xrightarrow{p} 0$ where $M_{n}$ is the maximum size of clusters so that cluster sizes grow sublinearly with $n$ . Recently Betancourt et al. (2020) proposed the exchangeable sequences of clusters (ESC) model, which provides a very general framework of random partition models possessing the microclustering property under mild assumptions. It sacrifices projectivity, and the key idea is to consider a discrete probability measure $\mu = (\mu_{s})_{s=1}^{\infty}$ with $\mu_{1} > 0$ that represents the distribution of the cluster sizes $n_{j} = |S_{j}|, j = 1, \ldots, k$ . Conditional on $\mu$ , ESC is a Gibbs partition model where its EPPF is: + +$$ +p ^ {(n)} \left(n _ {1}, \dots , n _ {k} \mid \boldsymbol {\mu}\right) = \frac {1}{\mathbb {P} \left(E _ {n} \mid \boldsymbol {\mu}\right)} \frac {k !}{n !} \prod_ {j = 1} ^ {k} n _ {j}! \mu_ {n _ {j}} \tag {11} +$$ + +where $E_{n}\coloneqq \Big\{$ there exists $k\in \mathbb{N}$ such that $\sum_{j = 1}^{k}n_{j} = n\}$ When $\sum_{s = 1}^{\infty}s\mu_s < \infty$ , a random partition with EPPF of form (11) has the microclustering property. + +# 4.2. Balance-seeking ESC Models + +The Balancedness of random partition models also plays an important role in ER tasks, since it is not plausible to assume that a small number of clusters dominate the whole database. For example, assume there are $n = 1000$ number of records of $K^{+} = 100$ individuals. Then a balance-averse random partition model assigns a higher probability to a partition with cluster sizes (901, 1, ..., 1) (length 100) compared to a partition with cluster sizes (10, 10, ..., 10), suggesting the balance-seeking model would be better suited. The mi + +croclustering property has a similar rationale by limiting the growth rate of the maximum cluster size. While the micro-clustering property is based on the asymptotic behavior of cluster sizes, balancedness focuses on the non-asymptotic point of view and they complement each other. + +We expand the current knowledge of ESC models by providing subclasses of ESC models with different balancedness properties. By Theorem 3.2 and (9), $\mu$ being the zero-truncated Poisson distribution in (11) is the choice such that the B-sequence becomes identically zero, leading to the following theorem; see Appendix A for the proof. + +Theorem 4.1. Let $p^{(n)}$ be an EPPF of ESC model with fixed measure $\mu$ . Then for any $n = 1,2,3\cdots$ , + +- $p^{(n)}$ is balance-averse if and only if $\mu \geq_{\mathrm{lc}}$ Poisson+, +- $p^{(n)}$ is balance-seeking if and only if $\mu \leq_{\mathrm{lc}}$ Poisson+, +- $p^{(n)}$ is balance-neutral if and only if $\pmb{\mu} = \mathrm{Poisson}^+$ . + +where Poisson+ indicates the p.m.f. of zero-truncated Poisson distribution with arbitrary parameter $\lambda$ . + +In Table 2, we provide various examples of $\mu$ that lead to balance-averse, neutral, and balance-seeking ESC models. See Figure 3 (right) for an example of log-EPPF plot of balance-seeking model when $\mu = \mathrm{Binomial}^{+}(10,1 / 4)$ , showing the increasing pattern for each $k$ . Theorem 4.1 implies that a balance-seeking ESC model always possesses the microclustering property since all $\mu$ which are relative log-concave to Poisson have finite moments of all orders (Johnson et al., 2013). Especially, $\mu = \mathrm{Binomial}^{+}$ with fixed number of trial $N$ has the bounded microclustering property (Betancourt et al., 2022), the size of the largest cluster is upper bounded. + +With the Bayesian hierarchical model for ER task outlined in Section 4.1, one can choose a family of $\mu$ to construct an ESC partition prior and carry out the posterior inference with Markov chain Monte Carlo (MCMC) methods. This includes a posterior sampling of cluster indices $z_{i}$ as well as $\theta_{\mu}$ (parameters of $\mu$ ) from their conditional distributions. For example, the full conditional distribution of $z_{i}$ is + +$$ +\mathbb {P} \left(z _ {i} = j | -\right) \propto p (\boldsymbol {x} | \mathbf {z} _ {- i}, z _ {i} = j, -) \mathbb {P} \left(z _ {i} = j | \mathbf {z} _ {- i}, \theta_ {\mu}\right) +$$ + +where the latter part $p_j^{-i} \coloneqq \mathbb{P}(z_i = j|\mathbf{z}_{-i},\theta_\mu)$ is + +$$ +p _ {j} ^ {- i} \propto \left\{ \begin{array}{l l} \frac {(n _ {j} ^ {- i} + 1) \mu_ {n _ {j} ^ {- i} + 1}}{\mu_ {n _ {j} ^ {- i}}} \stackrel {{l e t}} {{=}} f (n _ {j} ^ {- i}; \theta_ {\mu}) & \text {i f} j = 1, \ldots , k ^ {- i}, \\ (k ^ {- i} + 1) \mu_ {1} & \text {i f} j = k ^ {- i} + 1 \end{array} \right. +$$ + +where $k^{-i}$ and $n_j^{-i}$ are the number and sizes of clusters in $\mathbf{z}_{-i}$ . In Appendix C, we provide details of EPPFs, reallocation rules and posterior inference algorithms of five different examples of $\pmb{\mu}$ in Table 2. + +Table 2. Examples of $\mu$ in ESC model and their supports, grouped by balancedness property. Superscript $^+$ indicates zero-truncated distribution. CMP stands for a Conway-Maxwell-Poisson distribution (Shmueli et al., 2005) with parameters $\lambda$ and $\nu$ . + +
μSupport
Balance- +averse +(Bs<0)NegativeBinomial+ +Geometric +LogarithmicN +N +N
NeutralPoisson+N
Balance- +seeking +(Bs>0)Binomial+ +HyperGeometric+ +CMP+ with ν>1finite +finite, must contain 1 +N
+ +Notably when $\pmb{\mu} = \mathsf{Binomial}^{+}(N,p)$ , the corresponding ESC model is balance-seeking and the reallocation probability to an existing cluster is proportional to $f(n_{j}^{-i};\theta_{\mu}) = N - n_{j}^{-i}$ for $n_j^{-i}\leq N$ , a linear function of $n_j^{-i}$ with a negative slope showing the "rich-get-poorer" characteristic. + +When $n$ is very large, the standard Gibbs sampling algorithm which reallocates $z_{i}$ one by one may suffer from slow mixing of the Markov chain. We utilize the chaperones algorithm (Miller et al., 2015; Zanella et al., 2016) which focuses on reallocations that have higher probabilities, but adopting other strategies (e.g. split-merge sampler) is also possible. We remark that the change of balancedness of Gibbs partition will not affect the computational cost as long as $V, W$ are readily available. More details on posterior inference algorithms can be found in Appendix C. + +# 4.3. Real Data Application of Balance-seeking Models + +In this section, we demonstrate the effectiveness of balance-seeking random partition for the ER task using the Survey of Income and Program Participation data (U.S. Census Bureau, 2009). We use the same dataset (SIPP1000) that Betancourt et al. (2020) used to benchmark the performance; the database with $n = 4116$ (number of records) and $K^{+} = 1000$ (number of entities) was collected from the five waves of the longitudinal survey performed between 2005-2006. The main task is to recover the identifiers only using the $L = 5$ categorical fields (sex, birth year, birth month, race, and state of residence), assuming the unique identifiers are unknown and compare the results with the true partition. + +With the SIPP1000 dataset and the hierarchical model described in Section 4.1, we compare the performance of four different ESC models where $\pmb{\mu}$ is: (i) Binomial $^{+}$ with a fixed number of trials $N = 5$ (balance-seeking), (ii) Poisson $^{+}$ (balance-neutral), (iii) NegativeBinomial $^{+}$ (balance-averse), and (iv) Dirichlet (neither balance-seeking nor averse; Betancourt et al., 2020). Hyperpriors and MCMC specification details are described in Appendix D. + +![](images/13919e42caa44f143bbac8e1e6094da9834569d8b1e1b1435398e2bd8250f3f9.jpg) +Figure 5. Posterior distributions (boxplots) of the number of clusters of size $i$ for each models, $m_{i}$ , for the SIPP1000 data. True $m_{i}$ are shown as black diamonds and annotated by their values. + +Table 3. SIPP1000 data: posterior mean and standard deviation of the number of entities ( $K_{true}^{+} = 1000$ ); FNRs and FDRs in %. + +
μ (balance-)E(K+|x)SDFNRFDR
Binom+ (seeking)951.56.24.34.6
Poisson+ (neutral)1043.88.84.93.3
NegBin+ (averse)1058.68.84.93.0
Dirichlet (n/a)1076.45.34.81.5
+ +The result in Figure 5 shows that the balance-seeking random partition prior penalizes the number of small-size clusters such as singletons, while the balance-averse prior does the opposite. This is evident since the balance-seeking model assigns a less prior probability to the partition with many singleton clusters where singletons make a partition unbalanced. Consequently, in Table 3, the balance-seeking model gives a more conservative estimate of the number of clusters with a lower false negative rate (FNR), but at the cost of yielding a higher false discovery rate (FDR). + +The results indicate that balance-seeking random partition models are more effective in false negative control. Indeed, in many practical applications of ER, FNR control carries more weight than FDR control (Randall et al., 2013). For example, if the matched record is used to inform patients of their conditions, it is much more important to reduce FNR (fail to inform) than FDR (inform to the wrong patient). In Appendix D, we present additional simulation results with various different cluster size distributions and different distortion probabilities $(\beta_{\ell})$ . The results show that the balance-seeking model generally achieves a lower FNR rate compared to balance-neutral or balance-averse models. + +# 5. Concluding Remarks + +In this paper, we rigorously define and study the balancedness property of exchangeable random partition models, especially focusing on Gibbs partition models. By characterizing the "rich-get-richer" property as a balance-averseness, Corollary 3.4 provides an insight that two common assumptions (product-form exchangeability and projectivity) of random partition models lead to the "rich-get-richer" property. Although we conjecture that every infinitely exchangeable random partitions are balance-averse, we remark that our result is very general because almost all existing random partition models are either Gibbs or a mixture of Gibbs due to the simple reallocation rule (5). There is emerging literature beyond the Gibbs partition framework (Favaro et al., 2011; Camerlenghi et al., 2018) and analyzing the balancedness of such models is an interesting future direction to pursue. + +Another interesting future direction is to study the balancedness of non-exchangeable random partition models. Examples include random partitions with covariate information (Park & Dunson, 2010; Müller et al., 2011), spatial or pairwise information (Blei & Frazier, 2011; Page & Quintana, 2016; Dahl et al., 2017; Xie & Xu, 2020), baseline partition serves as a “center” (Smith & Allenby, 2019; Paganin et al., 2021), temporal contiguity (Barry & Hartigan, 1992; 1993; Monteiro et al., 2011) and spatial contiguity (Teixeira et al., 2019; Luo et al., 2021a; Lee et al., 2021; Luo et al., 2021b). When random partition is no longer exchangeable, probability mass cannot be represented as an EPPF, and the extension of Definition 3.1 is highly nontrivial. + +To conclude, we characterize the complete family of balance-neutral random partitions, which can be used as a noninformative prior choice in terms of balancedness. We also propose $B$ -sequence to represent and compare the balancedness in a more principled and intuitive way. We offer various flexible balance-seeking random partition models, which provide better modeling solutions for applications where traditional balance-averse models are not suitable and prediction is not the main interest (due to the lack of projectivity). These models regularize the emergence of small-size clusters, which is useful in tasks such as entity resolution. We hope this article can serve as a useful guide for researchers to better understand the different behaviors of random partition models and practitioners to decide on a suitable model according to specific applications. + +# Acknowledgements + +The research of Changwoo Lee and Dr. Huiyan Sang was supported by NSF grant no. NSF DMS-1854655. We thank anonymous reviewers, Hyunwoong Chang, and Dr. Yang Ni for helpful comments. We also thank Professor Rebecca C. Steorts for sharing the preprocessed SIPP1000 dataset. + +# References + +Ahuja, J. On the distribution of sum of independent positive binomial variables. Canadian Mathematical Bulletin, 13 (1):151-152, 1970. +Ahuja, J. Distribution of the sum of independent decapitated negative binomial variables. The Annals of Mathematical Statistics, 42(1):383-384, 1971. +Asuncion, A., Welling, M., Smyth, P., and Teh, Y. On smoothing and inference for topic models. In Proceedings of the 25th Conference on Uncertainty in Artificial Intelligence, UAI 2009, 2009. +Barry, D. and Hartigan, J. A. Product partition models for change point problems. The Annals of Statistics, pp. 260-279, 1992. +Barry, D. and Hartigan, J. A. A Bayesian analysis for change point problems. Journal of the American Statistical Association, 88(421):309-319, 1993. +Berger, J. O., Bernardo, J. M., and Sun, D. Objective priors for discrete parameter spaces. Journal of the American Statistical Association, 107(498):636-648, 2012. +Betancourt, B., Zanella, G., and Steorts, R. C. Random partition models for microclustering tasks. Journal of the American Statistical Association, pp. 1-13, 2020. +Betancourt, B., Sosa, J., and Rodríguez, A. A prior for record linkage based on allelic partitions. Computational Statistics & Data Analysis, 172:107474, 2022. +Binette, O. and Steorts, R. C. (Almost) all of entity resolution. Science Advances, 8(12):eabi8021, 2022. +Blei, D. M. and Frazier, P. I. Distance dependent chinese restaurant processes. Journal of Machine Learning Research, 12(8), 2011. +Blei, D. M., Ng, A. Y., and Jordan, M. I. Latent Dirichlet allocation. the Journal of Machine Learning Research, 3: 993-1022, 2003. +Brylawski, T. The lattice of integer partitions. Discrete mathematics, 6(3):201-219, 1973. +Camerlenghi, F., Lijoi, A., and Prünster, I. Bayesian nonparametric inference beyond the Gibbs-type framework. Scandinavian Journal of Statistics, 45(4):1062-1091, 2018. +Dahl, D. B. Model-based clustering for expression data via a Dirichlet process mixture model. Bayesian inference for gene expression and proteomics, 4:201-218, 2006. + +Dahl, D. B., Day, R., and Tsai, J. W. Random partition distribution indexed by pairwise information. Journal of the American Statistical Association, 112(518):721-732, 2017. +Daly, A. J., Baetens, J. M., and De Baets, B. Ecological diversity: measuring the unmeasurable. Mathematics, 6 (7):119, 2018. +De Blasi, P., Favaro, S., Lijoi, A., Mena, R. H., Prunster, I., and Ruggiero, M. Are Gibbs-type priors the most natural generalization of the Dirichlet process? IEEE Transactions on Pattern Analysis & Machine Intelligence, 37(02):212-229, 2015. +Ewens, W. J. The sampling theory of selectively neutral alleles. Theoretical population biology, 3(1):87-112, 1972. +Favaro, S., Lijoi, A., Mena, R. H., and Prünster, I. Bayesian non-parametric inference for species variety with a two-parameter Poisson-Dirichlet process prior. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 71(5):993-1008, 2009. +Favaro, S., Prünster, I., and Walker, S. G. On a class of random probability measures with general predictive structure. Scandinavian Journal of Statistics, 38(2):359-376, 2011. +Ferguson, T. S. A Bayesian analysis of some nonparametric problems. The Annals of Statistics, pp. 209-230, 1973. +Fruhwirth-Schnatter, S., Malsiner-Walli, G., and Grün, B. Generalized mixtures of finite mixtures and telescoping sampling. Bayesian Analysis, 16(4):1279-1307, 2021. +Geng, J., Bhattacharya, A., and Pati, D. Probabilistic community detection with unknown number of communities. Journal of the American Statistical Association, 114(526): 893-905, 2019. +Gnedin, A. A species sampling model with finitely many types. Electronic Communications in Probability, 15: 79-88, 2010. +Gnedin, A. and Pitman, J. Exchangeable Gibbs partitions and Stirling triangles. Zapiski Nauchnykh Seminarov POMI, 325:83-102, 2005. +Green, P. J. and Richardson, S. Modelling heterogeneity with and without the Dirichlet process. Scandinavian Journal of Statistics, 28(2):355-375, 2001. +Greve, J., Grün, B., Malsiner-Walli, G., and Frühwirth-Schnatter, S. Spying on the prior of the number of data clusters and the partition distribution in Bayesian cluster analysis. Australian & New Zealand Journal of Statistics, in press, 2022. + +Hill, M. O. Diversity and evenness: a unifying notation and its consequences. Ecology, 54(2):427-432, 1973. +Hurlbert, S. H. The nonconcept of species diversity: a critique and alternative parameters. Ecology, 52(4):577-586, 1971. +Jensen, S. T. and Liu, J. S. Bayesian clustering of transcription factor binding motifs. Journal of the American Statistical Association, 103(481):188-200, 2008. +Johnson, N. L., Kemp, A. W., and Kotz, S. Univariate discrete distributions, volume 444. John Wiley & Sons, 2005. +Johnson, O., Kontoyiannis, I., and Madiman, M. Log-concavity, ultra-log-concavity, and a maximum entropy property of discrete compound Poisson measures. Discrete Applied Mathematics, 161(9):1232-1250, 2013. +Kemp, C., Tenenbaum, J. B., Griffiths, T. L., Yamada, T., and Ueda, N. Learning systems of concepts with an infinite relational model. In AAAI, volume 3, pp. 5, 2006. +Kingman, J. F. The representation of partition structures. Journal of the London Mathematical Society, 2(2):374-380, 1978. +Klugman, S. A., Panjer, H. H., and Willmot, G. E. Loss models: from data to decisions, volume 715. John Wiley & Sons, 2012. +Lee, C. J., Luo, Z. T., and Sang, H. T-LoHo: A Bayesian regularization model for structured sparsity and smoothness on graphs. Advances in Neural Information Processing Systems, 34, 2021. +Lee, J., Quintana, F. A., Müller, P., and Trippa, L. Defining predictive probability functions for species sampling models. Statistical science: a review journal of the Institute of Mathematical Statistics, 28(2):209, 2013. +Legramanti, S., Rigon, T., Durante, D., and Dunson, D. B. Extended stochastic block models with application to criminal networks. Annals of Applied Statistics, in press, 2022. +Lijoi, A., Mena, R. H., and Prünster, I. Controlling the reinforcement in Bayesian non-parametric mixture models. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 69(4):715-740, 2007. +Lijoi, A., Prünster, I., and Rigon, T. The Pitman-Yor multinomial process for mixture modelling. Biometrika, 107 (4):891-906, 2020. +Lomelí, M., Favaro, S., and Teh, Y. W. A marginal sampler for $\sigma$ -stable Poisson-Kingman mixture models. Journal of Computational and Graphical Statistics, 26(1):44-53, 2017. + +Lu, J., Li, M., and Dunson, D. Reducing over-clustering via the powered chinese restaurant process. arXiv preprint arXiv:1802.05392, 2018. +Luo, Z., Sang, H., and Mallick, B. A Bayesian contiguous partitioning method for learning clustered latent variables. Journal of Machine Learning Research, 22, 2021a. +Luo, Z. T., Sang, H., and Mallick, B. BAST: Bayesian additive regression spanning trees for complex constrained domain. Advances in Neural Information Processing Systems, 34, 2021b. +Miller, J., Betancourt, B., Zaidi, A., Wallach, H., and Steorts, R. C. Microclustering: When the cluster sizes grow sublinearly with the size of the data set. NIPS Bayesian Nonparametrics: The Next Generation Workshop Series, 2015. +Miller, J. W. and Harrison, M. T. Mixture models with a prior on the number of components. Journal of the American Statistical Association, 113(521):340-356, 2018. +Monteiro, J. V., Assunção, R. M., and Loschi, R. H. Product partition models with correlated parameters. Bayesian Analysis, 6(4):691-726, 2011. +Müller, P., Quintana, F., and Rosner, G. L. A product partition model with regression on covariates. Journal of Computational and Graphical Statistics, 20(1):260-278, 2011. +Neal, R. M. Slice sampling. The Annals of Statistics, 31(3): 705-767, 2003. +Nowicki, K. and Snijders, T. A. B. Estimation and prediction for stochastic blockstructures. Journal of the American Statistical Association, 96(455):1077-1087, 2001. +Paganin, S., Herring, A. H., Olshan, A. F., and Dunson, D. B. Centered partition processes: Informative priors for clustering (with discussion). *Bayesian Analysis*, 16 (1):301-370, 2021. +Page, G. L. and Quintana, F. A. Spatial product partition models. Bayesian Analysis, 11(1):265-298, 2016. +Park, J.-H. and Dunson, D. B. Bayesian generalized product partition model. Statistica Sinica, pp. 1203-1226, 2010. +Patil, G. and Taillie, C. Diversity as a concept and its measurement. Journal of the American Statistical Association, 77(379):548-561, 1982. +Patil, G. and Wani, J. On certain structural properties of the logarithmic series distribution and the first type stirling distribution. Sankhya: The Indian Journal of Statistics, Series A, pp. 271-280, 1965. + +Perman, M., Pitman, J., and Yor, M. Size-biased sampling of Poisson point processes and excursions. Probability Theory and Related Fields, 92(1):21-39, 1992. +Petrone, S. and Raftery, A. E. A note on the Dirichlet process prior in Bayesian nonparametric inference with partial exchangeability. Statistics & Probability Letters, 36(1):69-83, 1997. +Pitman, J. Exchangeable and partially exchangeable random partitions. Probability theory and related fields, 102(2): 145-158, 1995. +Pitman, J. Poisson-Kingman partitions. Institute of Mathematical Statistics Lecture Notes - Monograph Series, pp. 1-34, 2003. +Pitman, J. Combinatorial stochastic processes: Ecole d'été de probabilités de saint-flour xxxii-2002. Springer, 2006. +Pitman, J. and Yor, M. The two-parameter Poisson-Dirichlet distribution derived from a stable subordinator. The Annals of Probability, pp. 855-900, 1997. +Poux-Médard, G., Velcin, J., and Loudcher, S. Pow- ered Dirichlet process for controlling the importance of" rich-get-richer" prior assumptions in Bayesian clustering. arXiv preprint arXiv:2104.12485, 2021. +Randall, S. M., Ferrante, A. M., Boyd, J. H., and Semmens, J. B. The effect of data cleaning on record linkage quality. BMC medical informatics and decision making, 13(1): 1-10, 2013. +Schmidt, M. N. and Morup, M. Nonparametric Bayesian modeling of complex networks: An introduction. IEEE Signal Processing Magazine, 30(3):110-128, 2013. +Shi, H., Gerlach, M., Diersen, I., Downey, D., and Amaral, L. A new evaluation framework for topic modeling algorithms based on synthetic corpora. In The 22nd International Conference on Artificial Intelligence and Statistics, pp. 816-826. PMLR, 2019. +Shmueli, G., Minka, T. P., Kadane, J. B., Borle, S., and Boatwright, P. A useful distribution for fitting discrete data: revival of the Conway-Maxwell-Poisson distribution. Journal of the Royal Statistical Society: Series C (Applied Statistics), 54(1):127-142, 2005. +Smith, A. N. and Allenby, G. M. Demand models with random partitions. Journal of the American Statistical Association, 2019. +Steorts, R. C. Entity resolution with empirically motivated priors. Bayesian Analysis, 10(4):849-875, 2015. + +Steorts, R. C., Hall, R., and Fienberg, S. E. A Bayesian approach to graphical record linkage and dedduplication. Journal of the American Statistical Association, 111(516): 1660-1672, 2016. +Steorts, R. C., Betancourt, B., and Zanella, G. microcluster: Entity Resolution with Random Partition Priors for Microclustering, 2020. URL https://CRAN.R-project.org/package=microcluster. R package version 0.1.0. +Sundt, B. and Jewell, W. S. Further results on recursive evaluation of compound distributions. ASTIN Bulletin: The Journal of the IAA, 12(1):27-39, 1981. +Tate, R. F. and Goen, R. Minimum variance unbiased estimation for the truncated Poisson distribution. The Annals of Mathematical Statistics, pp. 755-765, 1958. +Teh, Y. W., Jordan, M. I., Beal, M. J., and Blei, D. M. Hierarchical Dirichlet processes. Journal of the American Statistical Association, 101(476):1566-1581, 2006. +Teixeira, L. V., Assunção, R. M., and Loschi, R. H. Bayesian space-time partitioning by sampling and pruning spanning trees. Journal of Machine Learning Research, 20: 85-1, 2019. +U.S. Census Bureau. Survey of income and program participation (SIPP) 2004 panel, 2009. URL https://www.icpsr.umich.edu/web/pages/. +Wallach, H., Jensen, S., Dicker, L., and Heller, K. An alternative prior process for nonparametric Bayesian clustering. In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, pp. 892-899. JMLR Workshop and Conference Proceedings, 2010. +Welling, M. Flexible priors for infinite mixture models. In Proceedings of the Workshop on Learning with Nonparametric Bayesian Methods, 23rd ICML, 2006. +Whitt, W. Uniform conditional variability ordering of probability distributions. Journal of Applied Probability, 22 (3):619-633, 1985. +Xie, F. and Xu, Y. Bayesian repulsive Gaussian mixture model. Journal of the American Statistical Association, 115(529):187-203, 2020. +Yu, Y. Relative log-concavity and a pair of triangle inequalities. Bernoulli, 16(2):459-470, 2010. +Zanella, G., Betancourt, B., Miller, J. W., Wallach, H., Zaidi, A., and Steorts, R. C. Flexible models for microclustering with application to entity resolution. Advances in Neural Information Processing Systems, 29, 2016. + +In Appendix A, we provide the proofs of all theorems in this paper: Theorem 3.2, Corollary 3.3, Theorem 3.5, Theorem 3.6, and Theorem 4.1. In Appendix B, we provide a detailed analysis of the B-sequence on its graphical interpretation and properties regarding balancedness. In Appendix C, we provide more details on the subclasses of the ESC model discussed in Section 4.2 and their corresponding inference algorithms using MCMC methods. Finally, in Appendix D, we provide details on the SIPP1000 data analysis results in Section 4.3 and also present the simulation study results. In the supplementary material, we provide an interactive demo regarding the balancedness of the Ewens-Pitman two-parameter family and R code to run the balance-seeking ESC model described in Section 4.2 and Appendix C. + +# A. Proofs of Theorems + +# A.1. Proof of Theorem 3.2 + +(Log-convexity of $\pmb{W}$ implies balance-averseness) Let $\pmb{n}, \pmb{n}' \in \mathcal{I}_n^k$ be two distinct integer partitions of $n$ into $k$ parts. To show that $\pmb{n} \prec \pmb{n}' \Rightarrow p^{(n)}(\pmb{n}) \geq p^{(n)}(\pmb{n}')$ , by the transitivity of $\prec$ and $\leq$ , it is sufficient to show for the case when $\pmb{n}'$ can be reached by a single one-step downshift from $\pmb{n}$ . Let $\pmb{n} = (n_1, \dots, n_k)$ and its one-step downshift $\pmb{n}' = (n_1', \dots, n_k') = (n_1, \dots, n_u - 1, \dots, n_v + 1, \dots, n_k)$ for some $1 \leq u < v \leq k$ such that $n_u - 1 \geq n_v + 1$ . Then the log-convexity of $\pmb{W}$ , i.e. convexity of the sequence $(\log W_s)_{s=1}^\infty$ implies + +$$ +\begin{array}{l} \log W _ {n _ {v} + 1} - \log W _ {n _ {v}} \leq \log W _ {n _ {u}} - \log W _ {n _ {u} - 1} \quad \because n _ {u} - 1 \geq n _ {v} + 1 \\ \Longrightarrow \log W _ {n _ {u}} + \log W _ {n _ {v}} \geq \log W _ {n _ {u} - 1} + \log W _ {n _ {v} + 1} \\ \Longrightarrow W _ {n _ {u}} W _ {n _ {v}} \geq W _ {n _ {u} - 1} W _ {n _ {v} + 1} = W _ {n _ {u} ^ {\prime}} W _ {n _ {v} ^ {\prime}} \\ \Rightarrow p ^ {(n)} (\boldsymbol {n}) = V _ {n, k} \prod_ {j = 1} ^ {k} W _ {n _ {j}} \geq V _ {n, k} \prod_ {j = 1} ^ {k} W _ {n _ {j} ^ {\prime}} = p ^ {(n)} (\boldsymbol {n} ^ {\prime}) \\ \end{array} +$$ + +Note that $W_{s} > 0$ for all $s$ , since $W_{1} = 1$ and $W_{s}^{2} \leq W_{s - 1}W_{s + 1}$ for all $s$ . To see this, if $W_{s} = 0$ for some $s = s^{*}$ , then it implies $W_{s} = 0$ for all $s \leq s^{*}$ , which contradicts to $W_{1} = 1$ . + +(Balance-averseness implies log-convexity of $\pmb{W}$ ) Let $\pmb{n} = (n_{1},\dots ,n_{k})$ and $\pmb{n}^{\prime} = (n_{1},\dots ,n_{u} - 1,\dots ,n_{v} + 1,\dots ,n_{k})$ with $n_u - 1 = n_v + 1\stackrel {let}{=}n^*$ . Then $p^{(n)}(\pmb {n})\geq p^{(n)}(\pmb {n}^{\prime})$ by balance-averseness, and this implies $W_{n^{*}}^{2}\leq W_{n^{*} + 1}W_{n^{*} - 1}$ . Since $n^*\in \{2,3,\ldots \}$ can be chosen arbitrarily as balance-averseness holds for any $k$ and $n$ such that $k\leq n$ , thus $\pmb{W}$ is log-convex. + +The equivalency between balance-seeking and log-concavity follows with similar arguments. + +# A.2. Proof of Corollary 3.3 + +Let $\Pi_{n+1} \sim \mathrm{Gibbs}_{[n+1]}(\mathbf{V}, \mathbf{W})$ so that the EPPF is $p^{(n+1)}(n_1, \ldots, n_k) = V_{n+1,k} \prod_{l=1}^k W_{n_l}$ . Let the cluster membership of first $n$ datapoints with $k$ clusters be $\mathbf{z}_{1:n} \in \{1, \ldots, k\}^n$ and $n_l = \sum_{i=1}^n 1(z_i = l)$ for $l = 1, \ldots, k$ . We first derive the expression (5), using $W_1 = 1$ by definition, + +$$ +\begin{array}{l} \mathbb {P} \left(z _ {n + 1} = j \mid \mathbf {z} _ {1: n}\right) \propto \mathbb {P} \left(z _ {n + 1} = j, \mathbf {z} _ {1: n}\right) \\ = \left\{ \begin{array}{l l} V _ {n + 1, k} W _ {n _ {j} + 1} \prod_ {l \neq j} W _ {n _ {l}} & \text {i f} j = 1, \ldots , k \\ V _ {n + 1, k + 1} \prod_ {l = 1} ^ {k} W _ {n _ {l}} & \text {i f} j = k + 1 \end{array} \right. \\ \propto \left\{ \begin{array}{l l} W _ {n _ {j} + 1} / W _ {n _ {j}} \stackrel {{l e t}} {{=}} f (n _ {j}) & \text {i f} j = 1, \ldots , k \\ V _ {n + 1, k + 1} / V _ {n + 1, k} \stackrel {{l e t}} {{=}} g (n, k) & \text {i f} j = k + 1 \end{array} \right. \\ \end{array} +$$ + +For any $n \in \mathbb{N}$ , reallocation probability to the existing cluster $f(n_j) = W_{n_j + 1} / W_{n_j}$ is an increasing (decreasing) function of $n_j = 1,2,\ldots$ if and only if $\pmb {W} = (W_{s})_{s = 1}^{\infty}$ is log-convex (log-concave). Combined with Theorem 3.2, we have the Corollary 3.3. + +# A.3. Proof of Theorem 3.5 + +Let $p^{(n)}$ be an EPPF of mixture of Gibbs partition of the form in (6), i.e., + +$$ +p ^ {(n)} (n _ {1}, \ldots , n _ {k}) = \int_ {\Theta} V _ {n, k} (\vartheta) \prod_ {j = 1} ^ {k} W _ {n _ {j}} (\vartheta) \nu (d \vartheta) +$$ + +Assume that $(W_{s}(\vartheta))_{s = 1}^{\infty}$ is log-convex for each $\vartheta \in \Theta$ , where $\Theta$ is the domain of $\vartheta$ that is either discrete or continuous. Fix $\vartheta$ at an arbitrary value, and let $n, n' \in \mathcal{I}_n^k$ . To show $n \prec n' \Rightarrow p^{(n)}(n) \geq p^{(n)}(n')$ , by the transitivity of $\prec$ and $\leq$ , it is again sufficient to show for the case when $n'$ can be reached by a single one-step downshift from $n$ . Let $n = (n_1, \dots, n_k)$ and $n' = (n_1', \dots, n_k') = (n_1, \dots, n_u - 1, \dots, n_v + 1, \dots, n_k)$ for some $1 \leq u < v \leq k$ such that $n_u - 1 \geq n_v + 1$ . Then the convexity of sequence $(\log W_s(\vartheta))_{s = 1}^{\infty}$ implies + +$$ +\begin{array}{l} \log W _ {n _ {v} + 1} (\vartheta) - \log W _ {n _ {v}} (\vartheta) \leq \log W _ {n _ {u}} (\vartheta) - \log W _ {n _ {u} - 1} (\vartheta) \quad \because n _ {u} - 1 \geq n _ {v} + 1 \\ \Longrightarrow \log W _ {n _ {u}} (\vartheta) + \log W _ {n _ {v}} (\vartheta) \geq \log W _ {n _ {u} - 1} (\vartheta) + \log W _ {n _ {v} + 1} (\vartheta) \\ \Longrightarrow W _ {n _ {u}} (\vartheta) W _ {n _ {v}} (\vartheta) \geq W _ {n _ {u} - 1} (\vartheta) W _ {n _ {v} + 1} (\vartheta) = W _ {n _ {u} ^ {\prime}} (\vartheta) W _ {n _ {v} ^ {\prime}} (\vartheta) \\ \Rightarrow V _ {n, k} (\vartheta) \prod_ {j = 1} ^ {k} W _ {n _ {j}} (\vartheta) \geq V _ {n, k} (\vartheta) \prod_ {j = 1} ^ {k} W _ {n _ {j} ^ {\prime}} (\vartheta) \geq 0, \\ \end{array} +$$ + +where the last line holds for arbitrary $\vartheta \in \Theta$ . Since integration preserves inequality of functions, we have $p^{(n)}(\boldsymbol{n}) \geq p^{(n)}(\boldsymbol{n}^{\prime})$ . The statement that log-concave $(W_{s}(\vartheta))_{s=1}^{\infty}$ implies a balance-seeking $p^{(n)}$ follows with similar arguments. + +# A.4. Proof of Theorem 3.6 + +Let $p$ be an EPPF of balance-neutral, infinitely exchangeable random partition. Note that any $\pmb{n} \in \mathcal{I}_n^k$ is comparable with the most unbalanced one $\pmb{n}^{\star} = (n - k + 1, 1, \dots, 1)$ and the most balanced one $\pmb{n}^{\star \star} = (\underbrace{\lceil n / k \rceil, \cdots, \lceil n / k \rceil}_{(n \bmod k) \text{ times}}, \lfloor n / k \rfloor, \dots, \lfloor n / k \rfloor)$ , + +and $\pmb{n}^{\star}\prec \pmb{n}^{\star \star}\Rightarrow p(\pmb{n}^{\star}) = p(\pmb{n}^{\star \star})$ . We have $p(\pmb {n}) = p(\pmb{n}^{\prime})$ for all $\pmb {n},\pmb{n}^{\prime}\in \mathcal{I}_{n}^{k}$ . Thus, EPPF $p$ only depends on $n$ and $k$ and hence can be written as $p(n_{1},\ldots ,n_{k})\stackrel {let}{=}v(n,k)$ . In other words, $p$ is a Gibbs partition with $V_{n,k} = v(n,k)$ and $W_{s}\equiv 1$ . Gnedin & Pitman (2005) showed that any infinitely exchangeable Gibbs partition with $\sigma < 0$ , including $\sigma = -\infty$ , can be expressed as a mixture of Ewens-Pitman two parameter family ( $\sigma ,|\sigma |K$ ) with some mixing distribution $q$ on the number of components $K\in \mathbb{N}$ , thus the theorem follows. + +# A.5. Proof of Theorem 4.1 + +By Theorem 3.2, to prove the equivalency of balance-averseness and $\mu \geq_{\mathrm{lc}}$ Poisson $^+$ , it is sufficient to prove that $\mu \geq_{\mathrm{lc}}$ Poisson $^+$ if and only if the corresponding $\mathbf{W}$ is log-convex. Rewrite the EPPF of ESC model as: + +$$ +p ^ {(n)} \left(n _ {1}, \dots , n _ {k} \mid \boldsymbol {\mu}\right) = \frac {\mu_ {1} ^ {k}}{\mathbb {P} \left(E _ {n} \mid \boldsymbol {\mu}\right)} \frac {k !}{n !} \prod_ {j = 1} ^ {k} n _ {j}! \mu_ {n _ {j}} / \mu_ {1} = V _ {n, k} \prod_ {j = 1} ^ {k} W _ {n _ {j}} \tag {12} +$$ + +The log-convexity of $(W_{s})_{s = 1}^{\infty}$ is equivalent to the convexity of $(\log (s!\mu_s))_{s = 1}^{\infty}$ , or concavity of $(- \log (s!\mu_s) + as + b)_{s = 1}^{\infty}$ for arbitrary constants $a$ and $b$ . The log-convexity of $(s!\mu_s)_{s = 1}^{\infty}$ , in other words $s\mu_s^2 \leq (s + 1)\mu_{s - 1}\mu_{s + 1}$ , implies $\mu_s > 0$ for all $s = 1,2,\ldots$ (full support), since assuming $\mu_s = 0$ for some $s = s^*$ leads to $\mu_s = 0$ for $s \leq s^*$ that contradicts with $\mu_1 > 0$ . By choosing $a = \log \lambda$ and $b = \log(e^{-\lambda} / (1 - e^{-\lambda}))$ for some $\lambda > 0$ , we can see that concavity of $(- \log (s!\mu_s) + as + b)_{s = 1}^{\infty}$ is equivalent to $\mu \geq_{\mathrm{lc}}$ Poisson $^+$ ( $\lambda$ ), by the definition of relative log-concavity and $\mu_s > 0$ for all $s$ (full support). Next, to show that $\mu \leq_{\mathrm{lc}}$ Poisson $^+$ if and only if the corresponding $\pmb{W}$ is log-concave, we can apply the similar argument as above by flipping the inequalities. Now we prove the balance-neutral case, which amounts to showing that $\pmb{\mu} = \mathsf{Poisson}^{+}$ is the only discrete probability measure such that $\pmb{W} = (s!\mu_s / \mu_1)_{s = 1}^{\infty}$ is both log-convex and log-concave. In other words, if $\log s!\mu_s$ is a linear sequence of $s$ , then $\pmb{\mu} = \mathsf{Poisson}^{+}$ . Let $\log s!\mu_s = as + b$ for some constants $a$ and $b$ , then $\mu_s = (e^{as}e^b) / s!$ for $s = 1,2,\dots$ . Solving $\sum_{s=1}^{\infty}(e^{as}e^b) / s! = 1$ leads to $b = -\log (\exp (e^a) - 1)$ . Now substituting $\lambda = e^a > 0$ , we have $\mu_s = \frac{\lambda^s}{s!}\frac{1}{e^{\lambda - 1}}$ , a probability mass function of Poisson $^+$ ( $\lambda$ ). + +# B. Details on B-sequence + +# B.1. Slope Interpretation of B-sequence + +This subsection provides the derivation of Equation (10). Let $\pmb{n} = (n_{1},\dots,n_{k}),\pmb{n}^{\prime} = (n_{1}^{\prime},\dots,n_{k}^{\prime})\in \mathcal{I}_{n}^{k}$ where $\pmb{n}^{\prime}$ is a $(**)$ -cover of $\pmb{n}$ . Then there exists some $s\geq 2$ such that + +$$ +\boldsymbol {n} = (n _ {1}, \dots n _ {u}, \dots , n _ {v}, \dots , n _ {k}) \mapsto (n _ {1}, \dots , \underbrace {n _ {u} - 1} _ {= s}, \dots , \underbrace {n _ {v} + 1} _ {= s}, \dots , n _ {k}) = \boldsymbol {n} ^ {\prime} +$$ + +where $s = n_u' = n_u - 1 = n_v' = n_v + 1$ with $u < v$ . By Equation (3), since $\mathbf{n}$ and $\mathbf{n}'$ both have $k$ clusters, + +$$ +\log p ^ {(n)} (\boldsymbol {n} ^ {\prime}) - \log p ^ {(n)} (\boldsymbol {n}) = \log W _ {n _ {u} ^ {\prime}} + \log W _ {n _ {v} ^ {\prime}} - \log W _ {n _ {u}} - \log W _ {n _ {v}} = - \log W _ {s + 1} + 2 \log W _ {s} - \log W _ {s - 1} +$$ + +Also, for the Shannon index $H(\pmb{n}) = -\sum_{j=1}^{k}(n_j / n) \log (n_j / n)$ , + +$$ +\begin{array}{l} H \left(\boldsymbol {n} ^ {\prime}\right) - H (\boldsymbol {n}) = \left(- \frac {n _ {u} ^ {\prime}}{n} \log \frac {n _ {u} ^ {\prime}}{n} - \frac {n _ {v} ^ {\prime}}{n} \log \frac {n _ {v} ^ {\prime}}{n}\right) - \left(- \frac {n _ {u}}{n} \log \frac {n _ {u}}{n} - \frac {n _ {v}}{n} \log \frac {n _ {v}}{n}\right) (13) \\ = \frac {1}{n} \left[ (s + 1) \log \frac {s + 1}{n} - 2 s \log \frac {s}{n} + (s - 1) \log \frac {s - 1}{n} \right] (14) \\ \approx^ {4} \frac {1}{n} \left[ \frac {d ^ {2}}{d x ^ {2}} \left(x \log \frac {x}{n}\right) \right] _ {x = s} = \frac {1}{n} \frac {1}{s} (15) \\ \end{array} +$$ + +Therefore + +$$ +\frac {\log p ^ {(n)} \left(\boldsymbol {n} ^ {\prime}\right) - \log p ^ {(n)} (\boldsymbol {n})}{H \left(\boldsymbol {n} ^ {\prime}\right) - H (\boldsymbol {n})} \approx n \times - s \left(\log W _ {s + 1} - 2 \log W _ {s} + \log W _ {s - 1}\right) = n B _ {s} (\boldsymbol {W}) \tag {16} +$$ + +and see Figure 4 for the grapical illustration. + +# B.2. B-sequence and Balancedness + +First, we prove that the ordering based on the B-sequence comparison is equivalent to the log-concavity ordering. + +Theorem B.1. $W\leq_{\mathrm{lc}}W'$ if and only if $B_{s}(\pmb {W})\geq B_{s}(\pmb{W}^{\prime})$ for all $s\geq 2$ + +Proof. Below, we prove the cases when $\mathbf{W}$ have a full support or a finite support, respectively. Assume that $\mathbf{W}$ has a full support; i.e. $W_{s} > 0$ for all $s = 1,2,\ldots$ . Then $\mathbf{W} \leq_{\mathrm{lc}} \mathbf{W}'$ implies $\mathbf{W}'$ also have a full support by its definition. Note that $B_{s}(\mathbf{W}) \geq B_{s}(\mathbf{W}')$ , $\forall s$ also implies $B_{s}(\mathbf{W}') < \infty$ for all $s = 2,3,\ldots$ , and thus $\mathbf{W}'$ have a full support. Therefore, either assuming $\mathbf{W} \leq_{\mathrm{lc}} \mathbf{W}'$ or $B_{s}(\mathbf{W}) \geq B_{s}(\mathbf{W}')$ for $s = 2,3,\ldots$ , we have $\operatorname{supp}(\mathbf{W}) \subseteq \operatorname{supp}(\mathbf{W}')$ . Then, + +$$ +\begin{array}{l} \boldsymbol {W} \le_ {\mathrm {l c}} \boldsymbol {W} ^ {\prime} \iff \left(\log \left(W _ {s} / W _ {s} ^ {\prime}\right)\right) \text {i s c o n c a v e} \\ \Longleftrightarrow \left(\frac {W _ {s}}{W _ {s} ^ {\prime}}\right) ^ {2} \geq \frac {W _ {s + 1} W _ {s - 1}}{W _ {s + 1} ^ {\prime} W _ {s - 1} ^ {\prime}}, \quad \forall s = 2, 3, \ldots \\ \Longleftrightarrow \frac {W _ {s + 1} ^ {\prime} W _ {s - 1} ^ {\prime}}{\left(W _ {s} ^ {\prime}\right) ^ {2}} \geq \frac {W _ {s + 1} W _ {s - 1}}{\left(W _ {s}\right) ^ {2}}, \quad \forall s = 2, 3, \ldots \\ \Longleftrightarrow \log W _ {s - 1} ^ {\prime} - 2 \log W _ {s} ^ {\prime} + \log W _ {s + 1} ^ {\prime} \geq \log W _ {s - 1} - 2 \log W _ {s} + \log W _ {s + 1}, \quad \forall s = 2, 3, \dots \\ \Longleftrightarrow B _ {s} (\boldsymbol {W}) \geq B _ {s} \left(\boldsymbol {W} ^ {\prime}\right), \quad \forall s = 2, 3, \dots \\ \end{array} +$$ + +Next, assume that $\mathbf{W}$ has a finite support $\{1,2,\dots,m\}$ , which only happens when $\mathbf{W}$ is log-concave. Then by $\mathbf{W} \leq_{\mathrm{lc}} \mathbf{W}'$ , $\mathbf{W}'$ must have either a finite or a full support, and if it has a finite support $\{1,2,\dots,m'\}$ , then $m' \geq m$ . On the other hand, $B_s(\mathbf{W}) \geq B_s(\mathbf{W}')$ for $s = 2,3,\ldots$ implies that the support of $\mathbf{W}$ must be contained in the support of $\mathbf{W}'$ , since + +otherwise there is an $s$ such that $B_{s}(\mathbf{W}^{\prime}) = +\infty$ which contradicts with $B_{s}(\mathbf{W}) < \infty$ . Thus, either assuming $\mathbf{W} \leq_{\mathrm{lc}} \mathbf{W}^{\prime}$ or $B_{s}(\mathbf{W}) \geq B_{s}(\mathbf{W}^{\prime})$ for $s = 2,3,\ldots$ , we have $\operatorname{supp}(\mathbf{W}) \subseteq \operatorname{supp}(\mathbf{W}^{\prime})$ . Then, + +$$ +\begin{array}{l} \boldsymbol {W} \le_ {\mathrm {l c}} \boldsymbol {W} ^ {\prime} \iff \left(\log \left(W _ {s} / W _ {s} ^ {\prime}\right)\right) \text {i s c o n c a v e i n} \operatorname {s u p p} (\boldsymbol {W}) \\ \Longleftrightarrow \left(\frac {W _ {s}}{W _ {s} ^ {\prime}}\right) ^ {2} \geq \frac {W _ {s + 1} W _ {s - 1}}{W _ {s + 1} ^ {\prime} W _ {s - 1} ^ {\prime}}, \quad \forall s = 2, 3, \dots , m - 1 \\ \Longleftrightarrow \frac {W _ {s + 1} ^ {\prime} W _ {s - 1} ^ {\prime}}{\left(W _ {s} ^ {\prime}\right) ^ {2}} \geq \frac {W _ {s + 1} W _ {s - 1}}{\left(W _ {s}\right) ^ {2}}, \quad \forall s = 2, 3, \dots , m - 1 \\ \Longleftrightarrow \log W _ {s - 1} ^ {\prime} - 2 \log W _ {s} ^ {\prime} + \log W _ {s + 1} ^ {\prime} \geq \log W _ {s - 1} - 2 \log W _ {s} + \log W _ {s + 1}, \quad \forall s = 2, 3, \dots , m - 1 \\ \Longleftrightarrow B _ {s} (\boldsymbol {W}) \geq B _ {s} \left(\boldsymbol {W} ^ {\prime}\right), \quad \forall s = 2, 3, \dots , m - 1 \\ \end{array} +$$ + +which proves the claim. + +![](images/6e63df584dde3c0c7e2892dfc602fc3430038027091a22f6ba72485f7903de9e.jpg) + +By Theorem B.1 and Theorem 3.2, we have the following corollary: + +Corollary B.2. For any $n = 1,2,\ldots$ , $\mathrm{Gibbs}_{[n]}(V,W)$ is + +- balance-averse if and only if $B_{s}(\mathbf{W}) \leq 0$ for all $s \geq 2$ +- balance-neutral if and only if $B_{s}(\mathbf{W}) = 0$ for all $s \geq 2$ +- balance-seeking if and only if $B_{s}(\mathbf{W}) \geq 0$ for all $s \geq 2$ + +To see this, $B_{s}(\mathbf{W}) \equiv 0$ if and only if $\mathbf{W}$ has a full support and $W_{s}^{2} = W_{s + 1}W_{s - 1}$ for all $s \geq 2$ , which is equivalent to $(W_{s})$ being log-linear (both log-convex and log-concave). Similar argument follows for the balance-averse and the balance-seeking cases. + +# C. Details on ESC Model and Posterior Inference + +# C.1. Examples of ESC Model with Different Balancedness + +In this section, we provide details of ESC models with different balancedness properties. We consider 5 different cases, where $\mu = (\mu_s)_{s=1}^{\infty}$ is a probability mass function of 1) shifted binomial, 2) zero-truncated binomial, 3) zero-truncated Poisson, 4) zero-truncated (extended) negative binomial, and 5) logarithmic distribution. We assume the number of trials $N$ is fixed in zero-truncated binomial, while shifted binomial is not. Recall that EPPF of ESC model with fixed $\mu$ and $\mu_1 > 0$ is written as follows (Betancourt et al., 2020): + +$$ +p ^ {(n)} \left(n _ {1}, \dots , n _ {k} \mid \boldsymbol {\mu}\right) = \frac {1}{\mathbb {P} \left(E _ {n} \mid \boldsymbol {\mu}\right)} \frac {k !}{n !} \prod_ {j = 1} ^ {k} n _ {j}! \mu_ {n _ {j}} \tag {17} +$$ + +where the event $E_{n}$ is $E_{n} = \left\{ \text{there exists } k \in \mathbb{N} \text{ such that } \sum_{j=1}^{k} n_{j} = n \right\}$ . We can calculate the normalizing constant $\mathbb{P}(E_{n}|\boldsymbol{\mu})$ with the $k$ -fold convolution of random variables following the distribution $\boldsymbol{\mu}$ . That is, if $X_{1}, \ldots, X_{k} \stackrel{iid}{\sim} \boldsymbol{\mu}$ and $S_{k} := X_{1} + \dots + X_{k}$ , then $\mathbb{P}(E_{n}|\boldsymbol{\mu}) = \sum_{k=1}^{n} \mathbb{P}(S_{k} = n)$ , which is always positive if $\mu_{1} > 0$ . We provide five examples of $\boldsymbol{\mu}$ in the ESC model in Table 4, with their complete form of EPPFs including the normalizing constant. For the derivation of $k$ -fold convolution formulas, we refer the readers to Ahuja (1970); Tate & Goen (1958); Ahuja (1971); Patil & Wani (1965). Regarding the notations, $S_{1}(n, k)$ and $S_{2}(n, k)$ are the Stirling number of the first and second kind respectively, and the binomial coefficient with real argument is defined as $\binom{a}{b} = \frac{a(a-1)\cdots(a-b+1)}{b!}$ for $a \in \mathbb{R}$ and $b \in \mathbb{N}$ . When $r = 1$ in $\mathrm{NegBin}^{+}(r, p)$ , it becomes Geometric(p) distribution and the normalizing constant $\mathbb{P}(E_{n}|\boldsymbol{\mu})$ is simply $p$ . We note that $\mathrm{NegBin}^{+}(r, p)$ with $r > -1, r \neq 0$ is also called Engen's extended negative binomial distribution since it admits negative $r$ values. + +Table 4. Examples of $\mu$ in the ESC model. ESC models with shifted binomial and zero-truncated binomial are balance-seeking, zero-truncated Poisson is balance-neutral, and zero-truncated negative binomial and logarithmic are balance-averse. + +
μSupportμsP(En|μ)
1 + Bin(N,p);N ∈ Np ∈ (0,1){1,···,N+1}N!p^{s-1}(1-p)^{N-s+1}/(s-1)!(N-s+1)!∑_{k=∫n/(N+1)}^{n}\binom{Nk}{n-k}p^{n-k}(1-p)^{Nk-n+k}
Bin+(N,p);N ∈ N (fixed)p ∈ (0,1){1,···,N}\binom{N}{s}\frac{p^s(1-p)^{N-s}}{1-(1-p)^N}∑_{k=∫n/N}^{n}\sum_{i=1}^{k}\left\{\binom{k}{i}\binom{Ni}{n}\frac{(-1)^{k-i}p^n(1-p)^{Nk-n}}{(1-(1-p)^N)^k}\right\}
Poisson+(λ);λ>0Nλ^s e^{-λ}/(1-e^{-λ})s!∑_{k=1}^{n}\frac{k!\lambda^n}{(e^λ-1)^kn!}S_2(n,k)
NegBin+(r,p);r>-1,r≠0p ∈ (0,1)N\binom{s+r-1}{s}\frac{(1-p)^rp^s}{1-(1-p)^r}∑_{k=1}^{n}\sum_{i=1}^{k}\left\{\binom{k}{i}\binom{n+ri-1}{n}\frac{(-1)^{k-i}p^n}{((1-p)^{-r}-1)^k}\right\}
Logarithmic(p);p ∈ (0,1)N-1/log(1-p)p^s/s∑_{k=1}^{n}\frac{k!p^n}{n!(-\log(1-p))^k}|S_1(n,k)|
+ +# C.2. Posterior Inference Algorithms + +We provide posterior inference algorithms for the ESC models presented in the previous subsection. Let $\pmb{x}$ be data, $\theta_{\mu}$ be the parameter(s) of $\pmb{\mu}$ , $\beta = (\beta_{\ell})$ be the distortion probabilities, and $\mathbf{z} = (z_1,\dots,z_n)$ be the cluster membership vector. Categorical distribution probabilities $\theta_{\ell}$ are fixed and assumed to be the empirical distribution of the data, following Steorts (2015). Each iteration of MCMC sampler consists of three steps: first update $\Pi_n|\theta_\mu ,\beta ,x$ , next update $\theta_{\mu}|\Pi_{n},x$ , and then update $\beta |\Pi_n,\theta_\mu ,x$ . We provide details of the first two which are affected by the modification of random partition prior; the likelihood function and updating scheme of $\beta$ are similar to Steorts (2015); Betancourt et al. (2020) and hence omitted. + +1. Update $\Pi_n|\theta_\mu, \beta, x$ using the following full conditional distribution: + +$$ +\mathbb {P} (z _ {i} = j | -) \propto p (\boldsymbol {x} | \mathbf {z} _ {- i}, z _ {i} = j, \boldsymbol {\beta}) \mathbb {P} (z _ {i} = j | \mathbf {z} _ {- i}, \theta_ {\mu}), +$$ + +where the prior reallocation probability $\mathbb{P}(z_i = j|\mathbf{z}_{-i},\theta_\mu)$ is + +- (Shifted binomial) $\mathbb{P}(z_i = j|\mathbf{z}_{-i},N,p)\propto \left\{ \begin{array}{ll}\frac{n_j^{-i} + 1}{n_j^{-i}} (N - n_j^{-i} + 1) & \text{if} j = 1,\ldots ,k^{-i},\\ (k^{-i} + 1)(1 - p)^{N + 1} / p & \text{if} j = k^{-i} + 1 \end{array} \right.$ +- (Zero-truncated binomial) $\mathbb{P}(z_i = j|\mathbf{z}_{-i},N,p)\propto \left\{ \begin{array}{ll}(N - n_j^{-i}) & \text{if} j = 1,\ldots ,k^{-i},\\ \bigl {(}k^{-i} + 1\bigr)\frac{N(1 - p)^N}{1 - (1 - p)^N} & \text{if} j = k^{-i} + 1 \end{array} \right.$ +- (Zero-truncated Poisson) $\mathbb{P}(z_i = j|\mathbf{z}_{-i},\lambda)\propto \left\{ \begin{array}{ll}1 & \text{if} j = 1,\ldots ,k^{-i},\\ \bigl {(}k^{-i} + 1\bigr)\frac{e^{-\lambda}}{1 - e^{-\lambda}} & \text{if} j = k^{-i} + 1 \end{array} \right.$ +- (Zero-truncated negative binomial) $\mathbb{P}(z_i = j|\mathbf{z}_{-i},r,p)\propto \left\{ \begin{array}{ll}n_j^{-i} + r & \text{if} j = 1,\ldots ,k^{-i},\\ \bigl {(}k^{-i} + 1\bigr)\frac{r(1 - p)^r}{1 - (1 - p)^r} & \text{if} j = k^{-i} + 1 \end{array} \right.$ +$\bullet$ (Logarithmic) $\mathbb{P}(z_i = j|\mathbf{z}_{-i},p)\propto \left\{ \begin{array}{ll}n_j^{-i} & \mathrm{if~}j = 1,\ldots ,k^{-i},\\ \bigl {(}k^{-i} + 1\bigr)\frac{-1}{\log(1 - p)} & \mathrm{if~}j = k^{-i} + 1 \end{array} \right.$ + +where $k^{-i}$ and $n_j^{-i}$ are the number and sizes of clusters in $\mathbf{z}_{-i}$ . Notice that in the last four examples, the reallocation probability to an existing cluster is a linear function of its size, and these are the only possible cases of $\mu$ that have such a property (Johnson et al., 2005). These are called Sundt and Jewell family (Sundt & Jewell, 1981) or (a,b,1) zero-truncated family (Klugman et al., 2012) in actuarial applications. + +2. Update $\theta_{\mu}|\Pi_n, x$ , for example using slice sampler (Neal, 2003), + +- (Shifted binomial) Here $\theta_{\mu} = (N,p)$ and let prior $\pi (N,p)\propto p^{-0.5}(1 - p)^{-0.5} / N$ following Berger et al. (2012). Then unlike the zero-truncated binomial, we can use the following joint distribution sampler: first update $N$ from $[N|\Pi_n,\pmb {x}]$ + +$$ +[ N | \Pi_ {n}, \boldsymbol {x} ] \propto \frac {\mathcal {B} (n - k + \frac {1}{2} , N k - n + k + \frac {1}{2})}{N} \prod_ {j = 1} ^ {k} \frac {n _ {j} N !}{(N - n _ {j} + 1) !}, \quad N = \max n _ {j} - 1, \max n _ {j}, \dots +$$ + +where $\mathcal{B}$ is a beta function. Given this $N$ , update $p|N, \Pi_n, \boldsymbol{x} \sim \mathrm{Beta}(n - k + \frac{1}{2}, Nk - n + k + \frac{1}{2})$ . + +- (Zero-truncated binomial with fixed $N$ ) Here $\theta_{\mu} = p$ and let prior $p \sim \mathrm{Beta}(a_p, b_p)$ . Then sample $p$ from + +$$ +[ p | \Pi_ {n}, \boldsymbol {x} ] \propto p ^ {a _ {p} - 1} (1 - p) ^ {b _ {p} - 1} \frac {p ^ {n} (1 - p) ^ {N k - n}}{(1 - (1 - p) ^ {N}) ^ {k}} \tag {18} +$$ + +- (Zero-truncated Poisson) Here $\theta_{\mu} = \lambda$ and let prior $\lambda \sim \mathrm{Gamma}(a_{\lambda}, b_{\lambda})$ . Then sample $\lambda$ from + +$$ +\left[ \lambda \mid \Pi_ {n}, \boldsymbol {x} \right] \propto \lambda^ {a _ {\lambda} - 1} \exp (- b _ {\lambda} \lambda) \lambda^ {n} \left(\frac {e ^ {- \lambda}}{1 - e ^ {- \lambda}}\right) ^ {k} \tag {19} +$$ + +- (Zero-truncated negative binomial) Here $\theta_{\mu} = (r,p)$ and let prior $(r,p)\sim \pi (r,p)$ . Then sample $(r,p)$ from + +$$ +[ r, p \mid \Pi_ {n}, \boldsymbol {x} ] \propto \pi (r, p) p ^ {n} \left(\frac {(1 - p) ^ {r}}{1 - (1 - p) ^ {r}}\right) ^ {k} \prod_ {j = 1} ^ {k} [ (n _ {j} + r - 1) \dots (r) ] \tag {20} +$$ + +- (Logarithmic) Here $\theta_{\mu} = p$ and let prior $p \sim \mathrm{Beta}(a_p, b_p)$ . Then sample $p$ from + +$$ +[ p | \Pi_ {n}, \boldsymbol {x} ] \propto p ^ {a _ {p} - 1} (1 - p) ^ {b _ {p} - 1} p ^ {n} \left(\frac {- 1}{\log (1 - p)}\right) ^ {k} \tag {21} +$$ + +The software for the described posterior inference algorithms will be available in R package microclustr (Steorts et al., 2020). + +# D. Details on Real and Synthetic Data Studies + +# D.1. SIPP1000 Data Analysis Details + +In this section, we provide more details on SIPP1000 data analysis described in 4.3. SIPP1000 dataset has $n = 4116$ records, and it contains 5 categorical fields (sex, birth year, birth month, race, and state of residence) of $K^{+} = 1000$ individuals. We fit ESC models with four different choices of $\mu$ : i) Binomial $^{+}$ with fixed number of trials $N = 5$ (balance-seeking), ii) Poisson $^{+}$ (balance-neutral), iii) NegativeBinomial $^{+}$ (balance-averse), and iv) Dirichlet (neither balance-seeking nor averse; Betancourt et al., 2020). We fix the number of trials as $N = 5$ in the binomial case since dataset is constructed from five waves of longitudinal study, so there is no cluster with size greater than 5 a priori. The hyperprior specifications are i) $p \sim \mathrm{Beta}(0.5, 0.5)$ for the binomial success probability, ii) $\lambda \sim \mathrm{Gamma}(1, 1)$ for Poisson $^{+}$ , iii) $(r, p) \sim \mathrm{Gamma}(1, 1) \times \mathrm{Beta}(2, 2)$ for NegBin $^{+}$ , and iv) $\alpha = 1$ , $\pmb{\mu}^{(0)}|_{r,p} = \mathrm{NegBin}^{+}(r,p)$ , and $(r,p) \sim \mathrm{Gamma}(1,1) \times \mathrm{Beta}(2,2)$ for Dirichlet (see Betancourt et al. (2020) for details). Prior for distortion parameters $(\beta_{\ell})$ are assumed to be independent beta distributions with mean 0.005 and standard deviation 0.01. + +We collect 15000 posterior samples after 5000 burn-in iterations, where we update cluster indicators $(z_{i})$ for each individual within each one (global) MCMC iteration. All computations were performed on an Intel E5-2690 v3 CPU with 128GB of + +![](images/75b3c475d2b73788e4b13f6c98a2acddbdba2bc6bccbf4a60b4e03bc7105f262.jpg) +Figure 6. SIPP1000 dataset; trace plots of the number of clusters (entities) $K^{+}$ where true is 1000. + +![](images/8013ed01313463084c8291541065edd0e8d810e8effd88cae575a348d537be08.jpg) + +![](images/e47ae1e5238c7e19d787a4d83f4921809539a96217a1bd8bc1359096ed518418.jpg) + +![](images/e3eb761c2771e4709dc2d519b904d9430d4d02c58b1979e96aa21784e4863bf7.jpg) + +![](images/9303c3a1fe80e556ada6de7207a4289f0e6c71724c3d79a01bb340b613fd5e36.jpg) +Figure 7. SIPP1000 dataset; trace plots of random partition model-specific parameters $\theta_{\mu}$ . + +![](images/7bf6ead5bb4c6133e3844cc13d3968edcc512f9bf284fc73a4ab745977d4b25e.jpg) + +![](images/1e101ca72bd3f73939da5a36417c0e806c8ca727221af53d560be162bfacea6f.jpg) + +![](images/8a6255ec76196e2cd08e2c59ac25d478bd6ad068d611cbca5da60fe28a06e5d0.jpg) + +memory. In Figure 6 and Figure 7, present trace plots for the number of entities $K^{+}$ as well as parameters $\theta_{\mu}$ , where four chains all become stationary after 5000 burn-in iterations. + +In addition to Table 3, we also report the summary of posterior distributions of distortion probabilities $(\beta_{\ell})$ of SIPP1000 dataset. The distortion probability of the month of birth, $\beta_{3}$ , is the highest for all models. Balance-seeking model $(\mathrm{Binom}^{+})$ provides higher estimated distortion probabilities compared to other models, even though the prior for $(\beta_{\ell})$ are all the same. This is because the balance-seeking model avoids the generation of singleton clusters and prefers to treat the difference as 'distorted entry'. This leads to the reduced false negative rate (FNR) by reducing the number of missed pairs (i.e. record pairs that are linked under the truth but not linked under the estimate), but at the cost of increased FDR. + +Table 5. SIPP1000 dataset; Summary of posterior distributions (mean, standard deviation) of distortion probabilities $(\beta_{l})$ for different $\mu$ . $\beta_{1}, \ldots, \beta_{5}$ correspond to distortion probabilities of sex, year of birth, month of birth, race, and state of residence, respectively. + +
μ (balance-)E(β1|x)SDE(β2|x)SDE(β3|x)SDE(β4|x)SDE(β5|x)SD
Binom+ (seeking)0.00120.00140.01510.00270.04920.00390.00740.00290.01400.0025
Poisson+ (neutral)0.00030.00050.00320.00180.04010.00350.00080.00120.00390.0019
NegBin+ (averse)0.00030.00060.00260.00190.03910.00360.00070.00100.00250.0019
Dirichlet (n/a)0.00020.00040.00020.00040.03770.00340.00160.00160.00090.0008
+ +# D.2. Simulation Studies + +We conduct additional simulations to study the effect of balancedness on entity resolution tasks. We consider three different scenarios of cluster size distribution: 1) binomial, 2) Poisson, and 3) negative binomial, where Table 6 shows the cluster size distributions for each scenario. We simulate data with the generating scheme described in Section 4.1, where $L = 5$ , $D_{\ell} = 10$ , $\theta_{\ell} = (0.1,\dots ,0.1)$ , and three different choices of distortion probabilities $\beta \in \{0.01,0.05,0.1\}$ . + +Table 6. The true number of clusters $m_{s} = \sum_{j}1(n_{j} = s)$ of each size $s = 1,\dots ,14$ for three different scenarios. Each entries correspond to 100 times the probability mass of the distribution shown in the first column, rounded to the nearest integer. + +
Scenariom1m2m3m4m5m6m7m8m9m10m11m12m13m14K
1. Binom+(10,0.5)1412212521124100000101
2. Poisson+(5)3814181815117421000101
3. NegBin+(5,0.5)812141413118653211199
+ +We fit the ESC model with four different $\mu$ : i) $1 + \mathrm{Binom}$ (shifted binomial), ii) $\mathrm{Poisson}^+$ , iii) $\mathrm{NegBin}^+$ , and iv) Dirichlet. We use shifted binomial instead of zero-truncated binomial, assuming the situation when the maximum size of clusters is not known a priori. For shifted binomial distribution, we put $p(N,p)\propto 1 / N\times p^{-0.5}(1 - p)^{-0.5}$ prior on $(N,p)$ following Berger et al. (2012), and other hyperparameter settings for other three models and MCMC specification details are same as the previous subsection in the SIPP1000 data analysis. Here distortion probabilities $(\beta_{\ell})$ are assumed to be unknown. + +Table 7. Simulation study results for three different scenarios and three different true distortion probabilities. Presented are the posterior mean and standard deviation of the number of clusters, and the point estimates of FNRs and FDRs in % by Dahl (2006)'s method. + +
βμ (balance-)Scenario 1 (true K+ = 101)Scenario 2 (true K+ = 101)Scenario 3 (true K+ = 99)
E(K+|x) (SD)FNRFDRE(K+|x) (SD)FNRFDRE(K+|x) (SD)FNRFDR
0.011 + Binom (seeking)100.8 (0.6)0.00.0100.6 (1.1)0.90.898.9 (1.3)0.60.1
Poisson+ (neutral)101.3 (0.7)0.40.5101.5 (1.1)1.10.6100.1 (1.1)0.60.1
NegBin+ (averse)101.6 (0.9)0.40.5102.2 (1.2)1.10.6101.3 (1.4)0.60.1
Dirichlet (n/a)101.7 (0.9)0.70.0102.1 (1.5)1.50.8103.6 (2.0)0.60.1
0.051 + Binom (seeking)99.7 (1.2)2.93.2100.0 (1.5)2.42.995.2 (1.5)3.03.5
Poisson+ (neutral)103.8 (2.1)4.22.4102.4 (2.0)2.92.696.4 (1.7)3.64.4
NegBin+ (averse)106.4 (2.2)6.73.6105.2 (2.4)3.22.699.4 (2.3)3.12.8
Dirichlet (n/a)102.1 (2.6)4.84.1103.6 (3.3)3.82.0100.6 (3.0)4.94.0
0.11 + Binom (seeking)105.2 (1.9)8.14.198.5 (2.2)7.09.494.0 (2.2)8.17.5
Poisson+ (neutral)111.1 (2.9)9.24.1102.9 (2.9)8.910.198.7 (3.0)7.38.1
NegBin+ (averse)115.6 (3.6)10.53.9109.5 (4.0)10.78.8109.1 (4.3)10.95.4
Dirichlet (n/a)109.9 (5.0)8.84.1113.9 (5.5)12.96.5112.0 (5.0)12.76.2
+ +Table 7 shows that the balance-seeking random partition model generally achieves a lower FNR compared to others, even under Scenarios 2 and 3 where the model is misspecified. Figure 8 shows the posterior distributions of $m_{i}$ , the number of clusters of size $i$ . It can be clearly seen that the balance-seeking model regularizes the generation of singleton clusters, suggesting its usefulness for ER tasks when a single record per individual is less likely to happen or when false negative control is more important. + +![](images/6f4acb38158629ff76418c7cd3e1e936f535cd96f727c93de363d6458211b05f.jpg) + +![](images/128f9d843e6e62d17774c7e0468f7ce488a87d1d26f659beb511360f68e78c0d.jpg) +(1) Binom + +![](images/85375f8158da7e6f778ccb59ea27172f29c62c22e1c02c62ce82b78dcf316fcc.jpg) +(2) Pois + +![](images/b131294c393cd9193358135c206f611a0efdc9317cc8a391e84b8dce225f9e81.jpg) +(3) NegBin + +![](images/f86cc0ff9b597594f8ef23f6d5d9b63cb9a1b373265b65ad6b653373a8236793.jpg) +(4) Dirichlet + +![](images/a50820213d0945e1e035d97c23fb9df294dae01c8e6c1f67e7b4b7bae7b4dc57.jpg) + +![](images/78e7a392892be7a2ea0e573c9e4c909fc1fd3b849e4aaac9237e1e0b3bb8c46d.jpg) + +![](images/d978cf4507542fddc130f339a743a33601fa9ac1ef49c9d148b3a997091b780b.jpg) +Figure 8. Posterior boxplots of the number of clusters of size $i$ for each models, $m_i$ . (Top) Scenario 1 with $\beta_{true} = 0.05$ . (Middle) Scenario 2 with $\beta_{true} = 0.05$ . (Bottom) Scenario 3 with $\beta_{true} = 0.05$ . True $m_i$ are shown as black diamonds and annotated by their values. \ No newline at end of file diff --git a/whytherichgetricheronthebalancednessofrandompartitionmodels/images.zip b/whytherichgetricheronthebalancednessofrandompartitionmodels/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..edd750ae4edf88268cbc81033a5f65ea49f48838 --- /dev/null +++ b/whytherichgetricheronthebalancednessofrandompartitionmodels/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0cb9faa154e6fcfc16864a25e15ed6df57a19be67516b07d2525d36098a98c2b +size 1067529 diff --git a/whytherichgetricheronthebalancednessofrandompartitionmodels/layout.json b/whytherichgetricheronthebalancednessofrandompartitionmodels/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..a5320840c54136c44e88a7ee789322ebe32e2eca --- /dev/null +++ b/whytherichgetricheronthebalancednessofrandompartitionmodels/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e229e84b53d7e06debd94bde2b072cfee60869e30170972ffd554463d2bdbafb +size 1240631 diff --git a/widebayesianneuralnetworkshaveasimpleweightposteriortheoryandacceleratedsampling/88a58cd2-b2eb-418e-9872-5ae8a1d73146_content_list.json b/widebayesianneuralnetworkshaveasimpleweightposteriortheoryandacceleratedsampling/88a58cd2-b2eb-418e-9872-5ae8a1d73146_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..e68bed0e54b98c3915872e6ca7348a85abebb7e1 --- /dev/null +++ b/widebayesianneuralnetworkshaveasimpleweightposteriortheoryandacceleratedsampling/88a58cd2-b2eb-418e-9872-5ae8a1d73146_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:168b1f2cb94467449d253b4383b4b610292918da70321c6adef439f3d6779f48 +size 169500 diff --git a/widebayesianneuralnetworkshaveasimpleweightposteriortheoryandacceleratedsampling/88a58cd2-b2eb-418e-9872-5ae8a1d73146_model.json b/widebayesianneuralnetworkshaveasimpleweightposteriortheoryandacceleratedsampling/88a58cd2-b2eb-418e-9872-5ae8a1d73146_model.json new file mode 100644 index 0000000000000000000000000000000000000000..620d3ef71bfc648c94db06715250ac219bdaaa70 --- /dev/null +++ b/widebayesianneuralnetworkshaveasimpleweightposteriortheoryandacceleratedsampling/88a58cd2-b2eb-418e-9872-5ae8a1d73146_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:120e13759685e59b85bd96fd1fd2bd953ccd9b675962464fb275ba1abab20271 +size 199258 diff --git a/widebayesianneuralnetworkshaveasimpleweightposteriortheoryandacceleratedsampling/88a58cd2-b2eb-418e-9872-5ae8a1d73146_origin.pdf b/widebayesianneuralnetworkshaveasimpleweightposteriortheoryandacceleratedsampling/88a58cd2-b2eb-418e-9872-5ae8a1d73146_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b07311e190e3dacbcfda331cb182d85f6c9556f0 --- /dev/null +++ b/widebayesianneuralnetworkshaveasimpleweightposteriortheoryandacceleratedsampling/88a58cd2-b2eb-418e-9872-5ae8a1d73146_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0144ee4e23ab987cd4a33f26edfc4777fa2a02b2fd1091fd5238adfa14179297 +size 1572004 diff --git a/widebayesianneuralnetworkshaveasimpleweightposteriortheoryandacceleratedsampling/full.md b/widebayesianneuralnetworkshaveasimpleweightposteriortheoryandacceleratedsampling/full.md new file mode 100644 index 0000000000000000000000000000000000000000..7225948c54f0fc2f402f898050d40aeef6a3d304 --- /dev/null +++ b/widebayesianneuralnetworkshaveasimpleweightposteriortheoryandacceleratedsampling/full.md @@ -0,0 +1,770 @@ +# Wide Bayesian neural networks have a simple weight posterior: theory and accelerated sampling + +Jiri Hron $^{1,2}$ Roman Novak $^{1}$ Jeffrey Pennington $^{1}$ Jascha Sohl-Dickstein $^{1}$ + +# Abstract + +We introduce repriorisation, a data-dependent reparameterisation which transforms a Bayesian neural network (BNN) posterior to a distribution whose KL divergence to the BNN prior vanishes as layer widths grow. The repriorisation map acts directly on parameters, and its analytic simplicity complements the known neural network Gaussian process (NNGP) behaviour of wide BNNs in function space. Exploiting the repriorisation, we develop a Markov chain Monte Carlo (MCMC) posterior sampling algorithm which mixes faster the wider the BNN. This contrasts with the typically poor performance of MCMC in high dimensions. We observe up to $50\mathrm{x}$ higher effective sample size relative to no reparametrisation for both fully-connected and residual networks. Improvements are achieved at all widths, with the margin between reparametrised and standard BNNs growing with layer width. + +# 1. Introduction + +Bayesian neural networks (BNNs) have achieved significantly less success than their deterministic NN counterparts. Despite recent progress (e.g., Khan et al., 2018; Maddox et al., 2019; Osawa et al., 2019; Dusenberry et al., 2020; Daxberger et al., 2021; Izmailov et al., 2021), (a) our theoretical understanding of BNNs remains limited, and (b) practical applicability is hindered by high computational demands. We make progress on both these fronts. + +Our work revolves around a reparametrisation $\theta = T(\phi)$ of the (flattened) NN weights $\theta \in \mathbb{R}^d$ . Its form comes from a theorem in which we establish that the Kullback-Leibler (KL) divergence between the standard normal distribution $\mathcal{N}(0, I_d)$ and the reparametrised posterior $p(\phi | \mathcal{D}) =$ + +1Google Research, USA 2University of Cambridge, UK. Correspondence to: Jiri Hron . + +Proceedings of the $39^{th}$ International Conference on Machine Learning, Baltimore, Maryland, USA, PMLR 162, 2022. Copyright 2022 by the author(s). + +$p(T(\phi) \mid \mathcal{D}) \left| \det \partial_{\phi} T(\phi) \right|$ converges to zero as the BNN layers grow wide. This closes a gap in the theory of overparametrised NNs by providing a rigorous characterisation of the BNN parameter space behaviour (Figure 1 and Section 2), and enables faster posterior sampling (Section 3). + +In function space, wide BNN priors converge (weakly) to a so-called neural network Gaussian process (NNGP) limit (Matthews et al., 2018; Lee et al., 2018; Garriga-Alonso et al., 2019; Novak et al., 2019; Yang, 2019; Hron et al., 2020b), and the posteriors converge (weakly) to that of the corresponding NNGP (assuming the likelihood is a bounded continuous function of the NN outputs; Hron et al., 2020a). Parameter space behaviour is less understood (Hron et al., 2020a). The main exception is the work of Matthews et al. (2017) who showed that randomly initialising a NN, and then optimising only the last layer with respect to a mean squared error loss, is equivalent to drawing a sample from the conditional last layer posterior. This result holds for a Gaussian likelihood and zero observation noise. Our reparametrisation $T$ can be seen as a non-zero noise generalisation of the underlying map from the initial to the optimised weights, and provides samples from the joint posterior over all layers in the infinite width limit (Theorem 2.1). + +Since sampling from the 'KL-limit' $\mathcal{N}(0,I)$ is trivial relative to the notoriously complex BNN posterior, our theory motivates applying Markov chain Monte Carlo (MCMC) to the reparametrised density. To apply MCMC, two concerns must be addressed: (i) understanding if the KL-closeness to $\mathcal{N}(0,I_d)$ actually simplifies sampling, and (ii) computational efficiency. In Section 3.1, we partially answer (i) by proving that the gradient $\nabla_{\phi}\log p(\phi |\mathcal{D})$ concentrates around the log density gradient of $\mathcal{N}(0,I)$ in wide BNNs. For (ii), we propose a simple-to-implement and efficient way of computing both $T(\phi)$ and the corresponding density at the same time using Cholesky decomposition (Section 3.2). + +Applying Langevin Monte Carlo (LMC), we empirically demonstrate up to $50\mathrm{x}$ improved mixing speed, as measured by effective sample size (ESS). The phenomenon occurs both for residual and fully-connected networks (FCNs), and + +
parameter spacefunction space
Bayesian inferenceRepriorisation: posterior → prior +Equation (3), Theorem 2.1 (this paper) +φℓ := {Σ-1/2(θℓ - μ) ℓ = L + 1, θℓ otherwise. +KL(N(0,Id) || Pφ|D) → 0 as dmin → ∞Neural Network Gaussian Process (NNGP) +(Matthews et al., 2018; Lee et al., 2018; Hron et al., 2020a) +θ ~ Pθ dmin fθ ~ GP(0,k) +θ ~ Pθ|D dmin fθ ~ GP(mk;D,Sk;D)
gradient descent trainingLinearisation +(Lee et al., 2019; Chizat et al., 2019) +∂tθt = -η∇θtL(y, fθt(X)) +ft(x) = f0(x) + ∂f0(x)/∂θ0(θt - θ0) + O(dmin-1/2)Neural Tangent Kernel (NTK) +(Jacot et al., 2018; Allen-Zhu et al., 2019; Du et al., 2019) +∂tft(x) = -ηˆθx,X∇ft(x)L(y, ft(X)) +ft | D ~ GP(mt;D,St;D) as dmin → ∞
+ +Figure 1. As neural networks are made wide, their behaviour often becomes simple. Past results examine wide NNs in either function space or parameter space, and either under gradient descent training or Bayesian inference. The central result for each condition is stated, using this paper's formalism where applicable. The behaviour of wide Bayesian NNs in parameter space is largely unexplored. We address this gap, by reparametrising the weight posterior so that its KL divergence from the prior $\mathcal{N}(0, I_d)$ vanishes with increasing width. + +for a variety of dataset sizes and hyperparameter configurations. The improvement over no reparametrisation increases with layer width, but is observed even far from the NNGP regime. For example, we find a 10x improvement on CIFar-10 for a 3-hidden layer FCN with 1024 units per layer. However, for ResNet-20, a 10x improvement occurs only when the top-layer width $d^{L}$ is similar to or larger than the number of observations, illustrating that gains are possible but not guaranteed outside of the NNGP regime. + +# 1.1. Assumptions and notation + +A BNN models a mapping from inputs $x \in \mathcal{X}$ to outputs $y \in \mathcal{Y}$ using a parametric function $f \coloneqq f_{\theta}$ . An example is an $L$ -hidden layer fully-connected network $f_{\theta} = f^{L + 1}$ with + +$$ +f ^ {\ell} (x) = \frac {\sigma_ {W} ^ {\ell}}{\sqrt {d ^ {\ell - 1}}} h ^ {\ell - 1} (x) W ^ {\ell}, \quad h ^ {\ell} (x) = \psi (f ^ {\ell} (x)), \quad (1) +$$ + +with $\psi$ the nonlinearity, $h^0 (x)\coloneqq x$ , and $W^{\ell}\in \mathbb{R}^{d^{\ell -1}\times d^{\ell}}$ (bias terms are wrapped into $W^{\ell}$ by adding a constant entry dimension to $h^{\ell -1}(x)$ ). $\theta^\ell$ will denote the flattened $\ell^{\mathrm{th}}$ layer parameters, and $\theta \coloneqq [\theta^{\ell}]_{\ell = 1}^{L + 1}\in \mathbb{R}^{d}$ their concatenation. Later on, the vector of readout weights $\theta^{L + 1}$ will be of special importance, as will the minimum hidden layer width $d_{\mathrm{min}}\coloneqq \min_{1\leq \ell \leq L}d^{\ell}$ . While we will study how the behaviour of $f$ and $\theta$ changes with layer width, we suppress this dependence in our notation to reduce clutter. + +The factor $\sigma_W^\ell /\sqrt{d^{\ell - 1}}$ in Equation (1) is more commonly part of the weight prior. We use this so-called 'NTK parametrisation' as it allows taking $\mathcal{N}(0,I)$ as the prior regardless of the network width, which simplifies our notation without chan + +ging the implied function space distribution. Our claims hold under the standard parametrisation as well, by making multiplication by $\sigma_W^\ell /\sqrt{d^{\ell - 1}}$ a part of the reparametrisation. + +We assume the final readout layer is linear, and that the likelihood is Gaussian $p(y \mid X, \theta) \propto \exp \left\{-\frac{1}{2\sigma^2} \sum_{i=1}^{n} (y_i - f_\theta(x_i))^2 \right\}$ with observation variance $\sigma^2 > 0$ . In contrast, the rest of the network need not be an FCN, but can contain any layers for which NNGP behaviour is known, including convolutional and multi-head attention layers, and skip connections (see, e.g., Yang, 2020, for an overview). + +# 2. Repriorisation: posterior $\rightarrow$ prior + +# 2.1. Repriorisation of linear models + +To begin, we consider a Bayesian linear model $y|\theta ,x\sim \mathcal{N}(x^{\top}\theta ,\sigma^{2})$ . For a standard normal prior $\theta \sim \mathcal{N}(0,I_d)$ , the Bayesian posterior after observing $n$ points, $\mathcal{D}:= (X,y)\in$ $\mathbb{R}^{n\times d}\times \mathbb{R}^n$ , is a Gaussian $\theta |\mathcal{D}\sim \mathcal{N}(\mu ,\Sigma)$ with + +$$ +\Sigma = \left(I _ {d} + \sigma^ {- 2} X ^ {\top} X\right) ^ {- 1}, \text {a n d} \mu = \sigma^ {- 2} \Sigma X ^ {\top} y. \tag {2} +$$ + +We can thus transform a posterior into a prior sample using the data-dependent reparameterisation $\phi = T^{-1}(\theta) = \Sigma^{-1/2}(\theta - \mu) \sim \mathcal{N}(0, I_d)$ as illustrated in Figure 2. + +# 2.2. Repriorisation of Bayesian neural networks + +A similar insight applies to BNNs with the assumed Gaussian prior and likelihood. Specifically, the posterior of readout (top-layer) weights conditioned on the other parameters is $\theta^{L + 1}|\theta^{\leq L},\mathcal{D}\sim \mathcal{N}(\mu ,\Sigma)$ with $\mu$ and $\Sigma$ as in + +![](images/b673c2ff2449e40e87aada5233fb618a3ecb902b9b8ffb4809f3fa1dadd8a95d.jpg) +Figure 2. Reparametrisation of Bayesian linear regression maps the posterior to the prior. Left: Shows the parameter $\theta$ prior, and the posterior for a single datapoint $X = [0.9, 0.5]$ , $y = [2]$ , with $\sigma^2 = 0.1$ . Right: After a data-dependent affine reparameterisation, described in Section 2.1, the posterior becomes identical to the prior in terms of new parameters $\phi$ . MCMC sampling from the parameter posterior is easier in $\phi$ than in $\theta$ . A similar reparameterisation can be applied to deep BNNs. + +Equation (2), except $X$ is replaced by the scaled top-layer embeddings $\Psi := \sigma_W^{L+1} h^L(X) / \sqrt{d^L} \in \mathbb{R}^{n \times d^L}$ . Our reparametrisation $\phi = T^{-1}(\theta)$ can thus be defined analogously: + +$$ +\phi^ {\ell} = \left\{ \begin{array}{l l} \Sigma^ {- 1 / 2} \left(\theta^ {\ell} - \mu\right) & \quad \ell = L + 1, \\ \theta^ {\ell} & \quad \text {o t h e r w i s e .} \end{array} \right. \tag {3} +$$ + +This ensures $\phi^{L + 1}\mid \phi^{\leq L},\mathcal{D}\sim \mathcal{N}(0,I_{d^L})$ for any fixed value of $\phi^{\leq L} = \theta^{\leq L}$ . We omit the dependence of $\mu, \Sigma$ on the dataset $\mathcal{D}$ and the pre-readout parameters $\theta^{\leq L}$ to reduce clutter, but emphasise that $T$ depends on both. + +Since $T$ is a differentiable bijection, the full reparametrised density is $p(\phi \mid \mathcal{D}) = p(\theta \mid \mathcal{D})\left|\operatorname*{det}\partial_{\phi}\theta \right|$ where + +$$ +\det (\partial_ {\phi} \theta) = \det \left( \begin{array}{c c} \Sigma^ {1 / 2} & \frac {\partial \theta^ {L + 1}}{\partial \phi^ {\le L}} \\ 0 & I _ {(d - d ^ {L})} \end{array} \right) = \sqrt {\det (\Sigma)}. (4) +$$ + +# 2.3. Interpreting the reparametrised distribution + +To better understand the reparametrisation, note $p(\phi \mid \mathcal{D}) = p(\phi^{L + 1} \mid \phi^{\leq L}, \mathcal{D}) p(\phi^{\leq L} \mid \mathcal{D})$ where we already know the first term is equivalent to $\mathcal{N}(0, I_{d^L})$ . Since $\phi^{\leq L} = \theta^{\leq L}$ , the latter term is equal to the marginal posterior over $\theta^{\leq L}$ + +$$ +\begin{array}{l} p \left(\phi^ {\leq L} \mid \mathcal {D}\right) \propto p \left(\theta^ {\leq L}\right) \mathbb {E} _ {\theta^ {L + 1} \sim \mathcal {N} \left(0, I _ {d ^ {L}}\right)} \left[ p (y \mid \theta , X) \right] \\ \stackrel {\text {(i)}} {\propto} p \left(\theta^ {\leq L}\right) \sqrt {\det \Sigma} \exp \left\{\frac {1}{2} y ^ {\top} \left(\sigma^ {2} I _ {n} + \Psi \Psi^ {\top}\right) ^ {- 1} y \right\} \tag {5} \\ \end{array} +$$ + +where (i) comes from completing the square $\| \theta^{L + 1} - \mu \|_{\Sigma^{-1}}^2$ $(\| v\| _A^2\coloneqq v^\top Av)$ , and applying the Woodbury identity. + +Using the Weinstein-Aronszajn identity + +$$ +\det (\Sigma) = \det \left(I _ {d ^ {L}} + \sigma^ {- 2} \Psi^ {\top} \Psi\right) \propto \det \left(\sigma^ {2} I _ {n} + \Psi \Psi^ {\top}\right), +$$ + +the readers familiar with the GP literature may recognise $p(\phi^{\leq L}|\mathcal{D})$ as $p(\theta^{\leq L})$ weighted by the marginal likelihood of a centred GP with the empirical NNGP kernel + +![](images/5b48529fd55265378a7ddcc096ca64371d04d24caa3f4a0cc64569bae2c680d9.jpg) +Figure 3. The functions parametrised by $T(\phi)$ , $\phi \sim \mathcal{N}(0, I)$ , converge to the true posterior. The distribution over functions $f_{T(\phi)}$ is shown for a 3-hidden layer FCN with 1D inputs and outputs, and 3 datapoints (dark circles). As layer width increases (legend), the BNN posterior converges to the NNGP posterior (Hron et al., 2020a), and so does $f_{T(\phi)}$ (our Proposition 2.2). + +$\hat{K}_{\sigma^2} \coloneqq \sigma^2 I_n + \Psi \Psi^\top$ (Rasmussen & Williams, 2005). The marginal likelihood is often used for optimisation of kernel hyperparameters. Here the role of the 'hyperparameters' is played by $\theta^{\leq L}$ , i.e., all but the readout weights. + +This relation to the empirical NNGP kernel is crucial in the next section where we exploit the known convergence of $\hat{K}_{\sigma^2}$ to a constant independent of $\theta^{\leq L}$ in wide BNNs, to prove that the reparametrised posterior converges to the prior distribution at large width. Figure 4 provides an informal argument motivating that same convergence, using the language of probabilistic graphical models (PGMs). + +# 2.4. Asymptotic normality under reparametrisation + +Our reparametrisation guarantees normality of the reparametrised posterior over $\phi^{L + 1}$ for any width. Equation (5) suggests $\phi^{\leq L}$ may exhibit Gaussian behaviour as well in wide BNNs, since—outside of $p(\theta^{\leq L})$ —its posterior depends on $\phi^{\leq L} = \theta^{\leq L}$ only through the empirical NNGP kernel which is known to converge a constant $K\in \mathbb{R}^{n\times n}$ as the layer width grows (see Yang, 2020, for an overview). + +This is crucial in establishing our first major result: convergence of the KL divergence between the $\mathcal{N}(0, I_d)$ prior and the reparametrised posterior to zero as the number of hidden units in each layer goes to infinity. + +Theorem 2.1. Let $P_{\phi \mid \mathcal{D}}$ be the reparametrised posterior distribution defined by the density $p(\phi \mid \mathcal{D})$ . Assume the Gaussian prior and likelihood with $\sigma > 0$ , and that $\hat{K} \xrightarrow{\mathbb{P}} K$ and $\mathbb{E}[\hat{K}] \to K$ under the prior as $d_{\min} \to \infty$ . + +Then $\mathrm{KL}(\mathcal{N}(0,I_d)\parallel P_{\phi \mid \mathcal{D}})\to 0$ as $d_{\mathrm{min}}\to \infty$ + +The assumptions $(\hat{K} \xrightarrow{\mathbb{P}} K, \mathbb{E}[\hat{K}] \to K$ , as $d_{\min} \to \infty)$ hold for most common architectures, including FCNs, CNNs, and attention networks (Matthews et al., 2018; Garriga-Alonso et al., 2019; Hron et al., 2020b; Yang, 2020). + +![](images/67bbd059a067e30c6e80c3c2aeaf87f5940d2cc6ebb7c4a72681a82f3b2222f2.jpg) +Figure 4. Sketch motivating convergence of the reparametrised posterior to the prior. (a) A probabilistic graphical model (PGM) describing the BNN after reparameterisation. Shaded circles correspond to observed variables. Dashed outlines indicate that the variable value is a deterministic function of its ancestors. The reparametrised posterior factorises as $p(\phi \mid \mathcal{D}) = p(\phi^{L + 1} \mid \phi^{\leq L}, \mathcal{D})$ . (b) Our reparametrisation in Equation (3) makes $\phi^{L + 1} \mid \phi^{\leq L}, \mathcal{D} \sim \mathcal{N}(0, I)$ for any $\phi^{\leq L}$ . The marginal $p(\phi^{\leq L} \mid \mathcal{D}) = \int p(\phi \mid \mathcal{D}) d\phi^{L + 1}$ can be evaluated analytically with a Gaussian likelihood (Equation (5)). (c) $p(\phi^{\leq L} \mid \mathcal{D})$ depends on the data only via the (empirical) NNGP kernel $\hat{K}^L = h^L(X)h^L(X)^\top / d^L$ . This is due to the assumed linearity of the top layer, the Gaussian prior, and the identity $A\varepsilon \sim \mathcal{N}(0, AA^\top)$ for $\varepsilon \sim \mathcal{N}(0, I)$ and any fixed matrix $A$ . (d) As layer width $d_{\mathrm{min}}$ goes to infinity, $\hat{K}^L$ converges to a constant independent of $\phi^{\leq L}$ (Section 2.4). Hence $p(\phi^{\leq L} \mid \mathcal{D}) \approx p(\phi^{\leq L}) = \mathcal{N}(0, I)$ by the PGM. Since both $\phi^{L + 1}$ and $\phi^{\leq L}$ are approximately Gaussian, and $\phi^{L + 1}$ is independent of $\phi^{\leq L}$ , the joint posterior is also approximately Gaussian $p(\phi \mid \mathcal{D}) = p(\phi^{L + 1} \mid \phi^{\leq L}, \mathcal{D})p(\phi^{\leq L} \mid \mathcal{D}) \approx \mathcal{N}(0, I)$ . + +The fact that KL divergence does not increase under measurable transformations (e.g., Gray, 2011, corollary 5.2.2), combined with Theorem 2.1, implies that the KL divergence between the distribution of $T(\phi)$ with $\phi \sim \mathcal{N}(0, I_d)$ and the posterior $P_{\theta|D}$ also converges to zero. This provides a simple way of approximating wide BNN posteriors as illustrated by Figure 3. We use the same argument to establish convergence in function space by showing measurability of the $\theta \mapsto f_\theta$ mapping w.r.t. a suitable $\sigma$ -algebra. + +Proposition 2.2. Let $\phi \sim \mathcal{N}(0, I_d)$ , $\theta \sim P_{\theta|D}$ , and denote the functions they parametrisse by $f_{T(\phi)}$ and $f_{\theta}$ . Assume all nonlinearities are continuous, and each layer's outputs are jointly continuous in the layer parameters and inputs. + +Then $\mathrm{KL}(P_{f_{T(\phi)}}\| P_{f_{\theta}|\mathcal{D}})\to 0$ as $d_{\min}\rightarrow \infty$ , where the KL is defined w.r.t. the usual product $\sigma$ -algebra on $\mathbb{R}^{\mathcal{X}}$ . + +Hron et al. (2020a) showed that for continuous bounded likelihoods, $P_{f_{\theta}|\mathcal{D}}$ converges (weakly) to the NNGP posterior whenever $P_{f_{\theta}}$ with $\theta \sim P_{\theta}$ converges to the NNGP prior. This implies that the $P_{f_{T(\phi)}}$ from Proposition 2.2 converges (weakly) to the NNGP posterior whenever $P_{f_{\theta}|\mathcal{D}}$ does: by Pinsker's inequality, we have convergence in total variation which implies convergence of expectations of all bounded measurable (incl. bounded continuous) functions. + +Our Theorem 2.1 may moreover be seen as an appealing answer to the issue of finding a useful notion of 'convergence' in parameter space of an increasing dimension from (Hron et al., 2020a, section 4). As the authors themselves point out, their approach of embedding the weights $\theta$ in $\mathbb{R}^{\mathbb{N}}$ , and studying weak convergence w.r.t. its usual product + +$\sigma$ -algebra, 'tells us little about behaviour of finite BNNs'. This is most clearly visible in their proposition 2, which establishes asymptotic reversion of the parameter space posterior to the prior (without any reparametrisation), which we know does not induce the correct function space limit. + +We note that our Theorem 2.1 does not contradict the Hron et al.'s result exactly because their definition of convergence essentially only captures the marginal behaviour of finite weight subsets, whereas our KL divergence approach characterises the joint behaviour of all the weights. Indeed, our next proposition shows that reversion to the prior does not occur under our stronger notion of convergence. + +Proposition 2.3. Under the assumptions of Theorem 2.1 + +$$ +\begin{array}{l} \operatorname {K L} \left(\mathcal {N} \left(0, I _ {d}\right) \| P _ {\theta | \mathcal {D}}\right) \\ \rightarrow \frac {1}{2} [ \sigma^ {- 2} \mathrm {T r} (K) + \| y \| _ {\sigma^ {- 2} I _ {n} - K _ {\sigma^ {2}} ^ {- 1}} ^ {2} - \log \det (\sigma^ {- 2} K _ {\sigma^ {2}}) ], \\ \end{array} +$$ + +as $d_{\mathrm{min}} \to \infty$ . The limit is equal to the KL divergence between the NNGP prior and posterior in function space, defined w.r.t. the usual product $\sigma$ -algebra on $\mathbb{R}^{\mathcal{X}}$ . + +# 3. Faster mixing via repriorisation + +We now have a reparametrisation which provably makes the reparametrised posterior close to the standard normal prior $\mathcal{N}(0, I_d)$ . Since sampling from the BNN posterior is notoriously difficult, the closeness to $\mathcal{N}(0, I_d)$ suggests sampling from $P_{\phi|D}$ may be significantly easier. + +However closeness in KL divergence does not guarantee that the gradients of $p(\phi \mid \mathcal{D})$ are as well behaved as those of the + +![](images/0f9be3dcc0b090d651240b155c9b333896cf172b1fe5dab22a386bff407705a9.jpg) +Figure 5. The posterior energy landscape is smoother after reprisorisation. Plots show 2D slices of the log posterior on CIFAR-10 in terms of the original parameters $\theta$ (top row) and the reparametrised $\phi = T^{-1}(\theta)$ (bottom row), for a 1-hidden layer FCN. The 2D slices are obtained by spherical linear interpolation between three parameter values found by gradient descent training on CIFAR-10 after random initialisation; norms may differ, and are therefore interpolated linearly. Left: Columns represent varying hidden layer width. The number of observations is fixed at $n = 128$ . The vanishing structure of the reparametrised posterior as width increases, making mixing between the normally separated modes easier. Right: Columns represent varying dataset size, width is fixed at $d^{1} = 128$ . As the number of datapoints becomes large compared to $d^{1}$ , the reparametrised posterior gradually grows less smooth. + +![](images/910f71010961a8651fe22689bf5e8c34d440bd7e87a7bee12a66205358992afa.jpg) + +standard normal distribution, which is crucial for gradient-guided methods like Langevin Monte Carlo (LMC). In Section 3.1, we provide partial reassurance by proving that the $\ell^2$ -norm of the differences between the two gradients vanishes in probability as the layers grow wide. Section 3.2 then provides a simple-to-implement way of computing both the reparametrised $\theta = T(\phi)$ and the corresponding density $p(\phi \mid \mathcal{D})$ at a fraction of cost of the naive implementation. + +# 3.1. Convergence of density gradients + +Our second major result proves that the posterior mass of the region where $\nabla_{\phi}\log p(\phi |\mathcal{D})$ significantly differs from the gradient of the $\mathcal{N}(0,I)$ density vanishes in wide BNNs. + +Proposition 3.1. Let $\Delta_{\phi} \coloneqq -\phi - \nabla_{\phi} \log p(\phi \mid \mathcal{D})$ where $-\phi$ is the gradient of the log density of $\mathcal{N}(0, I)$ . Assume the conditions in Theorem 2.1, and continuous nonlinearities. + +Then $P_{\phi \mid \mathcal{D}}(\| \Delta_{\phi}\| _2 > \epsilon)\to 0$ as $d_{\mathrm{min}}\rightarrow \infty$ $\forall \epsilon >0$ + +Two more technical assumptions are in Appendix A.4. Albeit useful, Proposition 3.1 does not ensure gradient-guided samplers like LMC will not dawdle in regions with ill-behaved gradients. This behaviour did not occur in our experiments, but the caveat is worth remembering. + +To provide a rough quantitative intuition for the scale of the speed up, we show our reparametrisation enables $\sqrt{n} / \sigma$ -times higher LMC stepsize relative to no reparametrisation in linear models, without any drop in the integrator accuracy (see Appendix D). + +# 3.2. Practical implementation + +To apply LMC, we need an efficient way of computing both $\theta = T(\phi)$ and the corresponding gradient of $\log p(\phi \mid \mathcal{D})$ . Since our largest experiments require millions of steps, the naive approach of computing each of $\mu$ , $\Sigma^{1/2}$ , and $\operatorname*{det}(\Sigma^{1/2})$ separately—see Equations (3) and (4)—for the cost of three $\mathcal{O}[(d^L)^3]$ operations is worth improving upon. We propose a three-times more efficient alternative. + +The trick is to first compute the Cholesky decomposition $U^{\top}U = \sigma^{2}I_{d^{L}} + \Psi^{\top}\Psi$ , and then reuse $U$ in computation of all three terms. This can be done by observing $\Sigma = \sigma^{2}U^{-1}(U^{-1})^{\top}$ , which implies $\mathbb{V}[\sigma U^{-1}\varepsilon] = \Sigma$ for $\varepsilon \sim \mathcal{N}(0,I)$ . We can thus use the alternative reparametrisation + +$$ +\theta^ {L + 1} = U ^ {- 1} \left[ \left(U ^ {\top}\right) ^ {- 1} \Psi^ {\top} y + \sigma \phi^ {L + 1} \right], +$$ + +which uses the fact $\mu = (\sigma^2 I + \Psi^\top \Psi)^{-1}\Psi^\top y$ together with the above definition of $U$ . The determinant can then be computed essentially for free since + +$$ +\det (\partial_ {\phi} \theta) \stackrel {{\text {(i)}}} {=} \det (\sigma U ^ {- 1}) \stackrel {{\text {(i i)}}} {=} \frac {\sigma^ {d ^ {L}}}{\det (U)} \stackrel {{\text {(i i i)}}} {=} \frac {\sigma^ {d ^ {L}}}{\prod_ {i} U _ {i i}}, +$$ + +where (i) is as in Equation (4), (ii) uses standard determinant identities, and (iii) exploits that $U$ is triangular. + +Because $U$ is upper-triangular, $U^{-1}v$ (resp. $(U^{\top})^{-1}v$ ) can be efficiently computed by back (resp. forward) substitution for any $v$ (Voevodin & Kuznetsov, 1984). The sequential application of forward and backward substitution is known as the Cholesky solver algorithm (Cholesky, 1924). Since + +we would need to apply the Cholesky solver to compute $\mu = (\sigma^2 I + \Psi^\top \Psi)^{-1}\Psi^\top y$ anyway, we obtain both the reparametrisation the density at essentially the same cost. + +Figure 6 demonstrates our approach introduces little wall-time clock overhead on modern accelerators relative to no reparametrisation when combined with LMC. Since the per-step computational overhead is never larger than $1.5\mathrm{x}$ in Figure 6 and we observe $\geq 10\mathrm{x}$ faster mixing in Section 4, the cost is more than offset by the sampling speed up. + +The above ('feature-space') reparametrisation scales as $\mathcal{O}[(d^L)^3]$ in computation and $\mathcal{O}[(d^L)^2]$ in memory. This is typically much better than exact (NN)GP inference which scales as $\mathcal{O}(n^3)$ in computation and $\mathcal{O}(n^2)$ in memory. To enable future study of very wide BNNs ( $d^L \gg n$ ), we provide an alternative 'data-space' formulation with $\mathcal{O}(n^3)$ computation and $\mathcal{O}(n^2)$ memory scaling in Appendix B. + +# INTERPOLATING BETWEEN PARAMETRISATIONS + +We can swap the likelihood variance $\sigma^2$ for a general regulariser $\lambda > 0$ in the definition of $U^\top U \coloneqq \lambda I_{d^L} + \Psi^\top \Psi$ . Clearly, $T \to \mathrm{Id}$ (identity mapping) as $\lambda \to \infty$ . This allows interpolation between our proposed reparametrisation at $\lambda = \sigma^2$ , and the standard parametrisation at $\lambda = \infty$ , which may be useful when far from the NNGP regime. Proper tuning of the hyperparameter $\lambda$ thus ensures the algorithm never performs worse than under the standard parametrisation. + +# 4. Experiments + +Armed with theoretical understanding and an efficient implementation, we now demonstrate that our reparametrisation can dramatically improve BNN posterior sampling, as quantified by per-step effective sample size (ESS; Ripley, 1989), and the $\hat{R}$ statistics (Gelman & Rubin, 1992), over a range of architectural choices and dataset sizes. + +# 4.1. Setup + +# 4.1.1. $\hat{R}$ DIAGNOSTIC + +$\hat{R}$ is a standard tool for testing non-convergence of MCMC samplers. It takes $M$ collections of samples $\{z_{mi}\}_{i = 1}^{S}\subset \mathbb{R}$ produced by independent chains, and computes + +$$ +\hat {R} ^ {2} = \frac {\hat {\mathbb {E}} \left[ \hat {\mathbb {V}} \left(z _ {m i} \mid m\right) \right] + \hat {\mathbb {V}} \left[ \hat {\mathbb {E}} \left(z _ {m i} \mid m\right) \right]}{\hat {\mathbb {E}} \left[ \hat {\mathbb {V}} \left(z _ {m i} \mid m\right) \right]}, \tag {6} +$$ + +where $\hat{\mathbb{E}}$ and $\hat{\mathbb{V}}$ compute expectation and variance w.r.t. the empirical distribution which assigns a $\frac{1}{MS}$ weight to each $z_{mi}$ (conditioning on $m$ yields within-chain statistics). The numerator is just $\hat{\mathbb{V}}(z_{mi})$ by the law of total variance, where $\hat{\mathbb{V}}[\hat{\mathbb{E}}(z_{mi} | m)]$ vanishes when all chains sample from the same distribution. Values significantly larger than one thus indicate non-convergence. We follow Izmailov et al. (2021) + +![](images/969ffff2bc74c8653695d1ff41ef038723cbd8b9a4d90bfd260f5c4ecb600cb8.jpg) +Figure 6. Sampling with repriorisation is comparable to the baseline in wall-clock time. While our reparametrisation cost is cubic in top layer width $d^{L}$ (Section 3.2), it is notable only for very large FCNs (left), and even larger CNNs (right) where the quadratic cost of the forward pass dominates due to a large multiplicative constant. See Appendix B for an alternative formulation which scales only quadratically with $d^{L}$ but cubically with $n$ . + +![](images/97128efe48c1191da3267fad4c642232436102299ce8d5029d381665cd58837d.jpg) + +in reporting $\hat{R}^2$ (denoted by $\hat{R}$ in their paper), instead of the square root of the above quantity. For multi-dimensional random variables, we estimate $\hat{R}^2$ for each dimension, and report the resulting distribution over dimensions. + +# 4.1.2.EFFECTIVE SAMPLE SIZE + +ESS is a measure of sampling speed. It estimates lag $k$ autocorrelations $\hat{\rho}_k \coloneqq \hat{\mathbb{C}}(z_{mi}, z_{m(i+k)}) / \hat{\mathbb{V}}(z_{mi})$ for $k = 1, \ldots, S-1$ ( $\hat{\mathbb{C}}$ is the empirical covariance), and computes + +$$ +\widehat {\mathrm {E S S}} := \frac {S}{1 + 2 \sum_ {k = 1} ^ {S - 1} \left(1 - \frac {k}{S}\right) \hat {\rho} _ {k}}, \tag {7} +$$ + +The per-step ESS is then $\widehat{\mathrm{ESS}} / s$ . Since $\hat{\rho}_k$ estimates for high $k$ are based on only $M(S - k)$ samples, we denoise by stopping the sum in Equation (7) at the first $\hat{\rho}_k < 0$ , which is the default in Tensorflow Probability's effective_sample_size (Dillon et al., 2017). + +Equation (7) is based on the $\mathbb{V}(\bar{z}_S) = \mathbb{V}(z_1) / S$ identity for (population) variance of the empirical mean $\bar{z}_S$ of $S$ i.i.d. variables $z_{i}$ Since MCMC chains produce dependent samples, $\widehat{\mathrm{ESS}}$ estimates the number which would satisfy the above equality when substituted for $S$ under the assumption of stationarity. Because we need to estimate ESS in the very high-dimensional parameter space, we randomly choose 100 one-dimensional subspaces, project the samples, estimate ESS in each of them, and report their distribution. + +# 4.1.3. DATA AND HYPERPARAMETERS + +The underdamped LMC sampler (Rossky et al., 1978) and cifar-10 dataset (Krizhevsky et al., 2009) are used in all experiments. We use regression on one-hot encoding of the labels shifted by $-\frac{1}{10}$ so that the label mean of each example is zero, matching the BNN prior (extension to multi-dimensional outputs described in Appendix C). Gaussian likelihood with $\sigma = 0.1$ is used throughout, which we selected to ensure that (a) positive and negative labels are separated by at least $4\sigma$ , but (b) $\sigma$ is not too small to give + +![](images/4b5887f76f7ae5274fcec25689a91e6ebe3308824b0b2b16765c75c96f7c6817.jpg) +Figure 7. Repriorisation makes mixing speed faster, and the performance benefits increase as the width to dataset size ratio increases. Per-step ESS as a function of layer width (left) and dataset size (right) for a 3-hidden layer FCN. The line indicates the mean, and the bands the minimum and maximum, ESS over the 100 projection subspaces (see Section 4.1.2). In all cases, reparametrisation achieves significantly better mixing speed (note the log-log scale of the axes). 3M samples collected for each configuration. Hyperparameters were tuned for each configuration separately (see Section 4.2.1). Left: Dataset size fixed at $n = 256$ . The benefit of reparametrisation increases with width, especially so when width becomes larger than dataset size where reparametrisation yields 50x higher ESS. Right: Width fixed at 512. Note that reparameterisation leads to a higher ESS for all configurations. + +![](images/97d01ada6fd94d3fde74255f60fb6a018d0e67c527117d79dd42ccf178d5e0b1.jpg) + +ourselves an unfair advantage based on the linear case intuition (Appendix D), or cause numerical issues. Sample thinning is applied in all experiments, and ESS and $\hat{R}$ are always computed based on the thinned sample. However, Figures 8 and 9 visualise ESS evolution as a function of the number of LMC steps which is equal the unthinned sample size. + +As common, we omit the Metropolis-Hastings correction of LMC (Neal, 1993), and instead tune hyperparameters so that average acceptance probability after burn-in stays above $98\%$ . We observed significant impact of numerical errors on both the proposal and the calculation of the acceptance probability; we use float32 which offers significant speed advantages over float64, but can still suffer 2-5 percentage point changes in acceptance probability compared to float64 computation with the same candidate sample. + +Our experiments are implemented in JAX (Bradbury et al., 2018), and rely on the Neural Tangents library (Novak et al., 2020) for both implementation of the NN model logic, and evaluation of the NNGP predictions (e.g., in Figure 3).4 + +# 4.2. Results + +In Figure 5 we visualize 2D slices through the weight posterior, for the original and reparameterized network for a 1-hidden layer FCN. The log posterior is far smoother after reparametrization, and its relative smoothness improves as network width is increased relative to dataset size. As we quantify in the following sections, this enables dramatic improvements in sampling efficiency. + +# 4.2.1. DEPENDENCE ON WIDTH AND DATASET SIZE + +In Figure 7, we explore the dependence of mixing speed of the LMC sampler on network width and dataset size as measured by the per-step ESS. We use a single chain run + +of 3M steps with a $20\mathrm{K}$ burn-in per each width/training set size. The results are computed on a sample thinned by a factor of 25. We use a FCN with three equal width hidden layers and GELU nonlinearities (Hendrycks & Gimpel, 2016), and the weight scaling described in Section 1.1. The weight and bias scaling factors are set to $\sigma_W^2 = 2$ , $\sigma_b^2 = 0.01$ everywhere except in the readout layer where $\sigma_W^2 = 1$ to achieve approximately unit average variance of the network predictions under the prior (at initialisation). For the width experiments (Figure 7, left), the dataset size was fixed at $n = 256$ , and the layer width varied over $\{32, 64, 128, 384, 512, 768, 1024\}$ . + +For each width and both parametrisations, we separately tuned the LMC stepsize and damping factor to maximise the ESS of $\theta$ while satisfying the $>98\%$ mean acceptance probability criterion. For the reparametrised sampler, we also tried to tune the regularisation parameter $\lambda$ (see Section 3.2), but found that the value dictated by our wide BNN theory ( $\lambda = \sigma^2$ ) worked best even for the smallest width models. The distribution of ESS over the random projections of $\theta$ and $f(X^{\mathrm{test}})$ on $5\mathbb{K}$ test points is shown, with its mean, minimum, and maximum values. + +Our reparametrisation achieves significantly faster mixing in all conditions (note the log-log scale). The improvement becomes larger as the BNN grows wider (left), achieving near-perfect values for the widest BNNs ( $10^{0} = 1$ is maximum) where the width ( $>2^{8}$ ) is larger than the dataset ( $256 = 2^{8}$ ), with a 50x speed up at width 1024. + +For the dataset size plots (right), the performance is again best when the ratio of width to the number of observations is the smallest (here on the left). The ESS of both $f(X^{\mathrm{test}})$ and $\theta$ decays with dataset size as expected, since the posterior becomes more complicated, and the width to dataset size ratio dips below one, i.e., we are leaving the NNGP regime. The reparametrisation however maintains higher ESS even outside of the conditions where our theory holds. + +![](images/863154075612752b1a7565339362fc44791a58b3404cfd172d9cfb1917a2e644.jpg) +3-hidden layer FCN + +![](images/3103eb083bd93a8cc2fe870a2c835b79949d822b7b0b9d39917f03e79297cbee.jpg) +Wide ResNet-20 + +# 4.2.2. DEPENDENCE ON ARCHITECTURE + +While our theory does not cover the cases where the ratio of dataset size to width is large, the consistent advantage of reparametrisation even in this regime is intriguing (Figure 7, right). In this section, we investigate the dependence of this phenomenon on the architecture and dataset size. + +For the architecture, we compare the FCN from Section 4.2.1 with a normaliser-free Wide ResNet-20 with 128, 256, and 512 channels arranged from bottom to the top layer in the usual three groups of residual layer blocks (He et al., 2016; Zagoruyko & Komodakis, 2016). GELU is used for both. + +As in (Izmailov et al., 2021), we remove batch normalisation since it makes predictions depend on the mini-batch, which interferes with Bayesian interpretation. We however use a different alternative in its place, namely the proposal of Shao et al. (2020), which replaces each residual sum $f_{k}^{\mathrm{skip}}(x) + f_{k}^{\mathrm{resid}}(x)$ by $\sqrt{k - 1 + c / k + c} f_{k}^{\mathrm{skip}}(x) + \sqrt{1 / k + c} f_{k}^{\mathrm{resid}}(x)$ where $k$ is the index of the skip connection, and $c$ is a hyperparameter we set to 1. Since (Izmailov et al., 2021) is the closest comparison for this section, we note the authors use a categorical instead of a Gaussian likelihood5, and an i.i.d. $\mathcal{N}(0,\alpha)$ prior for all parameters, but without scaling the weights by $\sigma_w^\ell /\sqrt{d^\ell}$ as we do (see Section 1.1). + +For the scaling factors, FCN is as in Section 4.2.1, whereas the ResNet uses $\sigma_W^2 = 2.2$ and $\sigma_b^2 = 0$ , except in the last layer where $\sigma_W^2 = 1$ and $\sigma_b^2 = 0.01$ is again employed to ensure reasonable scale of the network predictions under the prior. As a sanity check, using this prior as initialiser, and + +![](images/4d5254802131e273ccd75df7c6b3ebc87dddc777363361ff42d96405fd38665d.jpg) +Figure 8. Repriorisation results in faster mixing across architectures. Per-step ESS estimates are plotted as a function of the number of sampler steps for three random subsets of cifar-10 of size $n = 1024$ , 10240, 40960. The line indicates the mean, and the bands the minimum and maximum, ESS over the 100 projection subspaces (see Section 4.1.2). The initial downward trend of the curves is due to underestimation of long range autocorrelations at earlier steps where sample size is too small. Left: Results for a FCN with three width 1024 hidden layers. The non-reparametrised BNNs mix around 10x slower for all three dataset sizes, and up to 200x slower if the worst mixing projections (bottom of shaded regions) are compared to each other for each case. Right: Results for a normaliser-free Wide ResNet-20 with 128 and 512 units (channels) in the narrowest and widest layers (see Section 4.2.2). For $n = 1\mathrm{K}$ , reparameterisation performs more than 10x better. For $n = 10\mathrm{K}$ , both chains have very similar ESS / step values. This could be because the dataset size is now two orders of magnitude larger than the width, a regime in which our theory does not apply. It could also be because, even after 3 million sampling steps, the chains are so far from equilibrium and the ESS estimates are dominated by the initial transient effects. +Figure 9. Convergence of $\hat{R}$ with varying dataset size. Complements the left side of Figure 8. Line represents mean, band the maximum value. Estimates based on three independent chains. Note the log-log scale, and that $\hat{R}^2$ is plotted relative to its unit lower bound. High $\hat{R}^2$ indicate non-convergence so lower is better. + +optimising with Adam, this normaliser-free ResNet achieves a decent $95.6\%$ validation accuracy on full CIFar-10. We tuned the LMC stepsize and damping factor separately for every configuration to maximise ESS of $\theta$ while satisfying $>98\%$ mean acceptance rate after burn-in. For the reparametrised chain, the regulariser $\lambda$ was $\sigma^2$ and $n\sigma^2$ respectively for the FCN and the ResNet, with $\sigma^2 = 0.01$ the output variance. The sample thinning factor is 100. + +As can be seen in Figure 8, the mixing speed advantage of reparametrisation persists far from the NNGP regime in the case of the FCN (left), where even a factor of forty in dataset to width ratio did not erase the surprisingly consistent $10\mathrm{x}$ higher (average) ESS. This observation is supported by Figure 9, in which $\hat{R}^2$ is already near one (optimum) when the standard parametrisation still exhibits $\mathcal{O}(10^{2})$ values. + +For the Wide ResNet (right), we observed a similar $\geq 10\mathrm{x}$ benefit from reparameterisation at $1\mathrm{K}$ datapoints. For the $n = 10\mathrm{K}$ case, no benefit was observed. This may be be + +cause both chains are far from equilibrium even after 3M steps, and the per-step ESS measurement reflects initial transients. It may also be because the dataset size (10,240) was much larger than smallest channel count (128), exceeding by two orders of magnitude the scale where the model is expected to approximate the NNGP limit. + +# 5. Other related work + +For ensembles of infinitely-wide NNs trained with gradient descent, Shwartz-Ziv & Alemi (2020) find the KL divergence between the posterior and the prior to diverge linearly with training time, an interesting departure from the finite value we find for Bayesian inference in Proposition 2.3. The information content of infinitely-wide NNs was analysed by Bernstein & Yue (2021) using the NNGP posterior, leading to non-vacuous PAC-Bayes generalisation bounds, adding to an active line of work focusing on generalisation bounds for overparametrised models (see, e.g., Dziugaite & Roy, 2017; Valle-Perez et al., 2018; Vakili et al., 2021). + +If some hidden layers are narrow and remain finite, the resulting model is a type of Deep Gaussian process (Damianou & Lawrence, 2013; Agrawal et al., 2020) or Deep kernel process (Aitchison et al., 2021). Aitchison (2020) argues that such models may exhibit improved performance relative to uniformly wide BNNs owing to a form of representation learning. While we do not investigate such questions in this work, the favourable computational properties of our LMC algorithm could facilitate such analyses in the future. + +Moving away from the infinite width limit, Yaida (2020) and Roberts et al. (2021) show how to compute the Bayesian prior and posterior systematically in powers of $1 / \text{width}$ , with the leading-order term given by the NNGP, though the subleading corrections pose computational challenges. For some architectures, a Gaussian prior in parameter space leads to closed-form expressions for the prior in function space, even at finite width (Zavatone-Veth & Pehlevan, 2021). Less is known about the posterior for finite BNNs, since computational considerations often require approximate inference, whose quality in real-world problems has recently been investigated in (Izmailov et al., 2021). + +Our work is partially inspired by a thread of papers which accelerate MCMC sampling by applying an invertible transformation to a distribution's variables, and then running sampling chains in the transformed space (e.g., El Moselhy & Marzouk, 2012; Marzouk & Parno, 2014; Parno, 2015; Marzouk et al., 2016; Titsias, 2017; Hoffman et al., 2018). + +# 6. Conclusion + +We introduced repriorisation, a reparameterisation that (1) provides a rigorous characterisation of wide BNN para + +meter space, and (2) enables a more efficient BNN sampling algorithm which mixes faster as the network is made wider. + +Our theory shows BNN posteriors exhibit non-negligible interactions between parameters in different layers, even at large width. In contrast, many popular BNN posterior approximations (e.g., mean-field methods) assume independence between parameters in different layers. Beyond MCMC, algorithms which incorporate between-layer interactions—from Laplace (Tierney & Kadane, 1986) to more recent ones like (Ober & Aitchison, 2021)—are therefore better positioned to capture the true BNN posterior behaviour. In fairness, approximation fidelity and downstream performance are not the same thing though, as clearly demonstrated by the success of non-Bayesian approaches. + +Our sampling results parallel the interplay between optimisation and model size in deterministic NNs. In particular, first-order methods used to be considered ill-suited for the non-convex loss landscapes of NNs, yet experimental and later theoretical results showed they can be highly effective, especially for large NNs (e.g., Allen-Zhu et al., 2019; Du et al., 2019). Similarly, MCMC theory tells us that sampling is often harder in high dimensions, yet our results show that a simple reparametrisation exploiting the particular structure of wide BNN posteriors makes sampling much easier. + +While the gap between deterministic and Bayesian NNs remains considerable, we hope our work enables further progress for practical large-scale BNNs. + +# References + +Agrawal, D., Papamarkou, T., and Hinkle, J. Wide neural networks with bottlenecks are deep Gaussian processes. JMLR, 2020. +Aitchison, L. Why bigger is not always better: on finite and infinite neural networks. In ICML, 2020. +Aitchison, L., Yang, A., and Ober, S. W. Deep kernel processes. In ICML, 2021. +Allen-Zhu, Z., Li, Y., and Song, Z. A convergence theory for deep learning via over-parameterization. In ICML, 2019. +Bernstein, J. and Yue, Y. Computing the information content of trained neural networks. arXiv, 2021. +Billingsley, P. Convergence of probability measures. Wiley, second edition, 1999. +Bradbury, J., Frostig, R., Hawkins, P., Johnson, M. J., Leary, C., Maclaurin, D., Necula, G., Paszke, A., VanderPlas, J., Wanderman-Milne, S., and Zhang, Q. JAX: composable transformations of Python+NumPy programs, 2018. URL http://github.com/google/jax. + +Brooks, S., Gelman, A., Jones, G., and Meng, X.-L. Handbook of Markov chain Monte Carlo. CRC press, 2011. +Chizat, L., Oyallon, E., and Bach, F. On lazy training in differentiable programming. NeurIPS, 2019. +Cholesky, A.-L. Note sur une méthode de résolution des équations normales provenant de l'application de la méthode des moindres carrés à un système d'équations linéaires en nombre inférieur à celui des inconnues. — application de la méthode à la résolution d'un système défini d'équations linéaires. Bulletin géodésique, 1924. +Damianou, A. and Lawrence, N. D. Deep Gaussian processes. In AISTATS, 2013. +Daxberger, E., Nalisnick, E., Allingham, J. U., Antoran, J., and Hernandez-Lobato, J. M. Bayesian deep learning via subnetwork inference. In ICML, 2021. +Dillon, J. V., Langmore, I., Tran, D., Brevdo, E., Vasudevan, S., Moore, D., Patton, B., Alemi, A., Hoffman, M., and Saurous, R. A. Tensorflow distributions. arXiv, 2017. +Du, S., Lee, J., Li, H., Wang, L., and Zhai, X. Gradient descent finds global minima of deep neural networks. In ICML, 2019. +Dusenberry, M., Jerfel, G., Wen, Y., Ma, Y., Snoek, J., Heller, K., Lakshminarayanan, B., and Tran, D. Efficient and scalable Bayesian neural nets with rank-1 factors. In ICML, 2020. +Dziugaite, G. K. and Roy, D. M. Computing nonvacuous generalization bounds for deep (stochastic) neural networks with many more parameters than training data. UAI, 2017. +El Moselhy, T. A. and Marzouk, Y. M. Bayesian inference with optimal maps. Journal of Computational Physics, 2012. +Garriga-Alonso, A., Rasmussen, C. E., and Aitchison, L. Deep convolutional networks as shallow Gaussian processes. In ICLR, 2019. +Gelman, A. and Rubin, D. B. Inference from iterative simulation using multiple sequences. Statistical Science, 1992. +Gray, R. M. Entropy and Information Theory. Springer, second edition, 2011. +He, K., Zhang, X., Ren, S., and Sun, J. Deep residual learning for image recognition. In CVPR, 2016. +Hendrycks, D. and Gimpel, K. Gaussian error linear units (GELUs). arXiv, 2016. + +Hoffman, M., Sountsov, P., Dillon, J. V., Langmore, I., Tran, D., and Vasudevan, S. NeuTra-lizing bad geometry in Hamiltonian Monte Carlo using neural transport. AABI, 2018. +Hron, J., Bahri, Y., Novak, R., Pennington, J., and Sohl-Dickstein, J. Exact posterior distributions of wide Bayesian neural networks. UDL, 2020a. +Hron, J., Bahri, Y., Sohl-Dickstein, J., and Novak, R. Infinite attention: NNGP and NTK for deep attention networks. In ICML, 2020b. +Izmailov, P., Vikram, S., Hoffman, M. D., and Wilson, A. G. G. What are Bayesian neural network posteriors really like? In ICML, 2021. +Jacot, A., Gabriel, F., and Hongler, C. Neural tangent kernel: Convergence and generalization in neural networks. NeurIPS, 2018. +Khan, M., Nielsen, D., Tangkaratt, V., Lin, W., Gal, Y., and Srivastava, A. Fast and scalable Bayesian deep learning by weight-perturbation in Adam. In ICML, 2018. +Krizhevsky, A., Hinton, G., et al. Learning multiple layers of features from tiny images, 2009. +Lee, J., Sohl-dickstein, J., Pennington, J., Novak, R., Schoenholz, S., and Bahri, Y. Deep neural networks as Gaussian processes. In ICLR, 2018. +Lee, J., Xiao, L., Schoenholz, S., Bahri, Y., Novak, R., Sohl-Dickstein, J., and Pennington, J. Wide neural networks of any depth evolve as linear models under gradient descent. NeurIPS, 2019. +Levenberg, K. A method for the solution of certain nonlinear problems in least squares. Quarterly of applied mathematics, 1944. +Maddox, W. J., Izmailov, P., Garipov, T., Vetrov, D. P., and Wilson, A. G. A simple baseline for bayesian uncertainty in deep learning. In NeurIPS, 2019. +Marquardt, D. W. An algorithm for least-squares estimation of nonlinear parameters. Journal of the society for Industrial and Applied Mathematics, 1963. +Marzouk, Y. and Parno, M. Transport map-accelerated Markov chain Monte Carlo for Bayesian parameter inference. In AGU Fall Meeting Abstracts, 2014. +Marzouk, Y., Moselhy, T., Parno, M., and Spantini, A. An introduction to sampling via measure transport. arXiv, 2016. + +Matthews, A., Hensman, J., Turner, R., and Ghahramani, Z. On sparse variational methods and the Kullback-Leibler divergence between stochastic processes. In AISTATS, 2016. +Matthews, A., Hron, J., Turner, R., and Ghahramani, Z. Sample-then-optimize posterior sampling for Bayesian linear models. In AABI, 2017. +Matthews, A., Hron, J., Rowland, M., Turner, R. E., and Ghahramani, Z. Gaussian process behaviour in wide deep neural networks. In ICLR, 2018. +Neal, R. M. Probabilistic inference using Markov chain Monte Carlo methods. Technical report, University of Toronto, 1993. +Novak, R., Xiao, L., Bahri, Y., Lee, J., Yang, G., Hron, J., Abolafia, D. A., Pennington, J., and Sohl-dickstein, J. Bayesian deep convolutional networks with many channels are Gaussian processes. In ICLR, 2019. +Novak, R., Xiao, L., Hron, J., Lee, J., Alemi, A. A., Sohl-Dickstein, J., and Schoenholz, S. S. Neural Tangents: Fast and easy infinite neural networks in Python. In ICLR, 2020. URL https://github.com/google/neural-tangents. +Novak, R., Sohl-Dickstein, J., and Schoenholz, S. S. Fast finite width neural tangent kernel. In ICML, 2022. +Ober, S. W. and Aitchison, L. Global inducing point variational posteriors for Bayesian neural networks and deep Gaussian processes. In ICML, 2021. +Osawa, K., Swaroop, S., Khan, M. E. E., Jain, A., Eschenhagen, R., Turner, R. E., and Yokota, R. Practical deep learning with Bayesian principles. In NeurIPS, 2019. +Parno, M. D. Transport maps for accelerated Bayesian computation. PhD thesis, MIT, 2015. +Rasmussen, C. E. and Williams, C. K. I. Gaussian Processes for Machine Learning. MIT Press, 2005. +Ripley, B. Stochastic simulation. Statistical Papers, 1989. +Roberts, D. A., Yaida, S., and Hanin, B. The principles of deep learning theory. arXiv, 2021. +Rossky, P. J., Doll, J. D., and Friedman, H. L. Brownian dynamics as smart monte carlo simulation. The Journal of Chemical Physics, 1978. +Shao, J., Hu, K., Wang, C., Xue, X., and Raj, B. Is normalization indispensable for training deep neural network? In NeurIPS, 2020. + +Shwartz-Ziv, R. and Alemi, A. A. Information in infinite ensembles of infinitely-wide neural networks. In AABI, 2020. +Tierney, L. and Kadane, J. B. Accurate approximations for posterior moments and marginal densities. Journal of the American statistical association, 1986. +Titsias, M. K. Learning model reparametrizations: Implicit variational inference by fitting MCMC distributions. arXiv, 2017. +Vakili, S., Bromberg, M., Garcia, J., Shiu, D.-s., and Bernacchia, A. Uniform generalization bounds for overparameterized neural networks. arXiv, 2021. +Valle-Perez, G., Camargo, C. Q., and Louis, A. A. Deep learning generalizes because the parameter-function map is biased towards simple functions. In ICLR, 2018. +Voevodin, V. and Kuznetsov, Y. Matrices and computations. Nauka, 1984. +Wainwright, M. J. High-dimensional statistics: A non-asymptotic viewpoint. Cambridge University Press, 2019. +Yaida, S. Non-Gaussian processes and neural networks at finite widths. In Mathematical and Scientific Machine Learning, 2020. +Yang, G. Scaling limits of wide neural networks with weight sharing: Gaussian process behavior, gradient independence, and neural tangent kernel derivation. arXiv, 2019. +Yang, G. Tensor programs III: Neural matrix laws. arXiv, 2020. +Zagoruyko, S. and Komodakis, N. Wide residual networks. In BMVC, 2016. +Zavatone-Veth, J. and Pehlevan, C. Exact marginal prior distributions of finite Bayesian neural networks. *NeurIPS*, 2021. + +# A. Proofs + +Here and in the main body of the paper, all statements of convergence in probability or almost sure (a.s.) convergence with $d_{\mathrm{min}} \to \infty$ necessitate construction of an underlying probability space where the random variables for network of all widths live. Since verifying that the assumptions we use are satisfied for a majority of NN architectures can be obtained by referring to the Tensor Program work of Yang, we adopt his probability space construction (e.g., Yang, 2020, appendix L). + +Throughout we use the following definitions: $\lesssim$ is $\leq$ up to a universal positive (i.e., $a \lesssim b$ means $\exists c > 0$ s.t. $a \leq cb$ ), $d^{\leq L} \coloneqq d - d^{L} = \dim (\phi^{\leq L})$ , $\langle r, s \rangle = r^{\top} s$ is the dot product, $\hat{K}_{\sigma^2} \coloneqq \sigma^2 I_n + \hat{K}$ , and $K_{\sigma^2} \coloneqq \sigma^2 I_n + K$ . + +# A.1. Theorem 2.1 + +Theorem 2.1. Let $P_{\phi \mid \mathcal{D}}$ be the reparametrised posterior distribution defined by the density $p(\phi \mid \mathcal{D})$ . Assume the Gaussian prior and likelihood with $\sigma > 0$ , and that $\hat{K} \xrightarrow{\mathbb{P}} K$ and $\mathbb{E}[\hat{K}] \to K$ under the prior as $d_{\mathrm{min}} \to \infty$ . + +Then $\mathrm{KL}(\mathcal{N}(0,I_d)\parallel P_{\phi \mid \mathcal{D}})\to 0$ as $d_{\mathrm{min}}\to \infty$ + +Proof of Theorem 2.1. By the conditional KL divergence identity + +$$ +\mathrm {K L} (\mathcal {N} (0, I _ {d}) \parallel P _ {\phi \mid \mathcal {D}}) = \mathrm {K L} (\mathcal {N} (0, I _ {d \leq L}) \parallel P _ {\phi \leq L \mid \mathcal {D}}) + \mathbb {E} _ {\phi \leq L \sim \mathcal {N} (0, I _ {d \leq L})} [ \mathrm {K L} (\mathcal {N} (0, I _ {d ^ {L}}) \parallel P _ {\phi^ {L + 1} \mid \phi^ {\leq L}, \mathcal {D}}) ], +$$ + +where the latter term is zero by the argument right after Equation (3). Recalling $\phi^{\leq L} = \theta^{\leq L}$ and $p(\theta^{\leq L})\sim \mathcal{N}(0,I_{d^{\leq L}})$ + +$$ +\mathrm {K L} (\mathcal {N} (0, I _ {d \leq L}) \| P _ {\phi \leq L \mid \mathcal {D}}) = \log Z + \frac {1}{2} \mathbb {E} _ {\phi \leq L \sim \mathcal {N} (0, I)} \left[ \| y \| _ {\hat {K} _ {\sigma^ {2}} ^ {- 1}} ^ {2} + \log \det (\hat {K} _ {\sigma^ {2}}) \right],, +$$ + +where we substituted Equation (5) renormalised by $Z\coloneqq \mathbb{E}_{\phi^{\leq L}\sim \mathcal{N}(0,I_{d}\leq L)}\exp \{-\frac{1}{2} [||y||_{\hat{K}_{\sigma^2}^{-1}}^2 +\log \det (\hat{K}_{\sigma^2})]\}$ . Note that + +$$ +\hat {K} \mapsto \exp \{- \frac {1}{2} [ \| y \| _ {\hat {K} _ {\sigma^ {2}} ^ {- 1}} ^ {2} + \log \det (\hat {K} _ {\sigma^ {2}}) ] \}, +$$ + +is a bounded function of $\hat{K}$ by the positive semidefiniteness of $\Psi \Psi^{\top}$ . It is also continuous in $\hat{K}$ : for the determinant use, e.g., the Leibniz formula; the matrix inverse is continuous on the space of invertible matrices by continuity of the determinant and of $A \mapsto \operatorname{adj} A$ (sufficient here since $\hat{K}_{\sigma^2} = \sigma^2 I_n + \hat{K}$ where $\hat{K}$ is positive semidefinite). Since the measure w.r.t. which we integrate is the prior $\mathcal{N}(0, I_{d \leq L})$ , and $\hat{K} \to K$ in probability under the prior by assumption + +$$ +\log Z \to - \frac {1}{2} [ \| y \| _ {K _ {\sigma^ {2}} ^ {- 1}} ^ {2} + \log \det (K _ {\sigma^ {2}}) ] \quad \mathrm {a s} \quad d _ {\min } \to \infty , +$$ + +by the definition of convergence in distribution (implied by convergence in probability), and the continuity of the log. + +All that remains is thus to prove + +$$ +\mathbb {E} _ {\phi \leq L \sim \mathcal {N} (0, I)} \left[ \| y \| _ {\hat {K} _ {\sigma^ {2}} ^ {- 1}} ^ {2} + \log \det (\hat {K} _ {\sigma^ {2}}) \right] \to \| y \| _ {K _ {\sigma^ {2}} ^ {- 1}} ^ {2} + \log \det (K _ {\sigma^ {2}}) \quad \mathrm {a s} \quad d _ {\min} \to \infty . +$$ + +Note that the integrand is continuous in $\hat{K}$ by the above argument. Using the convergence of $\hat{K}$ to $K$ in probability under the prior, we thus see that the integrand converges in probability to the above constant by the continuous mapping theorem. + +Convergence of the expectation can then be ensured by establishing uniform integrability (UI), and invoking the Vitali's convergence theorem for finite measures (or theorem 3.5 in Billingsley, 1999). This is simple for the first term since + +$$ +0 \leq \| y \| _ {K _ {\sigma^ {2}} ^ {- 1}} ^ {2} \leq \sigma^ {- 2} \| y \| _ {2} ^ {2} \quad \text {a . s .}, +$$ + +which trivially implies UI. For the log determinant, note $0 \leq \log \det(\hat{K}_{\sigma^2}) \leq \operatorname{Tr}(\hat{K}_{\sigma^2})$ (a.s.) by the arithmetic-geometric mean inequality. By Lemma A.1, UI integrability can thus be obtained by establishing UI of $\{\operatorname{Tr}(\hat{K})\}$ (indexed by width). Because $\operatorname{Tr}(\hat{K}) \geq 0$ (a.s.) and $\mathbb{E}[\operatorname{Tr}(\hat{K})] = \operatorname{Tr}(\mathbb{E}[\hat{K}]) \to \operatorname{Tr}(\mathbb{E}[K]) = \mathbb{E}[\operatorname{Tr}(K)]$ under the prior by assumption, the desired UI follows by theorem 3.6 in (Billingsley, 1999). The UI of the sum then follows by the triangle inequality. + +# A.2. Proposition 2.2 + +Proposition 2.2. Let $\phi \sim \mathcal{N}(0, I_d)$ , $\theta \sim P_{\theta|D}$ , and denote the functions they parametrisse by $f_{T(\phi)}$ and $f_{\theta}$ . Assume all nonlinearities are continuous, and each layer's outputs are jointly continuous in the layer parameters and inputs. + +Then $\mathrm{KL}(P_{f_{T(\phi)}}\parallel P_{f_{\theta}\mid \mathcal{D}})\to 0$ as $d_{\mathrm{min}}\rightarrow \infty$ , where the KL is defined w.r.t. the usual product $\sigma$ -algebra on $\mathbb{R}^{\mathcal{X}}$ . + +Proof of Proposition 2.2. As mentioned in the main text, KL divergence between the pushforwards of two distributions through the same measurable mapping is never larger than that between the original distributions (e.g., Gray, 2011, corollary 5.2.2). It is thus sufficient to show that for any given fixed network architecture, the mapping from the parameters into the function space $\theta \in \mathbb{R}^d\mapsto f_\theta \in \mathbb{R}^\mathcal{X}$ is measurable with respect to the usual Borel product $\sigma$ -algebras on $\mathbb{R}^d$ and $\mathbb{R}^{\mathcal{X}}$ . + +The product $\sigma$ -algebra on $\mathbb{R}^{\mathcal{X}}$ is by definition generated by the product topology. The product topology is generated by a base composed of sets $A = \bigcap_{i=1}^{k} \pi_k^{-1}(A_i)$ , where each $\pi_k \colon \mathbb{R}^{\mathcal{X}} \to \mathbb{R}$ is a coordinate projection associated with a point $x_k \in \mathcal{X}$ , and each $A_k$ is an open set in the output space $\mathcal{Y} \subseteq \mathbb{R}$ . Because any finite intersection of open sets is open, it is sufficient to show that the mapping $\theta \mapsto f_\theta(x)$ is continuous for every $x \in \mathcal{X}$ . Since the outputs of each layer are jointly continuous in the inputs and its own parameters by assumption, we can progress recursively from the input to the output, and conclude by observing that compositions of continuous functions are continuous. + +# A.3. Proposition 2.3 + +Proposition 2.3. Under the assumptions of Theorem 2.1 + +$$ +\begin{array}{l} \operatorname {K L} \left(\mathcal {N} \left(0, I _ {d}\right) \| P _ {\theta | \mathcal {D}}\right) \\ \rightarrow \frac {1}{2} [ \sigma^ {- 2} \mathrm {T r} (K) + \| y \| _ {\sigma^ {- 2} I _ {n} - K _ {\sigma^ {2}} ^ {- 1}} ^ {2} - \log \det (\sigma^ {- 2} K _ {\sigma^ {2}}) ], \\ \end{array} +$$ + +as $d_{\mathrm{min}} \to \infty$ . The limit is equal to the KL divergence between the NNGP prior and posterior in function space, defined w.r.t. the usual product $\sigma$ -algebra on $\mathbb{R}^{\mathcal{X}}$ . + +Proof of Proposition 2.3. By the conditional KL divergence identity + +$$ +\mathrm {K L} (\mathcal {N} (0, I _ {d}) \parallel P _ {\theta \mid \mathcal {D}}) = \mathrm {K L} (\mathcal {N} (0, I _ {d \leq L}) \parallel P _ {\theta \leq L \mid \mathcal {D}}) + \mathbb {E} _ {\theta \leq L \sim \mathcal {N} (0, I _ {d \leq L})} [ \mathrm {K L} (\mathcal {N} (0, I _ {d ^ {L}}) \parallel P _ {\theta^ {L + 1} \mid \theta \leq L, \mathcal {D}}) ]. +$$ + +The first term converges to zero (see the proof of Theorem 2.1). We have also already seen $P_{\theta^{L + 1}|\theta \leq L,\mathcal{D}} = \mathcal{N}(\mu ,\Sigma)$ (see the discussion around Equation (3)). Using the formula for KL divergence between two multivariate normal distributions + +$$ +\begin{array}{l} \operatorname {K L} \left(\mathcal {N} \left(0, I _ {d ^ {L}}\right) \| P _ {\theta^ {L + 1} \mid \theta^ {\leq L}, \mathcal {D}}\right) \propto \operatorname {T r} \left(\Sigma^ {- 1}\right) + \| \mu \| _ {\Sigma} ^ {- 1} - d ^ {L} + \log \det (\Sigma) \\ = \sigma^ {- 2} \operatorname {T r} (\hat {K}) - \sigma^ {- 2} [ I _ {n} - \sigma^ {- 2} \Psi (I _ {d ^ {L}} + \sigma^ {- 2} \Psi^ {\top} \Psi) ^ {- 1} \Psi^ {\top} - I _ {n} ] - \log \det (\sigma^ {- 2} \hat {K} _ {\sigma^ {2}}) \\ = \sigma^ {- 2} \mathrm {T r} (\hat {K}) + \| y \| _ {\sigma^ {- 2} I _ {n} - \hat {K} _ {\sigma^ {2}} ^ {- 1}} ^ {2} + n \log (\sigma^ {2}) - \log \det (\hat {K} _ {\sigma^ {2}}), \\ \end{array} +$$ + +where we used the Woodbury identity for the last equality. Convergence of all the above terms and their expectations has already been established in the proof of Theorem 2.1. Reintroducing the dropped constant, we therefore have + +$$ +\mathrm {K L} (\mathcal {N} (0, I _ {d}) \parallel P _ {\theta \mid \mathcal {D}}) \to \frac {1}{2} \left[ \sigma^ {- 2} \mathrm {T r} (K) + \| y \| _ {\sigma^ {- 2} I _ {n} - K _ {\sigma^ {2}} ^ {- 1}} ^ {2} + n \log (\sigma^ {2}) - \log \det (K _ {\sigma^ {2}}) \right]. +$$ + +To establish equivalence to the KL between the NNGP prior and posterior, it is sufficient to employ equation (12) from (Matthews et al., 2016) with, in their notation, $Q = P$ set to be the prior. This results in + +$$ +\log Z + \frac {1}{2} \bigg [ n \log (2 \pi \sigma^ {2}) + \sigma^ {- 2} \mathbb {E} _ {f (X) \sim \mathcal {N} (0, K)} \big [ \| y - f (X) \| _ {2} ^ {2} \big ] \bigg ] = \log Z + \frac {1}{2} \bigg [ n \log (2 \pi \sigma^ {2}) + \sigma^ {- 2} [ \| y \| _ {2} ^ {2} + \mathrm {T r} (K) ] \bigg ], +$$ + +where + +$$ +\begin{array}{l} \log Z = \mathbb {E} _ {f (X) \sim \mathcal {N} (0, K)} \left[ (2 \pi \sigma^ {2}) ^ {- n / 2} \exp \left\{- \frac {1}{2 \sigma^ {2}} \| y - f (X) \| _ {2} ^ {2} \right\} \right] \\ = - \frac {1}{2} \left[ n \log (2 \pi \sigma^ {2}) + \log \det (K) + \log \det (K ^ {- 1} + \sigma^ {- 2} I _ {n}) + \| y \| _ {K _ {\sigma^ {2}} ^ {- 1}} ^ {2} \right] \\ = - \frac {1}{2} \left[ n \log (2 \pi) + \log \det (K _ {\sigma^ {2}}) + \| y \| _ {K _ {\sigma^ {2}} ^ {- 1}} ^ {2} \right], \\ \end{array} +$$ + +by basic determinant identities. Substituting $\log Z$ into the previous equation yields the result. + +![](images/252e939654fffbfd5c6092ebde4acc6ece8649979a3408acc261c83e0a2255da.jpg) + +# A.4. Proposition 3.1 + +The two additional technical assumptions mentioned in the main text are: + +1. The set of last layer preactivations $f^{L}$ is exchangeable over the embedding (width) index, and converges in distribution to a well-defined limit (not necessarily a GP, even though that is the case in most scenarios). These facts are true for almost all architectures—(see, e.g., Matthews et al., 2018; Garriga-Alonso et al., 2019; Hron et al., 2020b; Yang, 2020). +2. Defining $\tilde{\Theta}_{11} \coloneqq \frac{\partial h_{:1}}{\partial\phi\leq L}\frac{\partial h_{:1}^{\top}}{\partial\phi\leq L} \in \mathbb{R}^{n\times n}$ , we assume $\mathbb{E}[\|\tilde{\Theta}_{11}\|_2^2]$ converges as well. This will again be generally true by $\|\tilde{\Theta}_{11}\|_2^2 \leq \mathrm{Tr}(\tilde{\Theta})^2$ and theorem A.2 in (Yang, 2020). + +Proposition 3.1. Let $\Delta_{\phi} \coloneqq -\phi - \nabla_{\phi}\log p(\phi \mid \mathcal{D})$ where $-\phi$ is the gradient of the log density of $\mathcal{N}(0,I)$ . Assume the conditions in Theorem 2.1, and continuous nonlinearities. + +Then $P_{\phi \mid \mathcal{D}}(\| \Delta_{\phi}\| _2 > \epsilon)\to 0$ as $d_{\mathrm{min}}\rightarrow \infty ,\forall \epsilon >0$ + +Proof of Proposition 3.1. By $p(\phi^{L + 1} \mid \phi^{\leq L}, \mathcal{D}) \sim \mathcal{N}(0, I_d^L)$ (see the discussion after Equation (3)), the last layer gradients always exactly agree with that of the standard normal, i.e., $\nabla_{\phi^{L + 1}} \log e^{-\|\phi^{L + 1}\|_2^2 / 2} = -\phi^{L + 1}$ . Hence $\Delta_{\phi}$ depends only on $\phi^{\leq L}$ . Substituting from Equation (5) (after application of the Weinstein-Aronszajn identity) + +$$ +\left\| \Delta_ {\phi} \right\| _ {2} \leq \left\| \nabla_ {\phi^ {\leq L}} \log \det (\hat {K} _ {\sigma^ {2}}) \right\| _ {2} + \left\| \nabla_ {\phi^ {\leq L}} y ^ {\top} \hat {K} _ {\sigma^ {2}} ^ {- 1} y \right\| _ {2}. +$$ + +We will use the shortcut $\partial_i$ to denote the derivative w.r.t. $\phi_i^{\leq L}$ , so that $\| \nabla_{\phi^{\leq L}}\dots \|_2 = \sum_{i=1}^{d^{\leq L}} (\partial_i \cdots)^2$ . Applied to the individual summands, we have $\partial_i \log \det(\hat{K}_{\sigma^2}) = \mathrm{Tr}(\hat{K}_{\sigma^2}^{-1}(\partial_i \hat{K})) = 1_n^\top \hat{K}_{\sigma^2}^{-1}(\partial_i \hat{K})1_n$ where $1_n \in \mathbb{R}^n$ is a vector of all ones. Similarly, $\partial_i y^\top \hat{K}_{\sigma^2}^{-1}y = -y^\top \hat{K}_{\sigma^2}^{-1}(\partial_i \hat{K})\hat{K}_{\sigma^2}^{-1}y$ . Hence the summands in both gradients have the form $(r^\top (\partial_i \hat{K})s)^2$ for some possibly random vectors $r, s \in \mathbb{R}^n$ whose distribution may depend on the width. Substituting the definition of $\Psi$ + +$$ +\partial_ {i} \hat {K} _ {a b} \propto \frac {1}{d ^ {L}} \sum_ {j = 1} ^ {d ^ {L}} \left(\partial_ {i} h _ {a j}\right) h _ {b j} + h _ {a j} \left(\partial_ {i} h _ {b j}\right), +$$ + +where we used the abbreviation $h_{aj} \coloneqq h_j^L(x_a)$ . Therefore $r^\top(\partial_i \hat{K}) s \propto \frac{1}{d^L} \sum_j \langle r, \partial_i h_{:j} \rangle \langle s, h_{:j} \rangle + \langle s, \partial_i h_{:j} \rangle \langle r, h_{:j} \rangle$ , so + +$$ +\begin{array}{l} \sum_ {i = 1} ^ {d ^ {\leq L}} \left(r ^ {\top} \left(\partial_ {i} \hat {K}\right) s\right) ^ {2} \propto \frac {1}{(d ^ {L}) ^ {2}} \sum_ {i = 1} ^ {d ^ {\leq L}} \sum_ {j, k = 1} ^ {d ^ {L}} \left[ r ^ {\top} \left(\partial_ {i} h _ {: j}\right) \left(\partial_ {i} h _ {: k}\right) ^ {\top} r \right] \left[ s ^ {\top} h _ {: j} h _ {: k} ^ {\top} s \right] + \left[ r ^ {\top} \left(\partial_ {i} h _ {: j}\right) \left(\partial_ {i} h _ {: k}\right) ^ {\top} s \right] \left[ s ^ {\top} h _ {: j} h _ {: k} ^ {\top} r \right] + \dots \\ = \frac {1}{(d ^ {L}) ^ {2}} \sum_ {j, k = 1} ^ {d ^ {L}} [ s ^ {\top} h _ {: j} h _ {: k} ^ {\top} s ] \big [ r ^ {\top} \frac {\partial h _ {: j}}{\partial \phi^ {\leq L}} \frac {\partial h _ {: k} ^ {\top}}{\partial \phi^ {\leq L}} r \big ] + [ s ^ {\top} h _ {: j} h _ {: k} ^ {\top} r ] \big [ r ^ {\top} \frac {\partial h _ {: j}}{\partial \phi^ {\leq L}} \frac {\partial h _ {: k} ^ {\top}}{\partial \phi^ {\leq L}} s \big ] + \ldots , \\ \end{array} +$$ + +where we have expanded the square (the last two terms are omitted as signified by the ellipsis). Defining $\tilde{\Theta}_{jk} \coloneqq \frac{\partial h_{:j}}{\partial\phi^{\leq L}}\frac{\partial h_{:k}^{\top}}{\partial\phi^{\leq L}}$ + +$$ +\sum_ {i = 1} ^ {d ^ {\le L}} (r ^ {\top} (\partial_ {i} \hat {K}) s) ^ {2} \propto \frac {1}{(d ^ {L}) ^ {2}} \sum_ {j, k = 1} ^ {d ^ {L}} (\langle s, h _ {: j} \rangle r + \langle r, h _ {: j} \rangle s) ^ {\top} \tilde {\Theta} _ {j k} (\langle s, h _ {: k} \rangle r + \langle r, h _ {: k} \rangle s) +$$ + +By Theorem 2.1, we can now integrate w.r.t. to the prior $\mathcal{N}(0,I_{d\leq L})$ instead of the posterior $P_{\phi \leq L}|\mathcal{D}$ , because by Pinsker's inequality $\mathrm{TV}(\mathcal{N}(0,I_{d\leq L}),P_{\phi \leq L}|\mathcal{D})\lesssim [\mathrm{KL}(\mathcal{N}(0,I_{d\leq L})\| P_{\phi \leq L}|\mathcal{D})]^{1 / 2}$ where the right-hand side goes to zero as widths go to infinity (see the proof of Theorem 2.1 for details). Using $z_{j}\coloneqq \langle s,h_{:j}\rangle r + \langle r,h_{:j}\rangle s\in \mathbb{R}^{n}$ + +$$ +\sum_ {i = 1} ^ {d ^ {\leq L}} \mathbb {E} \left[ \left(r ^ {\top} \left(\partial_ {i} \hat {K}\right) s\right) ^ {2} \right] = \frac {1}{d ^ {L}} \mathbb {E} \left[ z _ {1} ^ {\top} \tilde {\Theta} _ {1 1} z _ {1} \right] + \left(1 - \frac {1}{d ^ {L}}\right) \mathbb {E} \left[ z _ {1} ^ {\top} \tilde {\Theta} _ {1 2} z _ {2} \right] \tag {8} +$$ + +by the assumed exchangeability of the readout units. By the linear readout assumption, $\tilde{\Theta}_{ij}$ is just a scaled version of $\hat{\Theta} -\hat{K}$ , where $\hat{\Theta} \coloneqq (\partial_{\phi}f^{L + 1})(\partial_{\phi}f^{L + 1})^{\top}$ is the empirical NTK, with the output layer 'integrated out'. It thus converges in + +probability under the prior (and thus the posterior) by the above argument and (Yang, 2020, theorem 2.10), with $\tilde{\Theta}_{ij}$ going to a constant $\tilde{\Theta} \in \mathbb{R}^{n \times n}$ if $i = j$ , and to zero otherwise. Since $\hat{K}_{\sigma^2}^{-1}$ also converges to a constant in probability (see the proof of Theorem 2.1), the vectors $r$ and $s$ do so as well. Since the vectors $h$ are just $\psi$ applied pointwise to the previous layer outputs, which converge to a GP by assumption, they will converge in distribution to the corresponding $\psi_{\#}$ pushforward by the continuity of $\psi$ . Their limit will be denoted simply by $z$ . By the Slutsky's lemma, the integrand $z_1^\top \tilde{\Theta}_{11} z_1$ thus converges in distribution to $z^\top \tilde{\Theta} z$ , and $z_1^\top \tilde{\Theta}_{12} z_2$ to zero. + +Since $|z_1^\top \tilde{\Theta}_{12}z_2| \lesssim z_1^\top \tilde{\Theta}_{11}z_1 + z_2^\top \tilde{\Theta}_{11}z_2$ by the outer product definition of $\tilde{\Theta}_{11}$ , and the arithmetic-geometric mean inequality, it will be sufficient to establish uniform integrability (UI) of $z_1^\top \tilde{\Theta}_{11}z_1$ to show the expectations converge (Billingsley, 1999, theorem 3.5). This can be obtained by observing $z_1^\top \tilde{\Theta}_{11}z_1 \leq \| \tilde{\Theta}_{11}\|_2\| z\|_2^2 \leq \| \tilde{\Theta}_{11}\|_2^2 + \| z\|_2^4 \leq \mathrm{Tr}(\tilde{\Theta}_{11})^2 + \| z\|_2^4$ which are both non-negative random variables, which converge in probability (resp. in distribution) by continuity of the trace and the square function. Their expectations then converge by theorem A.2 in (Yang, 2020). The collection of $\{z_1^\top \tilde{\Theta}_{11}z_1\}$ indexed by width is thus UI by Lemma A.1. Hence the expectations on the right hand side of Equation (8) converge, implying their sequence is bounded, and thus + +$$ +\mathbb {E} [ \| \Delta_ {\phi} \| _ {2} ] \leq \sqrt {\mathbb {E} [ \| \Delta_ {\phi} \| _ {2} ^ {2} ]} \lesssim \frac {1}{\sqrt {d ^ {L}}} + o (1), +$$ + +Convergence in posterior probability follows by the above Pinsker's inequality argument, and the Markov's inequality. + +# Auxiliary results + +Lemma A.1. If $\mathcal{C}$ and $\mathcal{C}'$ are two collections of random variables such that for every $X \in \mathcal{C}$ there exists $Y \in \mathcal{C}'$ such that $|X| \leq |Y|$ a.s., and $\mathcal{C}'$ is uniformly integrable (UI), then $\mathcal{C}$ is uniformly integrable. + +Proof of Lemma A.1. Clearly $\sup_{X\in \mathcal{C}}\mathbb{E}|X|\leq \sup_{Y\in \mathcal{C}'}\mathbb{E}|Y| < \infty$ by UI. Furthermore, for arbitrary $\epsilon >0,\exists \delta >0$ s.t. + +$$ +\sup_{\mathbb{P}(A)\leq \delta}\sup_{X\in \mathcal{C}}\mathbb{E}|X|\mathbb{1}_{A}\leq \sup_{\mathbb{P}(A)\leq \delta}\sup_{Y\in \mathcal{C}^{\prime}}\mathbb{E}|Y|\mathbb{1}_{A}\leq \epsilon +$$ + +again by the uniform integrability of $\mathcal{C}'$ . Taken together, the two facts imply $\mathcal{C}$ is also uniformly integrable. + +# B. Feature-space vs. data-space reparametrisation + +The feature-space version of our algorithm—presented in the main body and utilised in the experiments—scales cubically in the top layer width $d^{L}$ rather than the number of datapoints $n$ (cubic scaling in $n$ is the main bottleneck of exact GP inference). This is preferable in most practical circumstances since $d^{L}$ is hardly ever significantly larger than $n$ , making the additional computational overhead negligible. Figure 6. Here we present a data-space version which scales cubically in $n$ as in GPs, but only quadratically in $d^{L}$ . This may be useful, e.g., when investigating properties of very wide BNNs. + +The data-space version can be obtained using ideas related to the 'kernel trick'. Starting with $T(\phi) = \mu + \Sigma^{1/2}\phi$ , we have $\mu = (\sigma^2 I_{d^L} + \Psi^\top \Psi)^{-1}\Psi^\top y = \Psi^\top (\sigma^2 I_n + \Psi \Psi^\top)^{-1}y$ . For the covariance + +$$ +\Sigma = (I _ {d ^ {L}} + \sigma^ {- 2} \Psi^ {\top} \Psi) ^ {- 1} = I _ {d ^ {L}} - \Psi^ {\top} (\sigma^ {2} I _ {n} + \Psi \Psi^ {\top}) ^ {- 1} \Psi , +$$ + +by the Woodbury identity. The reparametrisation requires the square root $\Sigma^{1/2}$ though, for which we can use a Woodbury-like identity for the matrix square root. To our knowledge, this identity is new and may thus be of independent interest: + +$$ +\left(I _ {p} + A ^ {\top} A\right) ^ {1 / 2} = I _ {p} + A ^ {\top} \left[ I _ {m} + \left(I _ {m} + A A ^ {\top}\right) ^ {1 / 2} \right] ^ {- 1} A, \tag {9} +$$ + +for any $m,p\in \mathbb{N}$ and $A\in \mathbb{R}^{m\times p}$ . Clearly this reduces the $\mathcal{O}(p^3)$ complexity of the square root on the l.h.s. to the $\mathcal{O}(m^3 +m^3) = \mathcal{O}(m^3)$ complexity of the square root and matrix inverse on the r.h.s. To see the identity holds, use SVD decomposition $A = USV^{\top}$ to rewrite the l.h.s. as $V(I_{p} + S^{\top}S)^{1 / 2}V^{\top}$ , and the r.h.s. as + +$$ +I _ {p} + A ^ {\top} \left[ I _ {m} + (I _ {m} + A A ^ {\top}) ^ {1 / 2} \right] ^ {- 1} A = V \left\{I _ {p} + S ^ {\top} \left[ I _ {m} + (I _ {m} + S S ^ {\top}) ^ {1 / 2} \right] ^ {- 1} S \right\} V ^ {\top}, +$$ + +and observe that $\sqrt{1 + x^2} = 1 + \frac{x^2}{1 + \sqrt{1 + x^2}}$ for any $x\in \mathbb{R}$ . Since we need the inverse, $(I_{d^L} + \sigma^{-2}\Psi^\top \Psi)^{-1 / 2} = \Sigma^{1 / 2}$ , we can combine Equation (9) with the usual Woodbury identity for matrix inverse to obtain + +$$ +\Sigma^ {1 / 2} = I _ {d ^ {L}} - \Psi^ {\top} \left[ \sqrt {\sigma^ {2} I _ {n} + \Psi \Psi^ {\top}} \left(\sigma I _ {n} + \sqrt {\sigma^ {2} I _ {n} + \Psi \Psi^ {\top}}\right) \right] ^ {- 1} \Psi . +$$ + +We can then perform the eigendecomposition $\sigma^2 I_n + \Psi \Psi^\top = Q\Lambda Q^\top$ which has $\mathcal{O}(n^3)$ complexity (same as the Cholesky decomposition), and thus allows efficient computation of both $\mu = \Psi^\top Q\Lambda^{-1}Q^\top y$ , and + +$$ +\Sigma^ {1 / 2} \phi = \phi - \Psi^ {\top} Q \Lambda^ {- 1 / 2} (\sigma I _ {n} + \Lambda^ {1 / 2}) ^ {- 1} Q ^ {\top} \Psi \phi , +$$ + +since $\Lambda$ is a diagonal matrix. Similar to Section 3.2, we can reuse the decomposition result to obtain the density value essentially for free using $p(\phi \mid \mathcal{D}) = p(\theta \mid \mathcal{D})\left|\operatorname*{det}\partial_{\phi}\theta \right|$ , and Equation (4) together with the Weinstein-Aronszajn identity + +$$ +\left| \det \partial_ {\phi} \theta \right| = \sqrt {\det (\Sigma)} = \sqrt {\det (I _ {d ^ {L}} + \sigma^ {- 2} \Psi^ {\top} \Psi)} \propto \sqrt {\det (\sigma^ {2} I _ {n} + \Psi \Psi^ {\top})} = \prod_ {i = 1} ^ {n} \sqrt {\Lambda_ {i i}}. +$$ + +# C. Extension to multi-dimensional outputs + +In the main text, we assumed the output dimension $d^{L + 1} \in \mathbb{N}$ is equal to one for simplicity of exposition. The extension to $d^{L + 1} > 1$ is simple. In particular, we take the factorised Gaussian likelihood (see Appendix F for the categorical likelihood) + +$$ +\log p (y \mid X, \theta) = - \frac {n d ^ {L + 1}}{2} \log (2 \pi \sigma^ {2}) - \frac {1}{2 \sigma^ {2}} \sum_ {i = 1} ^ {n} \sum_ {j = 1} ^ {d ^ {L + 1}} (y _ {i j} - f _ {\theta} (x _ {i}) _ {j}) ^ {2}, +$$ + +where $f_{\theta}(x_i)\in \mathbb{R}^{d^{L + 1}}$ . Each output dimension is associated with an independent readout weight $W_{:j}^{L + 1}\in \mathbb{R}^{d^L}$ s.t. $f_{\theta}(x)_j = \sigma_W^{L + 1}h(x)^L W_{:j}^{L + 1} / \sqrt{d^L}$ . To compute $\theta = T(\phi)$ , the only modification occurs in the last layer where the mean $\mu_{:j} = \Psi^{\top}(\sigma^{2}I_{n} + \Psi \Psi^{\top})^{-1}y_{:j}$ is different for each $W_{:j}^{L + 1}$ , with $y_{:j}\in \mathbb{R}^n$ the $j^{\mathrm{th}}$ column of the targets $y\in \mathbb{R}^{n\times d^{L + 1}}$ . Importantly, $\Psi$ is the same for all $j$ , meaning a single Cholesky decomposition is sufficient. Modern solvers allow for multi-column r.h.s. meaning that we can solve for the reparametrised value of the output weights at once, limiting the computational overhead. + +The only other change is in the determinant $\operatorname*{det}(\partial_{\phi}\theta)$ . Because each $W_{:j}^{L + 1}$ only depends on $\phi^{\leq L} = \theta^{\leq L}$ , the determinant still has the upper-triangular structure analogous to Equation (4), implying + +$$ +\log \left| \det \left(\partial_ {\phi} \theta\right) \right| = \operatorname {c o n s t a n t} + d ^ {L + 1} \log \det \left(\sigma^ {2} I _ {n} + \Psi \Psi^ {\top}\right). +$$ + +We can thus again re-use the result of the Cholesky decomposition to obtain the determinant value essentially for free. + +# D. Repriorisation induced LMC speed-up in linear models + +While the linear case $f_{\theta}(x) = \langle x, \theta \rangle$ is of course not equivalent to deep BNNs, we use it here to provide a rough intuition for the source and magnitude of the improvement that could be encountered when running LMC with $p(\phi \mid \mathcal{D})$ instead of $p(\theta \mid \mathcal{D})$ . To sample from a generic density $p(z)$ , LMC (and HMC) typically uses the Leapfrog integrator to simulate the Hamiltonian dynamics of a system with potential energy $U(z) = -\log p(z)$ and kinetic energy $K(m) = \frac{1}{2} \| m \|_{M^{-1}}^2$ , where $m \in \mathbb{R}^d$ is an auxiliary momentum variable, and $M \in \mathbb{R}^{d \times d}$ a positive definite mass matrix (Brooks et al., 2011). + +The integrator simulates movement of a particle with initial state $(z_0, m_0) \in \mathbb{R}^d \times \mathbb{R}^d$ along a trajectory of constant energy $H(z, m) = U(z) + K(m)$ in the 'counter-clockwise direction' + +$$ +\left( \begin{array}{c} {\dot {m} _ {t}} \\ {\dot {z} _ {t}} \end{array} \right) = \left( \begin{array}{c c} {O} & {- I _ {d}} \\ {I _ {d}} & {0} \end{array} \right) \left( \begin{array}{c} {\partial_ {m _ {t}} H (z _ {t}, m _ {t})} \\ {\partial_ {z _ {t}} H (z _ {t}, m _ {t})} \end{array} \right) = \left( \begin{array}{c} {- \nabla U (z _ {t})} \\ {\nabla K (m _ {t})} \end{array} \right). +$$ + +A nice property of the linear case is that we can easily solve this matrix ODE, and thus determine the error accrued by the integrator for any given $t > 0$ . Without reparametrisation $(z = \theta)$ , $\nabla U(\theta) = \theta + \sigma^{-2} X^{\top}(X\theta - y) = C\theta - b_{\mathcal{D}}$ , where + +$C = I + \sigma^{-2}X^{\top}X = \Sigma^{-1}$ and $b_{\mathcal{D}} = \sigma^{-2}X^{\top}y = \Sigma^{-1}\mu$ . This translates into the matrix ODE + +$$ +\left( \begin{array}{c} \dot {m} _ {t} \\ \dot {\theta} _ {t} \end{array} \right) = \underbrace {\left( \begin{array}{c c} O & - C \\ M ^ {- 1} & 0 \end{array} \right)} _ {= A} \left( \begin{array}{c} m _ {t} \\ \theta_ {t} \end{array} \right) + \underbrace {\left( \begin{array}{c} b _ {\mathcal {D}} \\ 0 \end{array} \right)} _ {= A b}, +$$ + +which has the usual solution + +$$ +\left( \begin{array}{c} m _ {t} \\ \theta_ {t} \end{array} \right) = (I - e ^ {t A}) b + e ^ {t A} \left( \begin{array}{c} m _ {0} \\ \phi_ {0} \end{array} \right). +$$ + +Accuracy of the integrator is thus determined by how closely it can approximate the matrix exponential $e^{tA}$ . The value of this exponential is known; to simplify, we take $M = I$ as used in our experiments + +$$ +\begin{array}{l} e ^ {t A} = \sum_ {k = 0} ^ {\infty} \frac {t ^ {2 k}}{(2 k) !} \left( \begin{array}{c c} (- C) ^ {k} & 0 \\ 0 & (- C) ^ {k} \end{array} \right) + \sum_ {k = 0} ^ {\infty} \frac {t ^ {2 k + 1}}{(2 k + 1) !} \left( \begin{array}{c c} 0 & (- C) ^ {k + 1} \\ (- C) ^ {k} & 0 \end{array} \right) \\ = \left( \begin{array}{c c} \cos (t \sqrt {C}) & - \sqrt {C} \sin (t \sqrt {C}) \\ (\sqrt {C}) ^ {- 1} \sin (t \sqrt {C}) & \cos (t \sqrt {C}) \end{array} \right) . \\ \end{array} +$$ + +Note that $C$ is the inverse posterior covariance, and the above equations describe a 'rotation' along an ellipsoid defined by the eigendecomposition of $C$ , as expected. Most importantly, the integrator error will be driven by $t\sqrt{C}$ , where in particular the LMC stepsize has to be inversely proportional to $\| \sqrt{C}\|_2$ if a local approximation of $\sin$ and $\cos$ is to be accurate. + +An analogous argument holds for the reparametrised version $(z = \phi)$ , where $\nabla U(\phi) = \frac{\partial\theta}{\partial\phi}^{\top}[\Sigma^{-1}(\sigma^{-2}\Sigma X^{\top}y + \sqrt{\Sigma}\phi) - \sigma^{-2}X^{\top}y] = \phi$ by $\Sigma = C^{-1}$ and $\frac{\partial\theta}{\partial\phi} = \sqrt{\Sigma}$ . The stepsize can therefore be (inversely) proportional to $\| I_d\| _2 = 1$ , disregards of both $n$ and $d$ . In contrast, without the reparametrisation, the stepsize must be inversely proportional to (see above) + +$$ +\| \sqrt {C} \| _ {2} = \sqrt {\| C \| _ {2}} = \sqrt {1 + \frac {\| X ^ {\top} X \| _ {2}}{\sigma^ {2}}} \sim \frac {\sqrt {n}}{\sigma}, +$$ + +where we used $\| X^{\top}X\|_{2} = n\|\frac{1}{n}\sum_{i}x_{i}x_{i}^{\top}\|_{2}$ and assumed $\| \frac{1}{n}\sum_{i}x_{i}x_{i}^{\top}\|_{2} = \mathcal{O}(1)$ . This assumption will be true for most sufficiently well-behaved distributions over $x_{i}$ by the law of large numbers (if $\mathbb{E}[xx^{\top}]$ exists), and the continuity of the operator norm (see chapter 6 in Wainwright, 2019, for a more detailed discussion). + +In summary: without the reparametrisation, the maximum stepsize scales as $\frac{\sigma}{\sqrt{n}}$ , whereas it is independent of $n$ and $\sigma$ in the reparametrised case. The higher the $n$ and/or lower the $\sigma$ , the bigger the advantage of our reparametrisation. In the deep BNN case, we replace $X$ with $\Psi$ , and look at the eigenspectrum of the NNGP kernel divided by $n$ (which is related to its kernel integral operator in wide enough BNNs). While only an approximation in deep BNNs, we note that a constraint of the above form must be satisfied by the sampler in order to successfully sample the readout layer (with the asymptotic NNGP replaced by the empirical one), which is why we intuitively expect the stepsize to scale at least as $\frac{\sigma}{\sqrt{n}}$ . This was observed in our experiments, where we indeed applied this stepsize scaling for the final hyperparameter sweep used in Figures 7 and 8. + +# E. Alternative reparametrisations + +# E.1. Reparametrising other layers than readout + +The reparametrisation $T\colon \phi \mapsto \theta$ we define in Equation (3) ensures that $\theta^{L + 1}$ follows its true conditional posterior when $\phi^{L + 1}\sim \mathcal{N}(0,I_{d^L})$ , which we have seen is the case under $p(\phi \mid \mathcal{D})$ . One may wonder whether there exists an alternative reparametrisation(s) $R\colon \phi \mapsto \theta$ which still ensures the KL divergence between $p(R(\phi)\mid \mathcal{D})|\operatorname *{det}\partial_{\phi}R(\phi)|$ and $\mathcal{N}(0,I_d)$ goes to zero as $d_{\mathrm{min}}\to \infty$ , but maps some other layer than the readout to its conditional posterior. In other words, is the readout 'special', or is mapping of any one layer to its conditional sufficient to ensure reversion to the prior in the wide limit? + +For an example of a case where reparametrisation of a layer other than the readout is sufficient, consider the linear 1-hidden layer FCN with a single input and output dimension, $f(x) = (x \cdot u^{\top})v / \sqrt{d^{1}}$ , with $u, v \in \mathbb{R}^{d^{1}}$ respectively the input and readout weights (w.l.o.g. $\sigma_{W} = 1$ ). By symmetry, $f(x) = (x \cdot v^{\top})u / \sqrt{d^{1}}$ , implying we can apply the $T$ from Equation (3) to the input weights $u$ , and use Theorem 2.1 (mutatis mutandis) to obtain the desired KL-convergence. + +However, this argument no longer holds when we introduce a nonlinearity, as the symmetry between $u$ and $v$ is broken. Moreover, we now show that the KL-convergence to the prior does not happen if we consider the only available alternative $R$ , i.e., mapping $u$ to its conditional posterior given the readout $v$ and $\mathcal{D}$ ,7 and leaving the readout $v$ without reparametrisation. + +To start, observe that the conditional distribution of $v$ given $u$ and $\mathcal{D}$ remains $\mathcal{N}(\mu, \Sigma)$ with $\mu = \Psi^\top \hat{K}_{\sigma^2}^{-1}y$ (kernel trick), and $\Sigma = I - \Psi^\top \hat{K}_{\sigma^2}^{-1}\Psi$ (Woodbury identity). For simplicity, we prove that KL-convergence to prior cannot happen when the nonlinearity $\psi$ is bounded. Using a proof-by-contradiction, assume the KL does converge to zero. By the chain rule for KL divergence, this implies the KL between the reparametrised marginal posterior of the readout $v$ given $\mathcal{D}$ converges in KL to the prior over $v$ , i.e., $\mathcal{N}(0, I_{d^1})$ . By the assumed boundedness of $\psi$ and the Pinsker's inequality, this in turn implies + +$$ +\mathbb {E} [ v _ {: 1} \mid \mathcal {D} ] = \mathbb {E} [ \Psi_ {: 1} ^ {\top} \hat {K} _ {\sigma^ {2}} ^ {- 1} y \mid \mathcal {D} ] \to \mathbb {E} _ {\varepsilon \sim \mathcal {N} (0, I _ {d ^ {0}})} [ \psi (X \varepsilon) ] ^ {\top} K _ {\sigma^ {2}} ^ {- 1} y, \quad \mathrm {a s} d _ {\min} \to \infty . +$$ + +However, the Pinsker's inequality and boundedness of $\psi$ also imply that $\mathbb{E}[v_{:1}|\mathcal{D}]\to \mathbb{E}[v_{:1}] = 0$ (prior mean), which is a contradiction unless $\mathbb{E}_{\varepsilon \sim \mathcal{N}(0,I_{d^0})}[\psi (X\varepsilon)] = 0$ (or $y = 0$ ). This is not true, e.g., for the popular sigmoid non-linearity. + +In summary, the answer to our question from the first paragraph is 'it depends'. There are some linear networks in which symmetry enables reparametrising layers other than the readout and still obtaining the KL-convergence. However, introduction of non-linearities breaks this symmetry, which in turn prevents reversion to the prior. Reparametrisation of the readout is thus indeed 'special', as it is the only layer which ensures convergence in all cases (modulo the assumptions of Theorem 2.1). + +![](images/f8c68b69760d0bdcd2c1a22246ca95184abf30375b1ea936f372cfe4e9ff764a.jpg) +Figure 10. Comparing NNGP $T$ and NTK $R$ in terms of ESS per-step in the $\theta$ space for subsets of cifar-10. ESS proj is defined the same as in Section 4 (showing only the mean over projection dimensions). ESS dots is the ESS of the squared norm statistic $\| \theta \|_2^2$ . Since these are older experiments, $T$ is described as 'last layer' (solid lines), and $R$ as 'LMA' (dashed lines). Colours distinguish different values of the regulariser $\lambda$ . The $\lambda = \mathrm{OPT}$ corresponds to the maximum ESS per-step values optimised over $\log \lambda = -4, -3, \ldots, 1$ for each dataset size separately. While the NTK reparametrisation is sometimes competitive, the NNGP one is clearly preferable. + +# E.2. NTK reparametrisation + +Another alternative is to linearise $f$ , i.e., to use the network Jacobian $J \coloneqq \partial_{\phi}f_{\phi}(X)$ to define the reparametrisation + +$$ +\theta = R (\phi) = \phi + J ^ {\top} \hat {\Theta} _ {\lambda} ^ {- 1} (y - f _ {\phi} (X)), \quad \text {w i t h} \hat {\Theta} _ {\lambda} := \lambda I _ {d} + \hat {\Theta} = \lambda I _ {d} + J J ^ {\top}, \text {f o r s o m e} \lambda \geq 0. \tag {10} +$$ + +This reparametrisation is inspired by the NTK theory where optimising the NN linearised around its (random) initial point by gradient descent yields the same large width behaviour as optimising the original NN (Lee et al., 2019). Informally, if $\phi \sim \mathcal{N}(0,I)$ (the initialisation distribution in the NTK world), and the NN is wide enough + +$$ +f _ {R (\phi)} (x) \approx f _ {\phi} (x) + J _ {x} (R (\phi) - \phi) = f _ {\phi} (x) + J _ {x} J ^ {\top} \hat {\Theta} _ {\lambda} ^ {- 1} (y - f _ {\phi} (X)), +$$ + +where $J_{x}\coloneqq \partial_{\phi}f_{\phi}(x)$ . By the NNGP theory, $f_{\phi}\sim \mathrm{GP}(0,k)$ is the NNGP limit; by the NTK theory, $\hat{\Theta}_{xX}\coloneqq J_xJ^\top \to$ $\Theta_{xX}\in \mathbb{R}^{1\times n}$ and $\hat{\Theta}\rightarrow \Theta \in \mathbb{R}^{n\times n}$ in probability as $d_{\mathrm{min}}\to \infty$ , where $\Theta$ is the NTK (see, e.g., Yang, 2020, for an + +overview). If we approximate by substituting the limits, $f_{R(\phi)} \approx f_{\phi} + \Theta_{X}\Theta_{\lambda}^{-1}(y - f_{\phi}(X))$ , we notice this is a fixed linear transformation of the NNGP, and thus also a GP. In fact, it is the NTK-GP when $\lambda = 0$ (Lee et al., 2019, corollary 1), i.e., the distributional limit of NNs optimised by gradient descent, where the randomness comes from the initialisation $\mathcal{N}(0,I)$ . + +The above sketch shows that $\theta = R(\phi)$ provides parameter-space samples which converge to the NTK-GP limit when $\phi \sim \mathcal{N}(0, I)$ , forming an informal NTK counterpart to Proposition 2.2. An alternative is to interpret Equation (10) as a single step of the Levenberg-Marquardt algorithm (LMA; Levenberg, 1944; Marquardt, 1963). This perspective inspired us to also experiment with multi-step LMA update (i.e., iterative application of $R$ from Equation (10)) so as to adjust for potential inaccuracy of the linearisation; we also experimented with just using multiple steps of gradient descent (GD), i.e., iterative application of $\phi \mapsto \phi + \alpha J^{\top}(y - f_{\phi}(X))$ with a fixed $\alpha$ . Neither the GD update nor the iterative application worked significantly better than Equation (10) in our experiments, which is why we abandon their further discussion here. + +In the remainder of this section, we discuss the technical details of the NTK reparametrisation (Equation (10)) implementation. Figure 10 shows a comparison of this $R$ with the 'NNGP reparametrisation' $T$ we presented in the main paper (Equation (3)). While $R$ is sometimes competitive with $T$ , $T$ is clearly better overall. This is likely because $R$ yields samples from the NTK-GP, which may induce a complicated $p(\phi \mid \mathcal{D})$ when the NTK-GP significantly differs from the NNGP (i.e., the correct posterior, Hron et al., 2020a). Since $T$ is also orders of magnitude more computationally efficient (scales with the top layer embedding size $d^{L}$ instead of the full parameter space dimension $d$ ), and we have rigorous understanding of its behaviour (Section 2), we do not recommend using the NTK reparametrisation. The motivation for describing it here is to inform any potential future research, documenting what we tried, and contrasting it with the NNGP reparametrisation. + +# E.2.1. COMPUTING $R(\phi)$ + +Denoting the residuals by $r \coloneqq y - f_{\phi}(X)$ , $R$ becomes $\phi \mapsto \phi + J^{\top} \hat{\Theta}_{\lambda}^{-1} r$ . Because computing $r$ costs about the same as the forward pass, and multiplication by $J^{\top}$ the same as the backward pass (vector-Jacobian product), the only operations not common in standard NN training are the computation of $\hat{\Theta}_{\lambda}$ , and the subsequent application of the linear solver $r \mapsto \hat{\Theta}_{\lambda}^{-1} r$ . + +Fortunately, the matrix $\hat{\Theta} = JJ^{\top}$ , known as the empirical NTK, has recently become a subject of significant interest. We can thus use the Neural Tangents library (Novak et al., 2020) which provides a very efficient way of computing $\hat{\Theta}$ , and related matrix-vector products (Novak et al., 2022). As for the $r\mapsto \hat{\Theta}_{\lambda}^{-1}r$ , we tried several implicit and explicit solvers, approximate and exact, but the fastest and most numerically stable was the explicit Cholesky solver. We recommend using at least float32 precision (or its emulation if on TPU) to prevent significant deterioration of the acceptance probability. + +Another possible approximation is setting the data. Specifically, we can replace the $r$ , $J^{\top}$ , and $JJ^{\top}$ terms in $\theta = \phi + J^{\top}(\sigma^{2}I_{n} + JJ^{\top})^{-1}r$ by their equivalent evaluated on a fixed data subset. This may be especially tempting when computing computational and memory bottlenecks are an issue. One nevertheless has to be careful about designing any approximations to $R$ as—especially in the data setting case—these may inadvertently cause the resulting $p(\phi \mid \mathcal{D})$ to be as constrained as $p(\theta \mid \mathcal{D})$ , and thus erase any possible LMC speed up. For example, in the linear case, if we subset the data and some of the omitted inputs is not close to the linear span of the included ones, there will be a posterior covariance eigenvalue as low as $\propto \frac{\sigma^2}{n}$ (instead of $\propto 1$ ), which would necessitate scaling the LMC stepsize by $\frac{\sigma}{\sqrt{n}}$ (cf. Appendix D). + +While we aim to approximate the $R$ (Equation (10)), any approximation of $R$ itself is a valid reparametrisation (if bijective and differentiable), as long as the gradients and $\left|\operatorname{det}\partial_{\phi}\theta\right|$ are both computed for the approximated instead of the true $R$ . + +# E.2.2. APPROXIMATING det $\partial_{\phi}R(\phi)$ + +Unlike above, the approximations her can affect the stationary distribution of the Markov chain or even prevent its existence. Hence the obtained samples may not be drawn from the true posterior even in the infinite time limit. + +Our log determinant approximation combines the Taylor expansion of $z \mapsto \log(1 + z)$ around $z = 0$ , and the Hutchinson trick for trace estimation. In particular, for a real symmetric matrix $A$ with $\| A \|_2 < 1$ + +$$ +\log | \det (I + A) | = - \sum_ {j = 1} ^ {\infty} \frac {(- 1) ^ {j}}{j} \operatorname {T r} \left(A ^ {j}\right) \approx - \frac {1}{S} \sum_ {i = 1} ^ {S} \sum_ {j = 1} ^ {M} \frac {(- 1) ^ {j}}{j} s _ {i} ^ {\top} A ^ {j} s _ {i}, \tag {11} +$$ + +where $s_i$ are i.i.d. zero mean vectors with $E[s_i s_i^\top] = I$ . We use vectors with i.i.d. Rademacher entries throughout. + +Unfortunately, substituting $A = \frac{\partial \theta}{\partial \phi} - I$ into Equation (11) would violate the symmetry requirement since + +$$ +\frac {\partial \theta}{\partial \phi} = \left(I - J ^ {\top} \hat {\Theta} _ {\lambda} ^ {- 1} J\right) \left(I + H _ {\tilde {r}}\right) - J ^ {\top} \hat {\Theta} _ {\lambda} ^ {- 1} \binom {- H _ {1} J ^ {\top} \tilde {r} -} {\vdots} \text {, w i t h} H _ {\tilde {r}} := \sum_ {i = 1} ^ {n} \tilde {r} _ {i} H _ {i}, \tag {12} +$$ + +where $\tilde{r} \coloneqq \hat{\Theta}_{\lambda}^{-1} r = \hat{\Theta}_{\lambda}^{-1}(y - f_{\phi}(X))$ is the 'preconditioned residual', and $H_{i} \coloneqq \frac{\partial^{2}f_{\phi}(x_{i})}{\partial\phi^{2}}$ the Hessian at $x_{i}$ . A straightforward solution would be to use the identity $|\operatorname{det}(A)| = \sqrt{\operatorname{det}(AA^{\top})}$ . The downside is doubling of the computational time. We thus instead approximate by + +$$ +\left. \log \left| \det \left(\frac {\partial \theta}{\partial \phi}\right) \right| \approx \text {c o n s t a n t} + \log \left| \det \left(I _ {d} + H _ {\tilde {r}}\right) \right|, \right. \tag {13} +$$ + +Roughly speaking, this approximation exploits the fact that the column spaces of $I_{d} - J^{\top}\hat{\Theta}_{\lambda}^{-1}J$ and $J^{\top}$ in Equation (12) are close to orthogonal for small $\lambda$ relative to $\| \hat{\Theta}\| _2$ . (Careful when tuning $\lambda!$ ) Rotating the space and using the block-matrix determinant formula allows us to decompose the log determinant into an asymptotically constant component aligned with the column space of $J^{\top}$ , and the stochastic component $\log |\operatorname*{det}(I_d + H_{\tilde{r}})|$ . + +Combining Equations (11) and (13), we have $A = H_{\tilde{r}}$ which is a symmetric matrix as desired. Furthermore, the Hutchinson estimator only requires evaluation of the vector products $v \mapsto H_{\tilde{r}}^{j}v$ which can be implemented efficiently by applying the JAX vector-Jacobian function to the map $\phi \mapsto J^{\top}\mathsf{sg}[\hat{\Theta}_{\lambda}^{-1}r]$ where $\mathsf{sg}$ is the stop-gradient function. Finally, LMC requires estimation of the gradient but naive application of reverse-mode automatic differentiation may result in an out-of-memory (OOM) error, especially for larger architectures (the Rademacher vectors $s$ have dimension $d$ ). A more memory-efficient method is to compute both the value and gradient of the log determinant approximation in the forward pass. $^9$ + +To illustrate, consider the second-order Taylor expansion ( $M = 2$ in Equation (11)) which we used in preliminary experiments. Exploiting the symmetry of $A = H_{\tilde{r}}$ , we define $\tilde{s}_i \coloneqq A s_i$ , and compute both the log determinant and its gradient as + +$$ +\log \left| \det \partial_ {\phi} R (\phi) \right| \approx \frac {1}{S} \sum_ {i = 1} ^ {S} s _ {i} ^ {\top} A s _ {i} - \frac {1}{2} s _ {i} ^ {\top} A ^ {2} s _ {i} = \frac {1}{S} \sum_ {i = 1} ^ {S} \tilde {s} _ {i} ^ {\top} \left(s _ {i} - \frac {1}{2} \tilde {s} _ {i}\right), \tag {14} +$$ + +$$ +\nabla_ {\phi} \log \left| \det \partial_ {\phi} R (\phi) \right| \approx \nabla_ {\phi} \frac {1}{S} \sum_ {i = 1} ^ {S} s _ {i} ^ {\top} A s _ {i} - \frac {1}{2} s _ {i} ^ {\top} A ^ {2} s _ {i} = \frac {1}{S} \sum_ {i = 1} ^ {S} \left(\frac {\partial \tilde {s} _ {i}}{\partial \phi}\right) ^ {\top} (s _ {i} - \tilde {s} _ {i}), +$$ + +where $s_i - \tilde{s}_i \mapsto \left(\frac{\partial\tilde{s}_i}{\partial\phi}\right)^\top (s_i - \tilde{s}_i)$ can be obtained via JAX vjp. Since evaluating all the summands at the same time leads to OOM issues, we compute the result sequentially in a loop over mini-batches of a size smaller than $S$ .10 + +# F. Non-Gaussian likelihoods + +![](images/83b990740ee09201317822fe75cec7ae4b67946c1390128cb56afb1e785ae046.jpg) +Figure 11. Our reparametrisation can be combined with non-Gaussian likelihoods. We ran a smaller version of the experiment in Figure 7 (left) with the categorical likelihood, (much) less extensive hyperparameter tuning, and only $100\mathrm{K}$ sampler steps. We had to lower the acceptance probability cutoff to $90\%$ (from $98\%$ ) since the lowest stepsize in our grid was too high for the standard parametrisation (the reparametrised version achieved $\sim 99\%$ with a higher stepsize). The observed boost is thus likely an underestimate of the real gap. Mapping readout to its true conditional posterior induced by the categorical likelihood would likely work even better. + +![](images/f82f56633ca0b84c8f91ca5303db88ee14415d7be8e9eba739780b4d88be6bb9.jpg) \ No newline at end of file diff --git a/widebayesianneuralnetworkshaveasimpleweightposteriortheoryandacceleratedsampling/images.zip b/widebayesianneuralnetworkshaveasimpleweightposteriortheoryandacceleratedsampling/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..d62a6152d2ee5c2bfc66d81df946614386388878 --- /dev/null +++ b/widebayesianneuralnetworkshaveasimpleweightposteriortheoryandacceleratedsampling/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5e6466240ce2415383e3d1c59b8b7a9b989531aaa35ed49ad792d53cada7e94b +size 926412 diff --git a/widebayesianneuralnetworkshaveasimpleweightposteriortheoryandacceleratedsampling/layout.json b/widebayesianneuralnetworkshaveasimpleweightposteriortheoryandacceleratedsampling/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..c8b2fec58237b67d798b2aa53330a5cd991257d4 --- /dev/null +++ b/widebayesianneuralnetworkshaveasimpleweightposteriortheoryandacceleratedsampling/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e7870725285180673ff6fef3c9c231b9695963c7a26f98a36ba134775ce31397 +size 1152333 diff --git a/wideneuralnetworksforgetlesscatastrophically/2df6dd05-069d-47c6-bccc-55cda6c9960b_content_list.json b/wideneuralnetworksforgetlesscatastrophically/2df6dd05-069d-47c6-bccc-55cda6c9960b_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..3e01edef05329ed563982043d75907769cd9fad4 --- /dev/null +++ b/wideneuralnetworksforgetlesscatastrophically/2df6dd05-069d-47c6-bccc-55cda6c9960b_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0971917b7e28bb52c0cc22f230369cd7e4dea65ddfcd808afb2c8eeff972042b +size 126240 diff --git a/wideneuralnetworksforgetlesscatastrophically/2df6dd05-069d-47c6-bccc-55cda6c9960b_model.json b/wideneuralnetworksforgetlesscatastrophically/2df6dd05-069d-47c6-bccc-55cda6c9960b_model.json new file mode 100644 index 0000000000000000000000000000000000000000..17103385ff7a6066c1fa42e9ee918f69ddabe7c3 --- /dev/null +++ b/wideneuralnetworksforgetlesscatastrophically/2df6dd05-069d-47c6-bccc-55cda6c9960b_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:531a84e4796db9406050843ca7b38ea16bfc7ef0b07ec6cb6591315c77c8e798 +size 157641 diff --git a/wideneuralnetworksforgetlesscatastrophically/2df6dd05-069d-47c6-bccc-55cda6c9960b_origin.pdf b/wideneuralnetworksforgetlesscatastrophically/2df6dd05-069d-47c6-bccc-55cda6c9960b_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..7c6580323e9fbefad5eb900a3c8ebe2d969b0edd --- /dev/null +++ b/wideneuralnetworksforgetlesscatastrophically/2df6dd05-069d-47c6-bccc-55cda6c9960b_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8f1ba621a44c86938ceb05d7e6bcdef323aa2091e8d08e9e88db1da1b81fc5ec +size 853894 diff --git a/wideneuralnetworksforgetlesscatastrophically/full.md b/wideneuralnetworksforgetlesscatastrophically/full.md new file mode 100644 index 0000000000000000000000000000000000000000..15262209c8ecab3b570837baa95ec1dcec3423e3 --- /dev/null +++ b/wideneuralnetworksforgetlesscatastrophically/full.md @@ -0,0 +1,595 @@ +# Wide Neural Networks Forget Less Catastrophically + +Seyed Iman Mirzadeh\*1 Arslan Chaudhry $^{2\dagger}$ Dong Yin $^{2}$ Huiyi Hu $^{2}$ Razvan Pascanu $^{2}$ Dilan Gorur $^{2}$ Mehrdad Farajtabar $^{2\dagger}$ + +# Abstract + +A primary focus area in continual learning research is alleviating the "catastrophic forgetting" problem in neural networks by designing new algorithms that are more robust to the distribution shifts. While the recent progress in continual learning literature is encouraging, our understanding of what properties of neural networks contribute to catastrophic forgetting is still limited. To address this, instead of focusing on continual learning algorithms, in this work, we focus on the model itself and study the impact of "width" of the neural network architecture on catastrophic forgetting, and show that width has a surprisingly significant effect on forgetting. To explain this effect, we study the learning dynamics of the network from various perspectives such as gradient orthogonality, sparsity, and lazy training regime. We provide potential explanations that are consistent with the empirical results across different architectures and continual learning benchmarks. + +# 1. Introduction + +Machine learning is relying more and more on training large models on large static datasets to reach impressive results (Kaplan et al., 2020; Lazaridou et al., 2021; Hombaiah et al., 2021). However, the real world is changing over time, and new information is becoming available at an unprecedented rate (Lazaridou et al., 2021; Hombaiah et al., 2021). In such real-world problems, the learning agent is exposed to a continuous stream of data, with potentially changing data distribution, and it has to absorb new information efficiently while not being able to iterate on previous data as freely as wanted due to time, sample, compute, privacy, or environmental complexity issues (Parisi + +*Work done during an internship at DeepMind. †Equal advising. 1Washington State University 2DeepMind. Correspondence to: Seyed Iman Mirzadeh , Mehrdad Farajtabar . + +Proceedings of the $39^{th}$ International Conference on Machine Learning, Baltimore, Maryland, USA, PMLR 162, 2022. Copyright 2022 by the author(s). + +et al., 2019). To overcome these inefficiencies, fields, such as continual learning (CL) (Ring, 1995) or lifelong learning (Thrun, 1995) are gaining a lot of attention recently. One of the key challenges in continual learning models is the abrupt erasure of previous knowledge, referred to as catastrophic forgetting (CF) (McCloskey and Cohen, 1989). + +Alleviating catastrophic forgetting has attracted a lot of attention lately, and many interesting solutions are proposed to partly overcome the issue (e.g., Toneva et al., 2019; Nguyen et al., 2019; Hsu et al., 2018; Li et al., 2019; Wallingford et al., 2020). These solutions vary in degree of complexity from simple replay-based methods to complicated regularization or network expansion-based methods. Unfortunately, however, there is not much fundamental understanding of the intrinsic properties of neural networks that affect continual learning performance through catastrophic forgetting or forward/backward transfer (Mirzadeh et al., 2020b). Moreover, most of the continual learning works focus on the algorithmic side of alleviating the forgetting rather than the architecture being used throughout the learning experience. This motivated our work to study one of the most important aspects of neural network architectures: the structure of the neural networks (e.g., width and depth). + +In contrast to the orthodox importance of the depth for network performance, such as in AlexNet (Krizhevsky et al., 2012), Inception (Szegedy et al., 2016), ResNets (He et al., 2016) or GPT family of models (Brown et al., 2020), we study how the width of the network affects the continual learning performance – aligned with the recent research on infinite width networks and the neural tangent kernel (NTK) regime (Jacot et al., 2018; Lee et al., 2019; Arora et al., 2019; Chizat et al., 2019). We empirically demonstrate that increasing the width alone reduces catastrophic forgetting significantly, while it's not the case for depth. + +Concretely, Figures 1 and 2 depict our findings on two popular continual learning benchmarks. Figure 1 shows that by increasing the width of a 2-layer MLP from 32 to 2048 the amount of forgetting of task 1 (after learning the 5th task) decreases from 62 to 48 percent. On Split CIFAR-100, by multiplying the width of a WideResNet-10 by 8 we can decrease forgetting of the first task (after learning the 20th task) from 42 to 31 percent. + +![](images/78cb71ce0ae86486583978cd0d09e40bf3e64b2057270ea49a3a6a7b5ad61edb.jpg) +(a) MLP on Rotated MNIST + +![](images/4e129e6c42cd3ae4f1ae763bf236e9a01af99c4c0c830f5eec6eb3164b371148.jpg) +(b) WRN on Split CIFAR-100 +Figure 1. Amount of forgetting w.r.t. increasing width. Wider networks forget less. + +The boost in performance gained by only increasing the width is comparable to employing alternative methods specially developed to tackle CF with moderately sized replay buffers or regularization schemes. For example, it can be seen that in Figure 1a, wider networks without replay achieve comparable or better performance than the network with width 32 and employing replay buffers of sizes of 125 and 250. A similar level of performance improvement can be observed in Figure 1b, where the baseline WideResNet (width factor equal to 1) is trained with replay buffer sizes of 100 and 400. The ability of the wider networks to be less forgetful points towards looking at forgetting through the lens of over-parametrization (Kaplan et al., 2020; Lazaridou et al., 2021; Hombaiah et al., 2021). + +It is noteworthy that increasing width is not aimed to achieve state-of-the-art performance in alleviating forgetting. Our goal is not to compete with computationally cheaper and performant rehearsal or regularization-based methods (Chaudhry et al., 2018; Farajtabar et al., 2020; Mirzadeh et al., 2021) but to provide a perspective on how over-parametrization and especially the width of the neural network can affect CF. One may wonder that a similar over-parametrization achieved through depth might have a similar positive effect on continual learning performance. Figure 2 shows that this is not the case and that achieving over-parametrization through depth has no or even negative effect on mitigating forgetting. + +Contributions. We study the implications of different neural network structures and over-parametrization (i.e., width and depth) for continual learning. We show that increased width can alleviate the forgetting and provide simplistic theoretical and empirical justifications such as lazy training regime and orthogonalization that can explain the benefits of using wide neural networks in continual learning. + +# 2. Related Work + +In continual learning (Ring, 1995), also referred to as lifelong learning (Thrun, 1995), an agent, constrained in time and memory, receives a sequence of tasks. The goal of the agent is to remember the useful knowledge of the past tasks to solve new tasks efficiently. Catastrophic forget- + +![](images/55ad09ba63752e3789cf10be82add1135f9cd1679906aafe6e7eef3ebec70922.jpg) +(a) MLP on Rotated MNIST + +![](images/12930c0bded967e1c91f1807eb67d7c1b33661e054bc43fb735a4a6907873876.jpg) +(b) WRN on Split CIFAR-100 +Figure 2. Amount of forgetting w.r.t. increasing depth. + +ting (McCloskey and Cohen, 1989; McClelland et al., 1995; Goodfellow et al., 2013)—a sudden erasure of previous knowledge when exposed to new tasks—is identified as one of the key challenges in continual learning. Recently, a lot of algorithmic progress has been made in mitigating catastrophic forgetting in neural networks. The progress can broadly be classified into three categories. + +Regularization-based methods (Rebuffi et al., 2016; Kirkpatrick et al., 2017; Zenke et al., 2017; Nguyen et al., 2018; Aljundi et al., 2018; Yin et al., 2020) attempt to identify important parameters or features of the past tasks, and modify the training objective of the new task such that those parameters or features do not drift significantly. While regularization-based methods provide strong results for a small number of tasks, the importance of parameters drifts when the number of tasks is large (Chaudhry et al., 2018; Titsias et al., 2019). + +Expansion-based methods (Rusu et al., 2016; Fernando et al., 2017; Aljundi et al., 2017; Rosenbaum et al., 2018; Chang et al., 2018; Xu and Zhu, 2018; Ferran Alet, 2018; Li et al., 2019; Veniat et al., 2021) add new network modules or experts for new tasks. By construction, expansion-based methods can have zero-forgetting, but their memory complexity can increase super-linearly with the number of tasks, making them undesirable when the pool of tasks is large. We note that even though the expansion-based works may have the model as their main subject, the main objective of these works is designing algorithms that can efficiently use a model (e.g., if the model should be expanded or not), and they do not explicitly analyze the structure of the model (e.g., width). For instance, while Yoon et al. (2018) show that expanding the network capacity thorough width is helpful, they have not studied the impact of increasing capacity when the depth increases, nor why increasing the width is helpful. Overall, in this work, we are interested in understanding the impacts of network structure (e.g., width and depth) on continual learning performance by focusing on the model itself rather than the algorithm that works with the model. + +Perhaps the strongest are the replay-based methods that store a small subset of data from previous tasks in the replay buffer, and either use it directly in the form of experience replay with new task (Shin et al., 2017; Kirichenko et al., + +2021; Rolnick et al., 2019; Riemer et al., 2018; Chaudhry et al., 2019; Chaudhry et al., 2020; Balaji et al., 2020) or use it as a set of optimization constraints (Lopez-Paz and Ranzato, 2017; Chaudhry et al., 2018; Farajtabar et al., 2020). + +While these methods provide algorithmic improvements on top of standard neural network training (empirical risk minimization), there is still limited understanding as to what causes forgetting in the first place. Some works have looked at the forgetting from the lens of network representations. For example, Javed and White (2019); Beaulieu et al. (2020) showed that meta-learned representations forget less when trained continually. On the other hand, Mehta et al. (2021) showed that pre-trained over-parameterized networks forget considerably less than randomly initialized networks when trained continually. Similarly, few works have studied the forgetting from the neural network's training dynamics perspective. Mirzadeh et al. (2021) showed that the optima of the multitask learning and continual learning solutions are linearly connected in the parameter space. Contrary to these works, we look at catastrophic forgetting from the lens of network architecture, specifically with respect to its width and depth and show that wider networks forget considerably less. + +A flurry of recent papers in deep learning theory has taken a huge step in understanding the training behavior of neural networks. In particular, Jacot et al. (2018) first introduced the concept of neural tangent kernel (NTK) by studying the training dynamics of neural networks with square loss in the infinite width or "over-parameterized" regime. The resulting neural network can be approximated by a linear model. Based on the NTK framework, other works (Allen-Zhu et al., 2019; Du et al., 2019; Zou et al., 2020) have proved the convergence of the SGD on various other settings and proved the NTK to be a powerful framework to study neural networks training dynamics. Later Chizat et al. (2019) developed a parallel idea under the framework called "lazy training" where the weights stay near their initial values during the training. In this regime, the system becomes almost linear, and the dynamics of SGD within this region can be characterized via properties of the associated NTK. In the context of continual learning, Doan et al. (2021) have studied forgetting of projection-based algorithms in the NTK regime using the similarity of the tasks. + +Finally, several recent works have explored the intersection of neural network architectures and continual learning. Mirzadeh et al. (2022) provides a comprehensive analysis on the significant role of architectures and architectural decisions in continual learning. They show that different architecture families have different learning and retention capabilities, and compare the merits and flaws of various architectures. For the pre-training setup, Ramasesh et al. (2022) studies the effect of scaling in continual learning and + +show that large pre-trained models perform significantly better than the models trained from scratch in continual learning scenarios. + +# 3. Main Experiments + +In this section, we study the impact of width on both average accuracy and average forgetting. Further detailed experiments and results will be provided in Sections 4 and 5. + +# 3.1. Experimental Setup + +The experimental setup, such as benchmarks, network architectures, continual learning setting (e.g., number of tasks, episodic memory size, and training epochs per task), hyperparameters, and evaluation metrics are chosen to be similar to several other studies (Chaudhry et al., 2019; Farajtabar et al., 2020; Mirzadeh et al., 2021). To ensure that the reported results are not more favorable to a specific architecture, we use a grid of hyper-parameters, and for each model, we report the results with the best hyperparameters. For all experiments, we report the average and standard deviation over five runs with different random seeds for network initialization. In addition to random seed for initialization, for Split CIFAR-100, we use three different seeds for each run where each seed corresponds to the random order in which classes are selected for each task. We provide more details about our experimental design in Appendix A. + +**Benchmarks.** We report our findings on two standard continual learning benchmarks: Rotated MNIST and Split CIFAR-100. In Rotated MNIST, each task is generated by the continual rotation of the MNIST images for degrees 0, 22.5, 45, 67.5, and 90, respectively, constituting 5 different tasks. For Split CIFAR-100 each task contains the data from 5 random classes (without replacement), resulting in 20 tasks. Finally, in both benchmarks, each model trains on each task for five epochs. We have selected Rotated MNIST as a domain-incremental benchmark and Split CIFAR-100 as a task-incremental benchmark to represent two common scenarios in continual learning. + +Networks. For the Rotated MNIST benchmark, we use a two-layer MLP with ReLU non-linearities in each layer and vary the width. For the Split CIFAR-100 benchmark, we use a WideResNet (WRN) with the depth of 10 (Zagoruyko and Komodakis, 2016) and different width factors which multiply the width of the layers (i.e., the number of convolutional channels) in the original WideResNet by $\{1,2,4,8\}$ . All models are trained using the SGD optimizer, and the best result for each model is reported. + +Evaluations. Following previous work (Chaudhry et al., 2018; Riemer et al., 2018; Mirzadeh et al., 2021), we report the following metrics: + +(1) Average Accuracy: The average validation accuracy + +Table 1. MLP on Rotated MNIST + +
WidthAverage AccuracyAverage ForgettingLearning AccuracyJoint Accuracy
3265.9 ±1.0036.9 ±1.2795.5 ±0.8591.2 ±0.57
12870.8 ±0.6831.5 ±0.9296.0 ±0.9093.4 ±0.66
51272.6 ±0.2729.6 ±0.3696.4 ±0.7394.1 ±0.77
204875.2 ±0.3426.7 ±0.5096.6 ±0.6194.0 ±0.45
+ +after the model has been continually trained for $T$ tasks, is defined as: + +$$ +A _ {T} = \frac {1}{T} \sum_ {i = 1} ^ {T} a _ {T, i} \tag {3.1} +$$ + +where, $a_{t,i}$ is the validation accuracy on the dataset of task $i$ after the model finished learning task $t$ . + +(2) Average Forgetting: The average forgetting is calculated as the difference between the peak accuracy and the final accuracy of each task, after the continual learning experience is finished. For a continual learning benchmark with $T$ tasks, it is defined as: + +$$ +F = \frac {1}{T - 1} \sum_ {i = 1} ^ {T - 1} \max _ {t \in \{1, \dots , T - 1 \}} \left(a _ {t, i} - a _ {T, i}\right) \tag {3.2} +$$ + +(3) Learning Accuracy: The accuracy for each task directly after it is learned. The learning accuracy provides a good representation of the plasticity of a model and can be calculated using: + +$$ +\mathrm {L A} _ {T} = \frac {1}{T} \sum_ {i = 1} ^ {T} a _ {i, i} \tag {3.3} +$$ + +(4) Joint Accuracy: The accuracy of the model trained on the combined data of all tasks together. + +# 3.2. Main Results + +Tables 1 and 2 show the main results in terms of average accuracy, average forgetting, and learning accuracy for MLP on Rotated MNIST and WideResent on Split CIFAR-100 with varying widths. It can be seen from the tables that wider networks improve both average accuracy and forgetting. + +It is important to note that reduced forgetting is not due to stabilizing the model dogmatically at the cost of plasticity. Increased average accuracy means that the wider models not only remember previous tasks better, but keep their competitive performance on the current task too. This can be further consolidated by observing the learning accuracy (LA) of the wider networks. + +Table 2. WideResNet-10 on Split CIFAR-100 + +
WidthAverage AccuracyAverage ForgettingLearning AccuracyJoint Accuracy
147.1 ±2.6037.3 ±2.6281.1 ±4.3781.4 ±0.62
249.7 ±1.5134.9 ±1.7282.9 ±5.1783.6 ±0.13
453.8 ±2.7433.8 ±2.1683.9 ±6.5384.4 ±0.64
859.7 ±2.3329.4 ±2.5287.5 ±4.1584.8 ±0.49
+ +# 4. Analysis + +In this section, we overview the reasons we believe contribute to the reduction in catastrophic forgetting when widening the network. Although wide networks have higher capacity, similar to how it has been shown that wider networks generalize well because of implicit regularization imposed by gradient descent (Jacot et al., 2018; Lee et al., 2019), we argue that the behavior of catastrophic forgetting cannot be reduced to capacity alone and we need to integrate learning dynamics. Here, we first construct a simple example for a regression problem with squared loss to demonstrate this point. Informally, we have the following claim. + +Claim 4.1 (informal). Consider learning problems with input space $\mathbb{R}^d$ , output space $\mathbb{R}$ , and squared loss. Let $\mathcal{F}_1$ be the class of linear models that maps the input to the output and $\mathcal{F}_2$ be the class of two-layer linear networks (i.e., no nonlinear activation). Then, there exist two tasks such that when we train task 2 using gradient descent, if we use model class $\mathcal{F}_1$ , the amount of forgetting for task 1 is strictly zero; whereas if we use model class $\mathcal{F}_2$ , the amount of forgetting can be positive. + +We provide details of the construction of the two tasks in Appendix C. As we can see, the two model classes $\mathcal{F}_1$ and $\mathcal{F}_2$ have exactly the same capacity, i.e., $\mathcal{F}_1 = \mathcal{F}_2$ , since there is no nonlinearity in $\mathcal{F}_2$ . However, due to the use of gradient descent algorithm, the amount of forgetting for task 1 is different for the two model classes when training on task 2. Moreover, in Appendix C, we show that if the size of a hidden layer in $\mathcal{F}_2$ is not large enough, then the forgetting could be more severe. Intuitively, if the additional layer becomes a bottleneck that projects the input to a very low dimensional space, the information can be lost. + +While this example is a specially constructed one, we believe it can be helpful towards understanding the benefits of wide neural networks in continual learning. In particular, it shows that we have to take the commonly used gradient descent algorithm into account when investigating this phenomenon. In Appendix B, we provide further empirical results regarding the significance of the width of the first layer. In the following, we dive deeper in this phenomenon and provide several potential explanations. + +![](images/a20f54d34c346012668b7f5b01711c981b554973d927c68472a374a56c74313e.jpg) +(a) MLP on Rotated MNIST + +![](images/8999b2ae30c9f436c50ecc26932312ef6913314d56f6efe01f485d51298c227f.jpg) +(b) WRN on Split CIFAR-100 +Figure 3. The angle between the gradients at the optimum of task 1, $\nabla L_{1}(w_{1}^{*})$ , and between the optimum of subsequent tasks $t$ , $\nabla L_{t}(w_{t}^{*})$ for $t > 1$ . Wider networks remain closer to 90 degree (more orthogonal). + +# 4.1. Increased Gradient Orthogonality + +Earlier works in continual learning (Farajtabar et al., 2020; Chaudhry et al., 2018; Lopez-Paz and Ranzato, 2017; Riemer et al., 2018) have focused on explicitly forcing the gradients of the new tasks to be orthogonal to those of the previous ones to reduce forgetting among the tasks. Here, we want to look at how the gradient directions of different tasks evolve as the continual learning experience progresses while the networks' width increases. We first establish why orthogonalizing the gradients of different tasks is a good continual learning strategy. + +Let us consider a two-task continual learning problem, and study the amount of forgetting for task 1 induced by one gradient descent step on task 2. Let $\mathcal{W} \subseteq \mathbb{R}^p$ be the model parameter space and $L_t(w): \mathcal{W} \mapsto \mathbb{R}$ be the training loss function of the $t$ -th task. Assuming that all the loss functions are differentiable, according to mean value theorem, we have the following simple observation. + +Claim 4.2. Let $w' = w - \eta \nabla L_2(w)$ . Then there exists $\xi \in [0,1]$ such that + +$$ +L _ {1} \left(w ^ {\prime}\right) - L _ {1} (w) = - \eta \langle \nabla L _ {1} (w - \xi \eta \nabla L _ {2} (w)), \nabla L _ {2} (w) \rangle . \tag {4.1} +$$ + +As we can see, the left hand side of Eq. 4.1 is the increase in the loss of task 1, and the right hand side is related to the inner product of the gradient of $L_{1}$ at $w - \xi \eta \nabla L_{2}(w)$ , and the gradient of $L_{2}$ at $w$ . Therefore, if the gradients of the two tasks are more orthogonal to each other, then when training on new tasks, the model forgets less about previous task. Formally, we have the following direct corollary. + +Claim 4.3. Suppose that for any $w_{1}, w_{2} \in \mathcal{W}$ with $\|w_{1}-w_{2}\|_{2} \leq \eta \sup_{w \in \mathcal{W}}\|\nabla L_{2}(w)\|_{2}$ , we have + +$$ +| \langle \nabla L _ {1} (w _ {1}), \nabla L _ {2} (w _ {2}) \rangle | \leq \epsilon / \eta , +$$ + +for some $\epsilon > 0$ , and let $w' = w - \eta \nabla L_2(w)$ . Then, we have $L_1(w') - L_1(w) \leq \epsilon$ . + +Hence, the one-step forgetting is small if we have near-orthogonal gradients for the two tasks. The next question is whether widening the network increases the gradient orthogonality. Empirically, to study the directions of the gradients for different tasks, in Figure 3, we plot the angle between the gradient vector at the minimum of the first task and that of the subsequent tasks for various width factors. For this figure, we concatenate the gradients from all the layers into one vector. It can be seen from the figure that the gradients at the minimum of subsequent tasks become more orthogonal to the gradients at the minimum of the first task as we increase the width. This trend also holds when the gradients of other tasks are used as reference (i.e.) the gradients at the minimum of tasks $>2$ also become orthogonal to the gradients at the minimum of task 2. Refer to the appendix for these results. Since the gradients of different tasks generally become more orthogonal for the wider networks, the reduction in forgetting can be attributed to this orthogonalization. + +# 4.2. Increased Gradient Sparsity + +Another scenario where forgetting may be reduced is that during the training of a new task, we only need to update a small number of model parameters, and thus the network is stable and forgets less about the previous tasks. In fact, according to Claim 4.2, we can establish the following simple corollary. + +Claim 4.4. Suppose that $\| \nabla L_2(w)\| _2\leq B$ for all $w\in \mathcal{W}$ and let $b(w)\coloneqq \sup_{\| \widetilde{w} -w\| _2\leq \eta B}\| \nabla L_1(\widetilde{w})\|_\infty$ . Let $w^{\prime} = w - \eta \nabla L_{2}(w)$ . Then we have + +$$ +L _ {1} \left(w ^ {\prime}\right) - L _ {1} (w) \leq \eta b (w) \| \nabla L _ {2} (w) \| _ {0}, +$$ + +where $\| \cdot \|_0$ denotes the number of non-zero elements in a vector. + +Therefore, increased gradient sparsity may lead to less forgetting. Figure 4 confirms this hypothesis by demonstrating + +![](images/33d482c2999c6faedba49f3797bb156c0053d212d4ab3818a67465a3e1b178ea.jpg) +(a) MLP on Rotated MNIST + +![](images/bf6d292b44feaf1730c359423b2aedb890e94f31bc2552777e9469a14dfc18c3.jpg) +(b) WRN on Split CIFAR-100 +Figure 4. Histogram of the magnitude of the elements of the gradient vector. Wider networks have sparser gradients (the histogram is more skewed towards the left). + +the histogram of the absolute value of the entries of the gradient. The gradient norm is constructed by calculating the gradients of all layers on the empirical loss of task 2, after learning task 1 and before starting task 2. From the figure, it can be seen that the wider networks have sparser gradients. This implies a smaller number of parameters needs to change to adapt to new tasks resulting in a reduced forgetting on already learned tasks. + +# 4.3. Lazy Training Regime + +In the previous two sections, we showed that the amount of forgetting induced by a single gradient descent step on a new task can be reduced by increased gradient orthogonality/sparsity. In this section, we take a different perspective and study the entire training process of a task. In the following, we denote by $w_{t}^{\mathrm{in}}$ and $w_{t}^{*}$ the initial and end model parameters for task $t$ , respectively. Note that in the continual learning scenario, the initializer for a subsequent task is in fact the solution to the previous task. Thus, $w_{t}^{\mathrm{in}} = w_{t - 1}^{*}$ . + +Let us consider the amount of forgetting of task $t - 1$ at the end of the training of task $t$ , measured by the increase in loss function $L_{t-1}$ , i.e., $L_{t-1}(w_t^*) - L_{t-1}(w_{t-1}^*)$ . Suppose that the loss function is differentiable, by mean value theorem, there exists $\xi \in [0,1]$ such that + +$$ +\begin{array}{l} L _ {t - 1} \left(w _ {t} ^ {*}\right) - L _ {t - 1} \left(w _ {t - 1} ^ {*}\right) \\ = \nabla L _ {t - 1} \big ((1 - \xi) w _ {t - 1} ^ {*} + \xi w _ {t} ^ {*} \big) ^ {\top} (w _ {t} ^ {*} - w _ {t - 1} ^ {*}), \\ \end{array} +$$ + +which yields the following upper bound on the amount of forgetting: + +$$ +\begin{array}{l} L _ {t - 1} \left(w _ {t} ^ {*}\right) - L _ {t - 1} \left(w _ {t - 1} ^ {*}\right) \\ \leq D _ {t} \sup _ {\left\{w: \| w - w _ {t - 1} ^ {*} \| _ {2} \leq D _ {t} \right\}} \| \nabla L _ {t - 1} (w) \| _ {2}, \tag {4.2} \\ \end{array} +$$ + +where $D_{t} \coloneqq \| w_{t}^{*} - w_{t - 1}^{*}\|_{2}$ is the distance the model parameter moves during the training of task $t$ . This result + +suggests the following intuitive claim: The forgetting may be less severe if the model moves a shorter distance $D_{t}$ in the parameter space. + +Interestingly, for overparametrized neural networks, the distance that the model parameter moves during SGD training can indeed be small. In their seminal papers, Jacot et al. (2018) and Lee et al. (2019) connect learning in neural networks to kernel methods and show that at the infinite width limit, the kernel doesn't change throughout the training, and the neural network evolves as a linear model under SGD training. Moreover, Chizat et al. (2019) show that these neural networks operate in lazy regime where $\| w^{*} - w^{\mathrm{in}}\|_{2}$ is very small. Since wider networks are closer to the infinite width limit, the moving distance $D_{t}$ may be smaller for wider networks and thus the forgetting is less severe. + +To confirm this intuition, in Figure 5, we plot the distance between the optimum of the first task and that of the subsequent tasks as the continual learning experience progress. In the figure, each task is trained for 5 epochs. From the figure, it can be seen that, for both MLPs and ResNets, the relative distance of the parameters for the wider networks is substantially smaller than that of the less wide networks. This confirms that lazy training of wider networks is indeed beneficial for continual learning and reduces forgetting significantly. In the same vein, Mirzadeh et al. (2020b;a) observed that changing the learning regime (i.e., imposing a learning rate decay, decreasing batch size, employing dropout, etc.) also leads to a small change in parameters from the optimum of previous tasks resulting in less forgetting. However, their work was concerned about the optimization properties of neural networks rather than architectural ones. + +# 4.4. The Case for Depth + +In Section 3, we saw that the width of the network has a beneficial effect when it comes to catastrophic forgetting. We do not see a similar monotonic reduction in forgetting + +![](images/cfa4e3176e09c7149fb42278bd4bf5ccd153ead2c5e29e7a7cabcf8a29c87e47.jpg) +(a) MLP on Rotated MNIST + +![](images/e91c15638eb1b9c56e684641a087363284e49c50c38d9f0169227e873fce3302.jpg) +(b) WRN on Split CIFAR-100 +Figure 5. The distance between $w_{1}^{*}$ , solution of task 1, and $w_{t}^{*}$ , solution of the $t$ -th task, for $t > 1$ over the course of training. Wider networks remain closer to the solution of the first task. + +when we increase the depth of the network in our experiments. In fact, we observe that with increasing depth, the forgetting increases, as shown in Figure 2. We now provide an intuitive analysis for why and when the network depth hurts the performance of a continual learning model. + +Inspired by the exploding gradients phenomena in recurrent neural networks (Bengio et al., 1994; Pascanu et al., 2013), we show that deeper networks may cause larger gradient updates in the earlier layers. Larger gradients mean that the solution for the subsequent tasks will not be found in the vicinity of the current task, which would entail increased forgetting. To establish the larger gradients for deeper networks, we use the standard argument (Bengio et al., 1994) for exploding gradients. Suppose that the network consists of $K$ feed-forward layers parameterized by weight matrices $\{W_i\}_{i=1}^K$ and non-linearities $\sigma(\cdot)$ . For ease of exposition, we ignore the biases and normalization layers in the network. The gradient on any intermediate layer $l$ can be written as: + +$$ +\begin{array}{l} \frac {\partial L}{\partial h _ {l}} = \frac {\partial L}{\partial h _ {K}}. \frac {\partial h _ {K}}{\partial h _ {l}} = \frac {\partial L}{\partial h _ {K}}. \prod_ {i = l} ^ {K - 1} \frac {\partial h _ {i + 1}}{\partial h _ {i}} \\ = \frac {\partial L}{\partial h _ {K}}. \prod_ {i = l} ^ {K - 1} \Sigma_ {i + 1} W _ {i + 1}, \\ \end{array} +$$ + +where $\Sigma_{i}$ is the diagonal Jacobian of the non-linearity at the $i$ -th layer. Note, if a ReLU non-linearity is used, then $\| \Sigma_{i} \| = 1$ , unless all the activations in the layer are negative. + +The norm of the gradient on layer $l$ can then be bounded as: + +$$ +\begin{array}{l} \left\| \frac {\partial L}{\partial h _ {l}} \right\| = \left\| \frac {\partial L}{\partial h _ {K}}. \prod_ {i = l} ^ {K - 1} \Sigma_ {i + 1} W _ {i + 1} \right\| \\ \leq \left\| \frac {\partial L}{\partial h _ {K}} \right\| \cdot \prod_ {i = l} ^ {K - 1} \| \Sigma_ {i + 1} \| \| W _ {i + 1} \| \\ \leq \left\| \frac {\partial L}{\partial h _ {K}} \right\| \cdot \prod_ {i = l} ^ {K - 1} \| W _ {i + 1} \|, \\ \end{array} +$$ + +where in the second line, we use sub-ordinate and submultiplicative properties of induced matrix norms, and in the third line, we assumed that ReLU activation is used and thus $\| \Sigma_i\| \leq 1$ . This analysis shows that the gradient norm on the earlier layers is proportional to the product of matrix norms of higher layer weights. For a 2-norm, the gradient magnitude could be bounded by the product of largest singular values $(\Lambda_{i})$ of the intermediate weight matrices: + +$$ +\left\| \frac {\partial L}{\partial h _ {l}} \right\| \leq \left\| \frac {\partial L}{\partial h _ {K}} \right\|. \prod_ {i = l} ^ {K - 1} \| \Lambda_ {i + 1} \|. \tag {4.3} +$$ + +Although, for $\Lambda_{i} > 1$ this bound is unusable, as it is an upper bound which grows exponentially, and becomes more and more loose, with $K$ (the number of layers) increasing, however, it does potentially point to a scenario when the gradients on the earlier layers could increase with the depth. This can happen when the singular values of all the intermediate weight matrices are greater than 1, i.e., $\Lambda_{i} > 1, \forall i \in \{l, \dots, K - 1\}$ . In the supplementary Figure 11, we show that this indeed is the case for the datasets and architectures considered in this work. A large gradient on earlier layers can then contribute to a larger forgetting of previous tasks. + +Figure 6a shows the norm of the gradients of layer 1 for different MLP depths. It can be seen from the figure that the gradient norm on the earlier layers increases with the depth. For example, when the network is trained for task 5, the gradient norm on layer 1 for an 8-layer network is almost three times as that of the 2-layer network. In contrast, as depicted in Figure 6b, increasing the width has a minimal or even decreasing effect on gradient norm. We note here that the deep learning community has developed numerous strategies to avoid exploding gradients (Goodfellow et al., 2016), and that extensively studying those is not the purpose here. We use the exploding gradient analysis to understand the negative effect of depths in our experiments. + +![](images/343fb6065b0a35fa0e3d703631293a6e619e364d292b85f3d32252ad58fd1df5.jpg) +(a) Gradient norm for different depths + +![](images/1ebff26e294fd39c59c4393f64a59e6a3434228f6bb1984904fbe27656d5525e.jpg) +(b) Gradient norm for different widths +Figure 6. MLP on Rotated MNIST: The gradient norm in the first layer (i.e., $\left\| \frac{\partial L_1}{\partial h_1} \right\|$ ) grows faster in deeper networks (a) while this is not the case when the width increases (b). + +Table 3. Comparing shallow and wide vs. deep and thin MLP models on Rotated MNIST. Each row in a subdivision of the table has roughly a comparable number of parameters. Shallower and wider networks have higher average accuracy and smaller forgetting than deeper and thinner networks. + +
WidthDepthParametersAverage AccuracyAverage ForgettingJoint Accuracy
1288217.35 K68.9 ±1.0735.4 ±1.3494.1 ±0.73
2562269.32 K71.1 ± 0.4331.4 ± 0.4893.9 ±0.65
2568664.08 K70.4 ±0.6132.1 ±0.7594.78 ±0.67
5122669.70 K72.6 ± 0.2729.6 ± 0.3694.08 ±0.77
+ +In conclusion, we have observed that wider networks have sparser gradients with more orthogonal gradients across tasks. In addition, the training dynamics of wide networks become more similar to the lazy training regime. Finally, the gradient norm in wide and shallow models does not increase as fast as in deeper and thinner models. + +# 5. Additional Experiments + +This section provides further empirical results on the role of width and depth in continual learning. More specifically, fixing the number of parameters, the wider and shallower models, outperform deeper and thinner ones. Moreover, we show that the benefits of increasing the width can be complementary to the benefits of algorithms. + +# 5.1. Width versus Depth + +We have already seen in Figure 1 and 2 that increasing width is beneficial while increasing depth has no such effect. However, it is interesting to answer the following question in a more direct manner: Given a fixed budget on the total number of parameters, how would a wider and shallower model perform compared to a thinner and deeper one? + +Table 4. Comparing shallow and wide vs. deep and thin WRN models on Split CIFAR-100. Each row in a subdivision of the table has roughly a comparable number of parameters. Shallower and wider networks have higher average accuracy and smaller forgetting than deeper and thinner networks. + +
DepthWidthParamsAverage AccuracyAverage ForgettingJoint Accuracy
1041.69 M53.8 ± 2.7433.8 ± 2.1683.4 ± 0.64
2821.61 M46.6 ±2.5637.1 ±2.4783.6 ± 0.54
1083.72 M59.7 ± 2.3329.4 ± 2.5284.8 ± 0.49
1643.24 M50.1 ±2.5937.0 ±2.7785.1 ± 0.45
2833.58 M49.4 ±1.8236.2 ±1.9884.7 ± 0.92
+ +To this end, we compare several architectures on both Rotated MNIST and Split CIFAR-100 benchmarks. Table 3 and 4 show that on both benchmarks, wider and shallower models outperform their thinner and deeper counterparts. Note that to make sure that the number of parameters are roughly the same, we have added some new models (e.g., MLP with a width of 256). + +# 5.2. Interacting with CL Algorithms + +We have seen that increasing width automatically reduces forgetting without the need to employ any continual learning algorithm. One may wonder if the effect of width on performance remains additive even when a specialized CL algorithm is employed. + +In Figure 7, we compare two replay-based methods, ER (Riemer et al., 2018) and A-GEM (Chaudhry et al., 2018), for various width factors using both MLPs and WideResNets. We use the replay buffer of sizes 125 (MNIST) and 100 (CIFAR-100) for both ER and A-GEM. The figure shows that, similar to vanilla fine-tuning, by increasing width, average accuracy improves, and forgetting gets reduced across the board. Hence, we conclude that the benefit of increasing the width is additive to the benefits brought by continual learning algorithms. + +![](images/111d07f10db5c7d33686b4d6e14f734d7321b7e967b459737bd31663a9e8d0f2.jpg) + +![](images/bf1476b4d85b84886dd0ad9d8db94a423912eb9a09aa7011078c48857f2b3c99.jpg) +(a) MLP on Rotated MNIST +(b) WRN on Split CIFAR-100 +Figure 7. Average accuracy (blue) and forgetting (red) of CL methods for varying widths. Similar to the naive fine-tuning case, in the presence of other CL algorithms, wider networks perform better. + +In Appendix B.7, we provide additional results for more algorithms such as Mode Connectivity SGD (Mirzadeh et al., 2021), LwF (Li and Hoiem, 2018), and EWC (Kirkpatrick et al., 2017) on Rotated MNIST. We refer the reader to (Mirzadeh et al., 2022) for additional results on other benchmarks and architectures such as CNNs, ResNets (He et al., 2016), and Vision Transformers (Dosovitskiy et al., 2021). + +# 6. Discussion and Conclusion + +In this paper, we studied a previously unexplored connection between the width of the network and catastrophic forgetting (CF)—an important bottleneck for continual learning (CL) systems. Through different experiments, we hypothesize that high orthogonality between the gradients of different tasks induced by the wider networks, increased gradient sparsity, and a lazy training regime, i.e., the decreased distance of updated parameters from their initialization are the main factors alleviating catastrophic forgetting. We highlighted the contrasts between over-parametrization with increasing width to increasing depth and argued that increasing depth might have negative consequences for forgetting while acknowledging its importance for learning representations. + +The scope of current work is to show a surprising and, at the same time, very intuitive correlation between width and forgetting. One should be cautious of utilizing increasing + +width to tackle catastrophic forgetting as it is undoubtedly an inefficient decision in terms of computation time, energy and cost. By showing the connection between width and CF, our purpose here is to enhance our basic understanding of how over-parametrization, both in terms of width and depth, interacts with catastrophic forgetting. The extent of over-parametrization should be an important factor when designing continual learning benchmarks. + +We hope this work acts as a stepping stone for studying the interaction between the inherent properties of neural networks and catastrophic forgetting. In addition to varying architecture sizes, modern neural networks employ several training tricks that are not well studied with respect to catastrophic forgetting. Understanding these effects, such as activation functions, normalization schemes, skip connections, etc., remains an interesting future work. Very recently, Mirzadeh et al. (2022) have studied the significance of architectures in continual learning. They have extended our main results for other architectures (e.g., Vision Transformers (Dosovitskiy et al., 2021)) on large-scale benchmarks. In addition, they show that the role of architecture in continual learning can be as important as the algorithms, which suggests the intersection of continual learning and neural network architecture is an interesting and under-explored research direction. + +# Acknowledgments + +The authors are grateful to Amal Rannen-Triki, Timothy Nguyen, Hooman Shahrokhi, and Anonymous Reviewers for their valuable comments and feedback on this work. + +# References + +Aljundi, R., Babiloni, F., Elhoseiny, M., Rohrbach, M., and Tuytelaars, T. (2018). Memory aware synapses: Learning what (not) to forget. In Proceedings of the European Conference on Computer Vision (ECCV), pages 139-154. +Aljundi, R., Chakravarty, P., and Tuytelaars, T. (2017). Expert gate: Lifelong learning with a network of experts. In CVPR, pages 7120-7129. +Allen-Zhu, Z., Li, Y., and Liang, Y. (2019). Learning and generalization in overparameterized neural networks, going beyond two layers. Advances in neural information processing systems. +Arora, S., Du, S. S., Hu, W., Li, Z., Salakhutdinov, R., and Wang, R. (2019). On exact computation with an infinitely wide neural net. In Proceedings of the 33rd International Conference on Neural Information Processing Systems, pages 8141-8150. +Balaji, Y., Farajtabar, M., Yin, D., Mott, A., and Li, A. + +(2020). The effectiveness of memory replay in large scale continual learning. arXiv preprint arXiv:2010.02418. +Beaulieu, S., Frati, L., Miconi, T., Lehman, J., Stanley, K. O., Clune, J., and Cheney, N. (2020). Learning to continually learn. In ECAI 2020 - 24th European Conference on Artificial Intelligence. +Bengio, Y., Simard, P., and Frasconi, P. (1994). Learning long-term dependencies with gradient descent is difficult. IEEE transactions on neural networks, 5(2):157-166. +Brown, T. B., Mann, B., Ryder, N., Subbiah, M., Kaplan, J., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., et al. (2020). Language models are few-shot learners. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020. +Chang, M., Gupta, A., Levine, S., and Griffiths, T. L. (2018). Automatically composing representation transformations as a means for generalization. In ICML workshop Neural Abstract Machines and Program Induction v2. +Chaudhry, A., Gordo, A., Dokania, P. K., Torr, P. H. S., and Lopez-Paz, D. (2021). Using hindsight to anchor past knowledge in continual learning. In *Thirty-Fifth AAAI Conference on Artificial Intelligence*, AAAI 2021. +Chaudhry, A., Khan, N., Dokania, P. K., and Torr, P. H. (2020). Continual learning in low-rank orthogonal subspaces. In Advances in Neural Information Processing Systems. +Chaudhry, A., Ranzato, M., Rohrbach, M., and Elhoseiny, M. (2018). Efficient lifelong learning with a-gem. In International Conference on Learning Representations. +Chaudhry, A., Rohrbach, M., Elhoseiny, M., Ajanthan, T., Dokania, P. K., Torr, P. H. S., and Ranzato, M. (2019). On tiny episodic memories in continual learning. arXiv preprint arXiv:1902.10486. +Chizat, L., Oyallon, E., and Bach, F. (2019). On lazy training in differentiable programming. In NeurIPS 2019-33rd Conference on Neural Information Processing Systems, pages 2937-2947. +Doan, T., Bennani, M. A., Mazoure, B., Rabusseau, G., and Alquier, P. (2021). A theoretical analysis of catastrophic forgetting through the ntk overlap matrix. In International Conference on Artificial Intelligence and Statistics. +Dosovitskiy, A., Beyer, L., Kolesnikov, A., Weissenborn, D., Zhai, X., Unterthiner, T., Dehghani, M., Minderer, M., Heigold, G., Gelly, S., et al. (2021). An image is worth 16x16 words: Transformers for image recognition at scale. In 9th International Conference on Learning Representations, ICLR, 2021. + +Du, S., Lee, J., Li, H., Wang, L., and Zhai, X. (2019). Gradient descent finds global minima of deep neural networks. In International Conference on Machine Learning, pages 1675-1685. PMLR. +Farajtabar, M., Azizan, N., Mott, A., and Li, A. (2020). Orthogonal gradient descent for continual learning. In International Conference on Artificial Intelligence and Statistics, pages 3762-3773. PMLR. +Fernando, C., Banarse, D., Blundell, C., Zwols, Y., Ha, D., Rusu, A. A., Pritzel, A., and Wierstra, D. (2017). Pathnet: Evolution channels gradient descent in super neural networks. arXiv preprint arXiv:1701.08734. +Ferran Alet, Tomas Lozano-Perez, L. P. K. (2018). Modular meta-learning. arXiv preprint arXiv:1806.10166v1. +Goodfellow, I., Bengio, Y., and Courville, A. (2016). Deep learning. MIT press. +Goodfellow, I. J., Mirza, M., Xiao, D., Courville, A., and Bengio, Y. (2013). An empirical investigation of catastrophic forgetting in gradient-based neural networks. arXiv preprint arXiv:1312.6211. +He, K., Zhang, X., Ren, S., and Sun, J. (2016). Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770-778. +Hombaiah, S. A., Chen, T., Zhang, M., Bendersky, M., and Najork, M. (2021). Dynamic language models for continuously evolving content. In KDD '21: The 27th ACM SIGKDD Conference on Knowledge Discovery and Data Mining. +Hsu, Y.-C., Liu, Y.-C., and Kira, Z. (2018). Re-evaluating continual learning scenarios: A categorization and case for strong baselines. arXiv preprint arXiv:1810.12488. +Jacot, A., Gabriel, F., and Hongler, C. (2018). Neural tangent kernel: convergence and generalization in neural networks. In Proceedings of the 32nd International Conference on Neural Information Processing Systems, pages 8580-8589. +Javed, K. and White, M. (2019). Meta-learning representations for continual learning. In Advances in Neural Information Processing Systems, pages 1820-1830. +Kaplan, J., McCandlish, S., Henighan, T., Brown, T. B., Chess, B., Child, R., Gray, S., Radford, A., Wu, J., and Amodei, D. (2020). Scaling laws for neural language models. arXiv preprint arXiv:2001.08361. +Kirichenko, P., Farajtabar, M., Rao, D., Lakshminarayanan, B., Levine, N., Li, A., Hu, H., Wilson, A. G., and Pascanu, R. (2021). Task-agnostic continual learning with + +hybrid probabilistic models. In ICML Workshop on Invertible Neural Networks, Normalizing Flows, and Explicit Likelihood Models. +Kirkpatrick, J. N., Pascanu, R., Rabinowitz, N. C., Veness, J., and et. al. (2017). Overcoming catastrophic forgetting in neural networks. Proceedings of the National Academy of Sciences of the United States of America, 114 13:3521-3526. +Krizhevsky, A., Sutskever, I., and Hinton, G. E. (2012). Imagenet classification with deep convolutional neural networks. Advances in neural information processing systems, 25:1097-1105. +Lazaridou, A., Kuncoro, A., Gribovskaya, E., Agrawal, D., Liska, A., Terzi, T., Gimenez, M., d'Autume, C. d. M., Ruder, S., Yogatama, D., et al. (2021). Pitfalls of static language modelling. arXiv preprint arXiv:2102.01951. +Lee, J., Xiao, L., Schoenholz, S., Bahri, Y., Novak, R., Sohl-Dickstein, J., and Pennington, J. (2019). Wide neural networks of any depth evolve as linear models under gradient descent. Advances in neural information processing systems, 32:8572-8583. +Li, X., Zhou, Y., Wu, T., Socher, R., and Xiong, C. (2019). Learn to grow: A continual structure learning framework for overcoming catastrophic forgetting. In Proceedings of the 36th International Conference on Machine Learning, ICML, Proceedings of Machine Learning Research. +Li, Z. and Hoiem, D. (2018). Learning without forgetting. IEEE Transactions on Pattern Analysis and Machine Intelligence, 40:2935-2947. +Lopez-Paz, D. and Ranzato, M. (2017). Gradient episodic memory for continual learning. In Advances in Neural Information Processing Systems, pages 6467-6476. +McClelland, J. L., McNaughton, B. L., and O'Reilly, R. C. (1995). Why there are complementary learning systems in the hippocampus and neocortex: insights from the successes and failures of connectionist models of learning and memory. Psychological review, 102(3):419. +McCloskey, M. and Cohen, N. J. (1989). Catastrophic interference in connectionist networks: The sequential learning problem. Psychology of Learning and Motivation, 24:109-165. +Mehta, S. V., Patil, D., Chandar, S., and Strubell, E. (2021). An empirical investigation of the role of pre-training in lifelong learning. ICML CL Workshop,. +Mirzadeh, S. I., Chaudhry, A., Yin, D., Nguyen, T., Pascanu, R., Gorur, D., and Farajtabar, M. (2022). Architecture matters in continual learning. ArXiv, abs/2202.00275. + +Mirzadeh, S. I., Farajtabar, M., and Ghasemzadeh, H. (2020a). Dropout as an implicit gating mechanism for continual learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops, pages 232-233. +Mirzadeh, S. I., Farajtabar, M., Gorur, D., Pascanu, R., and Ghasemzadeh, H. (2021). Linear mode connectivity in multitask and continual learning. In International Conference on Learning Representations. +Mirzadeh, S. I., Farajtabar, M., Pascanu, R., and Ghasemzadeh, H. (2020b). Understanding the role of training regimes in continual learning. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020. +Nguyen, C. V., Achille, A., Lam, M., Hassner, T., Mahadevan, V., and Soatto, S. (2019). Toward understanding catastrophic forgetting in continual learning. arXiv preprint arXiv:1908.01091. +Nguyen, C. V., Li, Y., Bui, T. D., and Turner, R. E. (2018). Variational continual learning. In 6th International Conference on Learning Representations, ICLR 2018. +Parisi, G. I., Kemker, R., Part, J. L., Kanan, C., and Wermter, S. (2019). Continual lifelong learning with neural networks: A review. *Neural Networks*, 113:54-71. +Pascanu, R., Mikolov, T., and Bengio, Y. (2013). On the difficulty of training recurrent neural networks. In International conference on machine learning, pages 1310-1318. PMLR. +Ramasesh, V. V., Lewkowycz, A., and Dyer, E. (2022). Effect of scale on catastrophic forgetting in neural networks. In International Conference on Learning Representations. +Rebuffi, S.-A., Kolesnikov, A. I., Sperl, G., and Lampert, C. H. (2016). icarl: Incremental classifier and representation learning. 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 5533-5542. +Riemer, M., Cases, I., Ajemian, R., Liu, M., Rish, I., Tu, Y., and Tesauro, G. (2018). Learning to learn without forgetting by maximizing transfer and minimizing interference. In International Conference on Learning Representations. +Ring, M. B. (1995). Continual learning in reinforcement environments. PhD thesis, University of Texas at Austin, TX, USA. + +Rolnick, D., Ahuja, A., Schwarz, J., Lillicrap, T. P., and Wayne, G. (2019). Experience replay for continual learning. In Advances in Neural Information Processing Systems 32: Annual Conference on Neural Information Processing Systems 2019, NeurIPS 2019. +Rosenbaum, C., Klinger, T., and Riemer, M. (2018). Routing networks: Adaptive selection of non-linear functions for multi-task learning. In International Conference on Learning Representations. +Rusu, A. A., Rabinowitz, N. C., Desjardins, G., Soyer, H., Kirkpatrick, J., Kavukcuoglu, K., Pascanu, R., and Hadsell, R. (2016). Progressive neural networks. arXiv preprint arXiv:1606.04671. +Shin, H., Lee, J. K., Kim, J., and Kim, J. (2017). Continual learning with deep generative replay. In Advances in Neural Information Processing Systems, pages 2990-2999. +Szegedy, C., Vanhoucke, V., Ioffe, S., Shlens, J., and Wojna, Z. (2016). Rethinking the inception architecture for computer vision. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 2818-2826. +Thrun, S. (1995). A lifelong learning perspective for mobile robot control. In Intelligent robots and systems, pages 201-214. Elsevier. +Titsias, M. K., Schwarz, J., Matthews, A. G. d. G., Pascanu, R., and Teh, Y. W. (2019). Functional regularisation for continual learning using gaussian processes. arXiv preprint arXiv:1901.11356. +Toneva, M., Sordoni, A., Combes, R. T. d., Trischler, A., Bengio, Y., and Gordon, G. J. (2019). An empirical study of example forgetting during deep neural network learning. In 7th International Conference on Learning Representations, ICLR 2019. +Veniat, T., Denoyer, L., and Ranzato, M. (2021). Efficient continual learning with modular networks and task-driven priors. In ICLR. +Wallingford, M., Kusupati, A., Alizadeh-Vahid, K., Walsman, A., Kembhavi, A., and Farhadi, A. (2020). In the wild: From ml models to pragmatic ml systems. *ArXiv*, abs/2007.02519. +Wortsman, M., Ramanujan, V., Liu, R., Kembhavi, A., Rastegari, M., Yosinski, J., and Farhadi, A. (2020). Supermasks in superposition. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020. + +Xu, J. and Zhu, Z. (2018). Reinforced continual learning. In Advances in Neural Information Processing Systems 31: Annual Conference on Neural Information Processing Systems 2018, NeurIPS 2018. +Yin, D., Farajtabar, M., Li, A., Levine, N., and Mott, A. (2020). Optimization and generalization of regularization-based continual learning: a loss approximation viewpoint. arXiv preprint arXiv:2006.10974. +Yoon, J., Yang, E., Lee, J., and Hwang, S. J. (2018). Lifelong learning with dynamically expandable networks. In Sixth International Conference on Learning Representations. ICLR. +Zagoruyko, S. and Komodakis, N. (2016). Wide residual networks. In *British Machine Vision Conference* 2016. British Machine Vision Association. +Zenke, F., Poole, B., and Ganguli, S. (2017). Continual learning through synaptic intelligence. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pages 3987-3995. JMLR. +Zou, D., Cao, Y., Zhou, D., and Gu, Q. (2020). Gradient descent optimizes over-parameterized deep relu networks. Machine Learning, 109(3):467-492. + +# Wide Neural Networks Forget Less Catastrophically: Supplementary Material + +# A. Experimental Setup Details + +In this section, we discuss our experimental setup, including the design choices for benchmarks, architectures, and hyperparameters. + +# A.1. Design Choices + +# BENCHMARKS + +We have chosen the rotated MNIST benchmark since it is a common benchmark in the research literature and, unlike the permuted MNIST, has a meaningful shift across tasks. The number of 5 tasks on MNIST is also typical in the literature (Farajtabar et al., 2020; Mirzadeh et al., 2020b). While the rotation of 10 degrees per task is more common in the literature, we have increased the rotation to 22.5 degrees per task make the benchmark more difficult and the performance gap between different models become more visible (Mirzadeh et al., 2021). + +While the rotated MNIST benchmark is domain-incremental, we have chosen the split CIFAR-100, which is a common task-incremental benchmark in the literature. Moreover, the split CIFAR-100 has 20 tasks, which helps support our arguments when the number of tasks increases. Our goal was to show our results in various setups such as domain versus task incremental, small versus large number of tasks, and single-head versus multi-head learning. + +# ARCHITECTURES + +On the MNIST benchmark, MLP is a popular architecture in the literature (Wortsman et al., 2020; Kirkpatrick et al., 2017). However, on the split CIFAR-100, ResNet-18 is a more popular choice (Chaudhry et al., 2021; Mirzadeh et al., 2021). However, WideResNets (WRN) have two essential properties that are more suitable for this study: first, they share similar architectural properties with ResNets (e.g., skip-connections, batch normalization layers, etc.), and second, they have the nice property of ease of scaling both width and depth. + +We note that for the experiments that involved increasing depth, we have not chosen the thinnest models as a starting point. For instance, in Fig. 2, we have used MLP with a width of 128 and WideResNet with a width of 2. The reason is to make sure that the models are not too small, so by increasing the depth, the number of parameters increases in a meaningful manner. + +# A.2. Hyperparameters + +For all experiments, we use a grid to ensure that one specific set of hyper-parameters is not favoring a specific model. Moreover, the training regime plays an important role in continual learning performance (Mirzadeh et al., 2020b). + +1. learning rate: [0.001, 0.01 (MNIST), 0.05 (CIFAR), 0.1] +2. batch size: [16, 32 (CIFAR), 64 (MLP)] +3. SGD momentum: [0.0 (MNIST), 0.8 (CIFAR)] +4. weight decay: [0.0 (MNIST), 0.0001 (CIFAR)] + +For each set of hyper-parameters, we run the model using 5 different seeds for random initialization of the models. Moreover, to ensure that the specific ordering of tasks in the split CIFAR-100 is not playing a role in the results, we also use 3 additional seeds to shuffle the ordering of tasks. + +# B. Additional Results + +# B.1. Evolution of the Average Accuracy Throughout the Learning Experience + +While tables 1 and 2 provide the "final" average accuracy across different widths, it will be interesting to also compare the "evolution" of the average accuracy in throughout of learning experience. Fig. 8a and 8b show this during the learning. + +There are a few interesting observations we can make from these results. First, the wider models perform consistently better during the learning experience. Second, the performance gap between wide and thin models is not large initially; however, as learning progresses, the gap increases. Finally, it shows that the decrease in the average accuracy due to forgetting still happens for wide models. This points out to our discussion in Sec. 6 that even though increasing width has beneficial effects, it is not the ultimate solution to continual learning. However, it will be interesting to understand the reasons behind these beneficial effects and use them in future works to design better continual learning algorithms, and this is the main objective of this study. + +![](images/3033b212ee1b6d3d74b7c0e428b638662b145103964a86c028682cc1bfc3163b.jpg) +(a) MLP on Rotated MNIST + +![](images/69f12bcb85ae6f40cdfe01b3d36300bb4891a160de64e584a4adaeddaa23d6bd.jpg) +(b) WideResNet on Split CIFAR-100 +Figure 8. Evolution of the average accuracy during the continual learning experience: while the gap is not initially large, it grows as the number of tasks increases. + +We note that while wider models learn task 1 with higher accuracy, the gap between wide and thin models grows as the number of tasks increases. For instance, in Fig. 8b, the accuracy of WRN-10-8 on task 1 is roughly $4\%$ higher than WRN-10-1. However, when the learning ends, the accuracy gap between WRN-10-8 and WRN-10-1 grows to more than $12\%$ . While part of this gap can be explained by the fact that WRN-10-8 is a better learner, we note that the majority of the gap comes from the fact that WRN-10-8 has substantially smaller forgetting, as shown in Table. 2. + +# B.2. Varying Width + +In Claim 4.1 in Sec. 4, we have theoretically studied the importance of width for a simple case. Here, we provide additional empirical evidence for the Rotated MNIST benchmark where we use a 3-layer MLP model and measure continual learning metrics for different widths (64, 256, 1024) at each layer. + +As shown in Table. 5, we show that the width of the first layer plays a more important role compared to the second and third layers, which is consistent with our analysis. While the models that have a width of 1024 in their first layer have more parameters, we note that we have already discussed in Sec. 5 that simply increasing the number of parameters is not necessarily helpful for reducing the forgetting. + +# B.3. Lazy Training Regime in Deeper Models + +In Sec. 4.3, we have discussed the role of parameter changes in the network. In Fig. 5a, we have provided empirical evidence each parameter of wide models changes less during the learning. However, one important argument could be that the norm of parameters increases as the number of parameters increases, and this might be the reason behind the result that the relative distance of wider models is smaller. However, we show in Fig. 9b that this is not the case, and the relative distance for deeper models does change as depth increases. Fig. 9a is similar to Fig. 5a and was put here for the ease comparison. + +Table 5. Performance metrics for different 3-layer MLP models on Rotated MNIST. + +
L1L2L3ParamsAverage AccuracyAverage ForgettingLearning Accuracy
64646459.2 K67.9 ±0.2837.2 ±0.5697.2 ±0.37
646425673.6 K68.5 ±0.9937.1 ±0.1897.5 ±0.67
64641024131.2 K68.1 ±0.6437.2 ±0.8297.8 ±0.28
642566484.0 K67.7 ±0.5837.6 ±0.7997.7 ±0.29
64102464183.1 K68.2 ±0.5536.9 ±0.7297.8 ±0.31
25625664283.8 K71.9 ±0.6132.8 ±0.8497.8 ±0.28
256256256335.1 K71.8 ±0.5432.9 ±0.6398.1 ±0.33
2562561024540.2 K71.4 ±0.6833.6 ±0.8398.0 ±0.37
10246464874.2 K73.1 ±0.9429.8 ±1.1097.1 ±0.72
1024641024946.2 K73.9 ±0.6929.4 ±0.7697.4 ±0.52
10241024641.92 M74.3 ±0.4028.5 ±0.5197.1 ±0.67
102410242562.12 M74.4 ±0.3528.4 ±0.5097.1 ±0.66
1024102410242.91 M75.1 ±0.4127.8 ±0.5297.3 ±0.60
+ +![](images/34435bccca1d6f2b623b1239dc047f4edefd5e9cc106f6605c20d09fd50d739d.jpg) +(a) MLP on Rotated MNIST (different widths) + +![](images/8ab6b8bed38b00e961d8c084b6fd35fba5d4bfe5555548166d94961d59db6cd1.jpg) +(b) MLP on Rotated MNIST (different depths) +Figure 9. The distance between $w_{1}^{*}$ , solution of task 1, and $w_{t}^{*}$ , solution of the $t$ -th task, for $t > 1$ over the course of training. Wider networks remain closer to the solution of the first task, but deeper models do not show the same property. + +# B.4. Detailed Results for Other Methods + +In Fig. 7 of Sec. 5, we have shown the average forgetting and accuracy of the A-GEM and Experience Replay(ER) algorithms to illustrate that the gain due to increasing width also happens in the presence of other popular continual learning algorithms. Tables 6 and 7 show the exact numbers for the mentioned figures, and we can see that by increasing width, the average accuracy increases and average forgetting decreases consistently. + +Moreover, we have included the data from tables 1 and 2 for ease of comparison. An interesting observation from these results could be that adding replay buffer or gradient manipulation by the A-GEM algorithm has an additive effect to the gain due to width. + +# B.5. Orthogonality Between Task 2 and Subsequent Tasks + +To show that our conclusion in Section 4 about orthogonality of gradients holds for the next tasks, in this section, we provide a similar figure to Fig. 3 but for task 2. In Fig. 10, we plot the angle between the gradient vector at the minimum of the second task and that of the subsequent tasks for various width factors. We can see that for wider models, the trend of gradients being orthogonal continues after learning the second task as well. + +Table 6. Rotated MNIST: the gain due to width for different CL algorithms. + +
WidthMethodAverage AccuracyAverage Forgetting
32Naive65.9 ±1.0036.9 ±1.27
128Naive70.8 ±0.6831.5 ±0.92
512Naive72.6 ±0.2729.6 ±0.36
2048Naive75.2 ±0.3426.7 ±0.50
32ER68.9 ±1.0834.6 ±1.29
128ER75.6 ±0.5527.7 ±0.72
512ER77.3 ±1.0025.9 ±1.28
2048ER78.6 ±0.4124.6 ±0.45
32A-GEM70.2 ±1.5033.0 ±1.91
128A-GEM74.1 ±0.5229.6 ±0.73
512A-GEM76.8 ±0.6226.6 ±0.74
2048A-GEM78.8 ±0.3424.3 ±0.50
+ +Table 7. Split CIFAR-100: the gain due to width for different CL Algorithms. + +
WidthMethodAverage AccuracyAverage Forgetting
1Naive47.1 ±2.6037.3 ±2.62
2Naive49.7 ±1.5134.9 ±1.72
4Naive53.8 ±2.7433.8 ±2.16
8Naive59.7 ±2.3329.4 ±2.52
1ER51.6 ±1.7424.7 ±0.86
2ER57.1 ±0.9823.1 ±1.74
4ER59.0 ±1.1020.9 ±2.45
8ER63.8 ±0.3718.8 ±0.49
1A-GEM54.2 ±0.9321.5 ±0.03
2A-GEM57.9 ±1.3220.0 ±1.11
4A-GEM60.6 ±0.2418.4 ±0.79
8A-GEM62.8 ±0.2417.7 ±0.06
+ +![](images/7ff07892c3195f4dc9a73edb18eea2a54f84613bb85f15783b57da9c3f801022.jpg) +(a) MLP on Rotated MNIST + +![](images/a523897945a09eb8ba7c3facb645187e079c76edcd2975817d925b4c4d1e4c31.jpg) +(b) WideResNet on Split CIFAR-100 +Figure 10. The degree between the gradients of task 2 and the gradients of subsequent tasks + +# B.6. Singular Values of Deeper Models + +In Eq. (4.3) of Sec. 4.4, we have discussed that one condition that impacts our analysis, is the singular values of all intermediate layers. Fig. 11a shows the singular values for our shallowest model with depth of 2, and Fig. 11b shows the values for the deepest model. We can see that the top singular values are all greater than 1. + +We note that to make the figures easier to read, we show the top-10 singular values at the end of tasks 1, 2, and 5. + +Finally, we would like to provide some clarifications on our analysis in Sec. 4.4. We note that the bound provided for the gradient norm is unusable for $\Lambda_{i} > 1$ , as it is an upper bound which grows exponentially - becomes more and more loose - with $K$ (the number of layers). The purpose of providing the analysis is to potentially point to a scenario when the gradients on the earlier layers could increase with the depth. This can happen when the singular values of all the intermediate weight matrices are greater than 1, i.e., $\Lambda_{i} > 1, \forall i \in \{l, \dots, K-1\}$ . In Fig. 11, we empirically see that this indeed is the case for Rotated MNIST tested with varying MLP depths. + +# B.7. Interacting With Additional Algorithms + +In Sec. 5.2, we have shown that similar to the naive finetuning case, when using A-GEM (Chaudhry et al., 2018), and Experience Replay, wide networks perform better for both Rotated MNIST and Split CIFAR-100 benchmarks. + +Here, we extend the result for other algorithms on Rotated MNIST (with 5 tasks). We use Mode Connectivity SGD (MC-SGD) (Mirzadeh et al., 2021), which is the state-of-the-art algorithm in continual learning, in addition to Learning without Forgetting (LwF) (Li and Hoiem, 2018) and Elastic Weight Consolidation (EWC) (Kirkpatrick et al., 2017) methods. + +![](images/20f1e7110303a91fa69ee25a35961acc05f2308dec1f7a3f44ece187a3f269a0.jpg) +(a) Rotated MNIST: depth = 2 + +![](images/ef01e8e57766a7ba39d1c5f1e1f3189ca76d8f95f61667a47f00ceb8bffcfa56.jpg) +(b) Rotated MNIST: depth $= 8$ + +![](images/86b0aab3f2008f2c6be08e00d1d182e635ddad435bb15ce60ca7a6a3975cbf80.jpg) +Figure 11. Top-10 singular values of each layer during the learning: top singular values are larger than 1. +(a) Rotated MNIST: Average Accuracy +Figure 12. Rotated MNIST: Similar to the naive fine-tuning case, in the presence of other CL algorithms, wider networks perform better. + +![](images/dbe7d0f4f51f0cf459afb971016d0f76872ed79060bcf836430d100b2661cb58.jpg) +(b) Rotated MNIST: Average Forgetting + +Fig. 12 shows that for all algorithms, by increasing the width, the average accuracy increases and average forgetting decreases. However, interestingly, the performance gain varies across algorithms, and methods such as MC-SGD and LwF benefit more from the increased width compared to other algorithms. An interesting future direction is to study this phenomenon in more detail. + +# C. Task Construction in Claim 4.1 + +Consider a learning problem where the input space is $\mathbb{R}^d$ and the output space is $\mathbb{R}$ , and two model classes, $\mathcal{F}_1, \mathcal{F}_2 \subseteq \{\mathbb{R}^d \mapsto \mathbb{R}\}$ , where $\mathcal{F}_1$ is parameterized by $w \in \mathbb{R}^d$ : + +$$ +\mathcal {F} _ {1} := \left\{f _ {w}: f _ {w} (x) = \langle x, w \rangle , w \in \mathbb {R} ^ {d} \right\}, +$$ + +and $\mathcal{F}_2$ is parameterized by $U\in \mathbb{R}^{h\times d}$ and $v\in \mathbb{R}^h$ : + +$$ +\mathcal {F} _ {2} := \left\{f: f _ {U, v} (x) = v ^ {\top} U x, U \in \mathbb {R} ^ {h \times d}, v \in \mathbb {R} ^ {h} \right\}. +$$ + +This means that $\mathcal{F}_1$ is the set of linear models, and $\mathcal{F}_2$ is the set of two-layer linear networks. Clearly, we have $\mathcal{F}_1 = \mathcal{F}_2$ , i.e., they have the same capacity, since there is no non-linearity used in $\mathcal{F}_2$ . For any model $f \in \mathcal{F}_1$ or $\mathcal{F}_2$ , and data point $(x,y) \in \mathbb{R}^d \times \mathbb{R}$ , we use the quadratic loss function $\ell(f;x,y) = \frac{1}{2}(y - f(x))^2$ . + +Now consider two tasks with training data points $\{(x_{1,i},y_{1,i})\}_{i = 1}^{n}$ and $\{(x_{2,i},y_{2,i})\}_{i = 1}^{n}$ . We denote by $X_{t} = [x_{t,i}\dots x_{t,n}]^{\top}\in \mathbb{R}^{n\times d}$ and $Y_{t} = [y_{t,i}\dots y_{t,n}]^{\top}\in \mathbb{R}^{n}$ the data matrix and label vector for task $t$ ( $t = 1,2$ ), respectively. Define the training loss function: + +$$ +L _ {t} (f) = \frac {1}{n} \sum_ {i = 1} ^ {n} \ell (f; x _ {t, i}, y _ {t, i}), \quad t = 1, 2. +$$ + +For either model class, the learner first trains the model with data for task 1, and obtains model $f_{1}$ and then after training ends, the data for task 1 are all removed. The learner then trains the model with data for task 2. Let $f_{2}$ be the model that the learner obtains after training on task 2. The forgetting metric is defined as + +$$ +\operatorname {f g t} \left(f _ {2}, f _ {1}\right) := L _ {1} \left(f _ {2}\right) - L _ {1} \left(f _ {1}\right). +$$ + +We will consider the over-parameterized regime where $d \gg n$ . We know that as long as $X_{1}X_{1}^{\top}$ is invertable, there exist models with zero loss on task 1. In this case, let us assume that the model is sufficiently trained on task 1, i.e., at the end of task 1, we have $L_{1}(f_{1}) = 0$ for both model classes. Then we train the model on task 2 using gradient descent for $T$ steps with learning rate $\eta$ . Let $w^{0}$ and $w^{T}$ be the initial and end parameters for model class $\mathcal{F}_1$ in task 2 training, respectively, and let $(U^{0}, v^{0}), (U^{T}, v^{T})$ be the initial and end parameters for model class $\mathcal{F}_2$ in task 2 training, respectively. Then we have the following claim. + +Claim C.1 (Claim 4.1 restated). There exist two tasks such that when we train task 2 using $T$ steps of gradient descent, if we use model class $\mathcal{F}_1$ , the amount of forgetting is strictly zero, i.e., + +$$ +\operatorname {f g t} \left(f _ {w ^ {T}}, f _ {w ^ {0}}\right) = 0; +$$ + +whereas if we use model class $\mathcal{F}_2$ , the amount of forgetting can be positive, i.e., + +$$ +\operatorname {f g t} \left(f _ {U ^ {T}; v ^ {T}}, f _ {U ^ {0}, v ^ {0}}\right) \geq 0. +$$ + +In particular, if $h \leq n$ , and the matrix $X_{1}(U^{0})^{\top} \in \mathbb{R}^{n \times h}$ has rank $h$ , and $v^{T} \neq v^{0}$ , then the forgetting for model class $\mathcal{F}_2$ is positive, i.e., $\mathsf{fgt}(f_{U^T;v^T}, f_{U^0, v^0}) > 0$ . + +Proof. We construct the two tasks in the following way. We assume that the input features of the two tasks satisfy + +$$ +\langle x _ {1, i}, x _ {2, j} \rangle = 0 \quad \text {f o r a l l} 1 \leq i, j \leq n, +$$ + +i.e., $X_{1}X_{2}^{\top} = 0$ . This means that the data points in the two tasks are in two orthogonal subspaces. + +When training on task 2, the learner use gradient descent algorithm with respect to the parameters. Here, we rewrite the loss function such that it becomes a function of the parameters. For model class $\mathcal{F}_1$ , we let + +$$ +L _ {2} ^ {1} (w) := \frac {1}{2 n} \| Y _ {2} - X _ {2} w \| _ {2} ^ {2}, +$$ + +and for function class $\mathcal{F}_2$ , we let + +$$ +L _ {2} ^ {2} (U, v) := \frac {1}{2 n} \| Y _ {2} - X _ {2} U ^ {\top} v \| _ {2} ^ {2}. +$$ + +Consider model class $\mathcal{F}_1$ . With learning rate $\eta$ , the parameter update rule for model class $\mathcal{F}_1$ is + +$$ +w ^ {t + 1} = w ^ {t} - \frac {\eta}{n} (X _ {2} ^ {\top} X _ {2} w ^ {t} - X _ {2} ^ {\top} Y _ {2}). +$$ + +Since $X_{1}X_{2}^{\top} = 0$ , we know $X_{1}(w^{t + 1} - w^{t}) = 0$ . Let $w^{0}$ be the model parameter that we have at the beginning of the training of task 2. Then after $T$ steps training on task 2, we have $X_{1}w^{T} = X_{1}w^{0}$ . Thus the forgetting for function class $\mathcal{F}_1$ is zero, i.e., + +$$ +\operatorname {f g t} \left(f _ {w ^ {T}}, f _ {w ^ {0}}\right) = 0. \tag {C.1} +$$ + +Now consider model class $\mathcal{F}_2$ . The parameter update rule is + +$$ +U ^ {t + 1} = U ^ {t} - \frac {\eta}{n} \left(v ^ {t} \left(v ^ {t}\right) ^ {\top} U ^ {t} X _ {2} ^ {\top} X _ {2} - v ^ {t} Y _ {2} ^ {\top} X _ {2}\right) +$$ + +$$ +v ^ {t + 1} = v ^ {t} - \frac {\eta}{n} (U ^ {t} X _ {2} ^ {\top} X _ {2} (U ^ {t}) ^ {\top} v ^ {t} - U ^ {t} X _ {2} ^ {\top} Y _ {2}). +$$ + +Suppose that the second task starts with $f_{1}$ with parameters $U^0$ and $v^0$ . We assume that task 1 is well trained, so $L_{1}(U^{0},v^{0}) = 0$ . Since $X_{1}^{\top}X_{2} = 0$ , we know that $X_{1}((U^{t + 1})^{\top} - (U^{t})^{\top}) = 0$ , thus $X_{1}(U^{t})^{\top} = X_{1}(U^{0})^{\top}$ for any $t$ . Therefore + +$$ +\begin{array}{l} \operatorname {f g t} \left(f _ {U ^ {T}, v ^ {T}}, f _ {U ^ {0}, v ^ {0}}\right) = \frac {1}{2 n} \| X _ {1} \left(U ^ {T}\right) ^ {\top} v ^ {T} - Y _ {1} \| _ {2} ^ {2} \\ = \frac {1}{2 n} \| X _ {1} (U ^ {0}) ^ {\top} v ^ {T} - Y _ {1} \| _ {2} ^ {2} \\ = \frac {1}{2 n} \| X _ {1} (U ^ {0}) ^ {\top} (v ^ {T} - v ^ {0}) \| _ {2} ^ {2} \geq 0. \\ \end{array} +$$ + +One can also easily observe that if $h \leq n$ , and the matrix $X_{1}(U^{0})^{\top} \in \mathbb{R}^{n \times h}$ has rank $h$ , and $v^{T} \neq v^{0}$ , then $\mathrm{fgt}(f_{UT,v^{T}}, f_{U^{0},v^{0}}) > 0$ . \ No newline at end of file diff --git a/wideneuralnetworksforgetlesscatastrophically/images.zip b/wideneuralnetworksforgetlesscatastrophically/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..e4a355664292e46d6d1983a659d571e516ccb4b6 --- /dev/null +++ b/wideneuralnetworksforgetlesscatastrophically/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:924ec87c8c3989fcec0130b1c8fae7d0433f214e5a583871866d15eb2d0ea72f +size 893012 diff --git a/wideneuralnetworksforgetlesscatastrophically/layout.json b/wideneuralnetworksforgetlesscatastrophically/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..67d2a163e1108145d4e1122393be39b2afbdddee --- /dev/null +++ b/wideneuralnetworksforgetlesscatastrophically/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:acf5344119af7c962f5675f56c0eecea7a89289fc3f5e1946f0ca2d9ea62d366 +size 665471 diff --git a/winningthelotteryaheadoftimeefficientearlynetworkpruning/8f02e81d-1f3b-48e2-9086-375477b71a5f_content_list.json b/winningthelotteryaheadoftimeefficientearlynetworkpruning/8f02e81d-1f3b-48e2-9086-375477b71a5f_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..d5d7a29d7a2bfe638759c8110c6169d6ac431fe4 --- /dev/null +++ b/winningthelotteryaheadoftimeefficientearlynetworkpruning/8f02e81d-1f3b-48e2-9086-375477b71a5f_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f198209c6f542980be707952ea92b9bf5d01e6d070a1a08715dcea2868c4aa04 +size 106581 diff --git a/winningthelotteryaheadoftimeefficientearlynetworkpruning/8f02e81d-1f3b-48e2-9086-375477b71a5f_model.json b/winningthelotteryaheadoftimeefficientearlynetworkpruning/8f02e81d-1f3b-48e2-9086-375477b71a5f_model.json new file mode 100644 index 0000000000000000000000000000000000000000..e27c512b1c007d04c8b49b7a17f51877dc30ca52 --- /dev/null +++ b/winningthelotteryaheadoftimeefficientearlynetworkpruning/8f02e81d-1f3b-48e2-9086-375477b71a5f_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a086778490446c2f39b27f7accfebffa48096c12708cf7bb157a670c81b1749c +size 129289 diff --git a/winningthelotteryaheadoftimeefficientearlynetworkpruning/8f02e81d-1f3b-48e2-9086-375477b71a5f_origin.pdf b/winningthelotteryaheadoftimeefficientearlynetworkpruning/8f02e81d-1f3b-48e2-9086-375477b71a5f_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..40ed42894e6d48ae9046fbe051e424b80b9e557e --- /dev/null +++ b/winningthelotteryaheadoftimeefficientearlynetworkpruning/8f02e81d-1f3b-48e2-9086-375477b71a5f_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b05c9cd71a36b3123b10406a0134763a9223e73841a1f6d33eb5e8bd87f5b04e +size 875794 diff --git a/winningthelotteryaheadoftimeefficientearlynetworkpruning/full.md b/winningthelotteryaheadoftimeefficientearlynetworkpruning/full.md new file mode 100644 index 0000000000000000000000000000000000000000..5b54c7635ae4854c93c9c86f16f8fb242ba1d79a --- /dev/null +++ b/winningthelotteryaheadoftimeefficientearlynetworkpruning/full.md @@ -0,0 +1,439 @@ +# Winning the Lottery Ahead of Time: Efficient Early Network Pruning + +John Rachwan $^{1}$ Daniel Zügner $^{1}$ Bertrand Charpentier $^{1}$ Simon Geisler $^{1}$ Morgane Ayle $^{1}$ Stephan Gunnemann $^{1}$ + +# Abstract + +Pruning, the task of sparsifying deep neural networks, received increasing attention recently. Although state-of-the-art pruning methods extract highly sparse models, they neglect two main challenges: (1) the process of finding these sparse models is often very expensive; (2) unstructured pruning does not provide benefits in terms of GPU memory, training time, or carbon emissions. We propose Early Compression via Gradient Flow Preservation (EarlyCroP), which efficiently extracts state-of-the-art sparse models before or early in training addressing challenge (1), and can be applied in a structured manner addressing challenge (2). This enables us to train sparse networks on commodity GPUs whose dense versions would be too large, thereby saving costs and reducing hardware requirements. We empirically show that EarlyCroP outperforms a rich set of baselines for many tasks (incl. classification, regression) and domains (incl. computer vision, natural language processing, and reinforcement learning). EarlyCroP leads to accuracy comparable to dense training while outperforming pruning baselines. + +# 1. Introduction + +State-of-the-art deep learning typically operates in the overparametrized regime. However, a large body of literature has shown that a high number of carefully chosen parameters can be removed (i.e. pruned) while maintaining the network's predictive performance (LeCun et al., 1990; Molchanov et al., 2017; Evci et al., 2020; Su et al., 2020; Lee et al., 2019; Wang et al., 2020). + +It was first believed that sparse networks obtained from pruning pre-trained networks cannot be retrained from scratch. However, (Frankle & Carbin, 2019) presented + +![](images/c1b8a5e17e40af58c3dbcf078dab3c28ddf837c072745cd8c9a853300ad2869a.jpg) +Figure 1. Our EarlyCroP-S provides the best trade-off between GPU RAM consumption and test accuracy, outperforming the accuracy of the dense model and other structured pruning baselines. Unstructured baselines hardly bring benefits in GPU RAM or training time, but can achieve better test accuracy, with our EarlyCroP-U reaching the highest values. Dataset: CIFAR-100, architecture: VGG16. + +the Lottery Ticket Hypothesis (LTH): randomly initialized deep neural networks contain sparse sub-networks (winning tickets) that – when trained in isolation – achieve test performance comparable to the fully trained dense model. This hypothesis suggests that we could prune a large number of a network's weights at initialization (i.e., before training) and still obtain the full performance after training. That being said, the procedure proposed in (Frankle & Carbin, 2019) involves training the dense model to convergence multiple times, which is computationally very expensive. SNIP (Lee et al., 2019) and GraSP (Wang et al., 2020) were then proposed with the goal of pruning a randomly initialized model at initialization using a sensitivity criterion for each weight. + +Due to its decreased performance on large network/dataset combinations, the LTH was later revised for very deep networks. The authors note that for training the sparse model, we need to initialize its weights to the dense model's weights from a certain point early in training (Frankle et al., 2020a). This suggests that the best performing subnetworks can be found early in training (instead of before). Finding + +the earliest point at which we can prune without losing performance is challenging, and the authors present Linear Mode Connectivity (LMC), a computationally very expensive approach involving training multiple copies of the network. This suggests that to achieve a good trade-off between performance and efficiency of finding these subnetworks, pruning should follow the same spirit as before training methods but be applied early instead. + +Besides the question of when to prune, an orthogonal dimension is structured vs. unstructured pruning. Unstructured pruning prunes individual weights (i.e., sets weight matrix elements to zero), while structured pruning removes entire neurons (i.e., rows/columns of weight matrices or convolution filters). Thus, structured pruning can reduce the training/inference time, memory footprint, and carbon emissions of the model; unstructured pruning has no significant impact on the above. On the other hand, structured pruning is generally much more challenging, and most previous works (including the LTH) perform unstructured pruning. + +Unless we maintain the learning dynamics of a neural network, pruning will hinder the learning process. The learning dynamics of a feed forward neural network can be described through the Neural Tangent Kernel (NTK) which approximately remains constant after some epochs of training in networks (Goldblum et al., 2020). If we preserve the NTK while pruning, we expect the training process to not be affected. We develop a novel and principled pruning method that preserves the Gradient Flow (GF). By leveraging the close relation of the NTK to the GF, we show that we can prune a network while keeping the effect on the NTK minimal. Furthermore, we use the connection between GF and NTK to track when the learning dynamics become stable enough to perform early pruning. + +We present Early Compression via Gradient Flow Preservation (EarlyCroP), a method for pruning a network early in training. EarlyCroP requires training the model only once, yet maintains the dense network's performance at high levels of sparsity. Thus, in the unstructured setting, EarlyCroP is about 5 times less expensive than the LTH. In addition, our method can be applied before or early in training, and extended to structured pruning. Performing structured pruning before training provides a better accuracy/efficiency trade-off than most previous structured baselines, and enables us to train sparse networks whose dense versions would not fit into the GPU. Furthermore, EarlyCroP reduces carbon emissions by up to $70\%$ without affecting dense performance and can thus help mitigate the environmental impact of deep learning and reduce training and inference costs. + +Contributions. We approach neural network pruning with the explicit goal of unlocking real-world, practical improvements. Our key contributions are: + +- **Why to prune?** We transfer a GF based pruning criterion to be applicable for structured pruning, which allows faster forward and backward passes using less GPU memory and computational cost, while surpassing baselines in test accuracy; +- How to prune? We leverage a connection between the NTK and GF by using a pruning criterion that aims to minimally affect the GF, and therefore the NTK and learning dynamics; +- When to prune? We further utilize the connection between GF and NTK to indicate the smooth transition to the lazy kernel regime, the phase during which we can prune the network with little effect on the training dynamics. Thus, this brings the cost saving of structured pruning during training as well. We also show that our method can be applied before training, reducing costs even further at only a small drop in accuracy. + +These contributions unlock substantial real-world benefits for practitioners and researchers: we can train large sparse models on commodity GPUs whose dense counterparts would be too large. We evaluate our approach extensively over a diverse set of model architectures, datasets, and tasks. + +# 2. Related work + +Pruning Criterion. In order to prune network weights, they need to be ranked according to an importance score. This concept is not new, in fact, it was introduced in 'Optimal Brain Damage' (LeCun et al., 1990) and 'Optimal Brain Surgeon' (Hassibi et al., 1993). Yet, it only regained traction when (Han et al., 2015) showed successful deep compression by pruning based on weight magnitude. Most pruning research since then has followed this approach (Zhou et al., 2019; Evci et al., 2020; Mostafa & Wang, 2019; Bellec et al., 2018; Dettmers & Zettlemoyer, 2019; Mocanu et al., 2018; You et al., 2020; Chen et al., 2020). However, the biggest drawback of using weight magnitudes is that the network needs to be trained first to achieve a good accuracy. Therefore, more recent works have focused on scoring weights without the need for training using first order (Lee et al., 2019; Tanaka et al., 2020) and second order (Wang et al., 2020; Lubana & Dick, 2021) information. Note that the pruning process can be applied in one-shot or iteratively (de Jorge et al., 2021; Verdenius et al., 2020). + +Pruning Time. Up until the introduction of the LTH (Frankle & Carbin, 2019), the consensus in the literature was that pruned models cannot be trained from scratch. Therefore, all sparse networks were extracted either from pre-trained networks (Han et al., 2015; LeCun et al., 1990; Hassibi et al., 1993; Wang et al., 2019; Li et al., 2016), or throughout training (Srinivas & Babu, 2016; Louizos et al., 2018; Evci et al., 2020; Mostafa & Wang, 2019; Bellec et al., + +2018; Dettmers & Zettlemoyer, 2019; Mocanu et al., 2018). However, the LTH showed that there exist sparse models within the original randomly initialized dense model that can achieve comparable performance to the dense model. That being said, the LTH's pruning algorithm, Iterative Magnitude Pruning (IMP), requires multiple iterations of a train-prune cycle. Nevertheless, the LTH's findings motivated works that strove to extract these sparse networks directly from the randomly initialized dense network (Su et al., 2020; Lee et al., 2019; Wang et al., 2020; de Jorge et al., 2020; Frankle et al., 2020b; Verdenius et al., 2020). + +The first method that introduced pruning before training was SNIP (Lee et al., 2019), with the goal of preserving weights that have the highest effect on the loss. A subsequent work, GraSP (Wang et al., 2020), uses the Hessian-gradient product in its score and prunes the weights with the goal of increasing the Gradient Flow (GF). Finally, Lubana & Dick (2021) show that GraSP can lead to an increasing loss and instead propose to prune the weights that least affect the GF. + +The performance of the LTH degrades with bigger networks and datasets (Frankle et al., 2020c). Subsequently, the LTH was updated to indicate that the best performing sparse models do not necessarily exist at initialization but rather that they appear early in training. + +To the best of our knowledge, the only work that explores the extraction of sparse models early in training is Early Bird Tickets (You et al., 2020). They perform structured pruning early in training when the Hamming Distance between pruning masks at subsequent epochs becomes smaller than some threshold. However, they do not offer any theoretical justification for pruning early in training and they only show their results for a maximum pruning ratio of $70\%$ , suggesting that the Hamming Distance is not an effective criterion to achieve high sparsities. + +The Early Phase of DNN Training. Another line of work aims to analyze the early phase of neural network training. Gur-Ari et al. (2018) study the Hessian eigenspectrum and observe that during training, a few large eigenvalues emerge in which gradient descent happens, whereas the rest get close to zero. However, these observations depend on the architecture. Achille et al. (2019) found that the network goes through critical training periods during which perturbing the data can cause irreversible damage to the network's final performance, after which the network becomes robust to these perturbations. However, the critical periods occur very late in the training process. Finally, Frankle et al. (2020a) propose the Linear Mode Connectivity (LMC) as a method for detecting when networks become stable to SGD noise. However, LMC is extremely expensive, requiring to train two copies of a network to completion at every epoch. + +Structured Pruning. Pruning methods are divided into + +two categories: (1) unstructured methods which generate a binary mask that is applied before every forward pass (Frankle & Carbin, 2019; Lee et al., 2019; Tanaka et al., 2020; Wang et al., 2020), and (2) structured methods that remove entire neurons or convolutional filters (Ding et al., 2019; Li et al., 2016; Louizos et al., 2018; Verdenius et al., 2020; You et al., 2019). Unstructured pruning is the more common variant for its simplicity and ease of implementation. However, since the entire dense network remains the same size, pruning does not provide improvements in GPU RAM, time, and carbon emissions. While these improvements can be obtained for unstructured pruning by using operations on sparse compressed matrices, they require significant changes to the network when dealing with advanced layers. Conversely, structured pruning reduces the size of weight matrices, thereby requiring less space, time and energy during training and inference. We highlight: (1) SNAP (Verdenius et al., 2020), which adapts the SNIP (Lee et al., 2019) score to the structured setting to prune before training, (2) Gate Decorators (You et al., 2019), which builds on top of (Liu et al., 2017) by adding a sensitivity-based criterion and pruning the network iteratively during training, and (3) EfficientConvNets (Li et al., 2016), which prunes a pre-trained network by scoring filters by their $L_{1}$ -norm. Other recent works include (He et al., 2020; 2019; Lym et al., 2019) but we omit them since GateDecorators outperforms them. + +# 3. Background + +Neural Tangent Kernel (NTK). The NTK is defined as $g_{Y}(\Theta_{t})^{T}g_{Y}(\Theta_{t})$ (Jacot et al., 2018) where $g_{Y}(\Theta_{t})$ denotes the gradient of the model prediction $Y$ w.r.t. the model parameters $\Theta_{t}$ at time $t$ . The NTK is known to accurately describe the dynamics of the network's prediction during training, under the assumption that the following Taylor expansion holds: + +$$ +Y (\Theta_ {t}) \approx Y (\Theta_ {0}) + g _ {Y} (\Theta_ {0}) ^ {T} (\Theta_ {t} - \Theta_ {0}) \qquad (1) +$$ + +Under the NTK assumption, a neural network reduces to a linear model with the Neural Tangent Kernel (NTK). The NTK assumption is particularly accurate for wide neural networks. In practice, this assumption holds (i.e. the NTK remains approximately constant) after the model training dynamic has transitioned from the rich active regime to the lazy kernel regime (see Section 4.3). + +Gradient Flow (GF). We define the GF as $g_{L}(\Theta_{t})^{T}g_{L}(\Theta_{t})$ (Lubana & Dick, 2021), where $g_{L}(\Theta_{t})$ denotes the gradient of the model loss $L$ w.r.t. the model parameters $\Theta_{t}$ . The GF is known to accurately describe the dynamics of the network's gradient norm during training, under the + +assumption that the following Taylor expansion holds: + +$$ +\begin{array}{l} g _ {L} \left(\Theta_ {t}\right) ^ {T} g _ {L} \left(\Theta_ {t}\right) = \left\| g _ {L} \left(\Theta_ {t}\right) \right\| _ {2} ^ {2} (2) \\ \approx | | g _ {L} (\Theta_ {0}) | | _ {2} ^ {2} + 2 (H _ {L} (\Theta_ {0}) g _ {L} (\Theta_ {0})) ^ {T} (\Theta_ {t} - \Theta_ {0}) (3) \\ \end{array} +$$ + +where $H_{L}(\Theta_{t})$ denote the model's Hessian at time $t$ . In order to prune the weights which least affect the GF, Lubana & Dick (2021) propose to use the following weight importance score: + +$$ +I (\Theta_ {t}) = \left| \Theta_ {t} ^ {T} H _ {L} (\Theta_ {t}) g _ {L} (\Theta_ {t}) \right|, \tag {4} +$$ + +and remove $\rho \%$ of the parameters with the lowest scores. Preserving the GF stands in stark contrast to the importance score of GraSP (Wang et al., 2020) $I_{\mathrm{GraSP}}(\Theta_t) = -\Theta_t^T H_L(\Theta_t)g_L(\Theta_t)$ , that maximizes the GF. Note that while the importance score (4) was initially used before training, we propose to use this importance score to prune during training either in one-shot or iteratively. + +# 4. Method + +The core motivation of our work is to improve the applicability of sparse neural networks w.r.t. concrete real-world metrics such as carbon emissions, price, time or memory at both training and inference time. To this end, our method first transfers the pruning criterion (4) to structured pruning, thus allowing faster forward and backward passes (see Sec. 4.1). Second, we derive a relation between the NTK and the GF suggesting that preserving the GF also preserves the NTK (see Sec. 4.2). Hence, the pruning criterion (4) is a suitable importance weight score for pruning a neural network once the NTK assumption holds i.e. in the lazy kernel regime. Third, our method detects when we enter the lazy kernel regime to prune early in training without impacting the training dynamics (see Sec. 4.3), thereby extending the cost saving of our (structured) sparse neural networks to the training phase while achieving a high test accuracy. + +# 4.1. Why to prune? + +The main use case of unstructured pruning is to highlight the overparametrized nature of neural networks. In particular, while dense-like sparsity for deep learning (Zhou et al., 2021) is a promising research direction, it suffers from multiple downsides: (a) models are typically only sparsified in the forward pass and hence dense-like sparsity has limited potential in speeding up training. (b) Not all deep learning frameworks (e.g. PyTorch) support it. (c) Only the newest GPUs (starting Nvidia Ampere 2020) support dense-like sparsity. + +In order to really benefit from pruning, we need to prune full structures (neurons and channels) instead. This reduction in dimensions/channels directly translates into lower computational cost on existing GPUs without further + +implementation efforts or any usage of any specialized tensor operations. Thus, this leads to a sparse model that provides improvements in time, memory and carbon emissions. Combined with the fact that we can apply our pruning method before and early in training, we can drastically reduce not only model costs after training but during training as well (see Sec. 4.3). + +In order to achieve structured pruning, we need to score entire nodes instead of individual weights, i.e. generate a score for a node's activation function $f_{l}$ . However, since $f_{l}$ is simply a function and not a learnable parameter, we cannot use pruning score (4) directly. Instead, similarly to Verdenius et al. (2020), we define auxiliary gates of a layer $l$ by $c_{l} = 1$ over each node's input, which in turn will act as a learnable parameter whose gradient information represents the activation's information. We can formally define this for a linear layer $l$ with weight $\Theta_{l}$ and bias $b_{l}$ and an input $x$ in the following way: + +$$ +f _ {l} \left(\Theta_ {l} * x + b _ {l}\right) = f _ {l} \left(c _ {l} \left(\Theta_ {l} * x + b _ {l}\right)\right) \tag {5} +$$ + +$$ +I \left(f _ {l}\right) = \left| H _ {L} \left(c _ {l}\right) g _ {L} \left(c _ {l}\right) \right| \tag {6} +$$ + +After scoring the nodes using the auxiliary gates, the pruning process follows the original one by removing $\rho \%$ of nodes. + +# 4.2. How to prune? + +In this section, we draw an important connection between GF and NTK showing that pruning the weights with the lowest importance score (4) aims at preserving the training dynamics of both the network's gradient norm and the network's prediction during training. First, we observe that GF and NTK are connected by the following relation: + +$$ +\begin{array}{l} G F = g _ {L} \left(\Theta_ {t}\right) ^ {T} g _ {L} \left(\Theta_ {t}\right) (7) \\ = g _ {L} (Y) ^ {T} g _ {Y} \left(\Theta_ {t}\right) ^ {T} g _ {Y} \left(\Theta_ {t}\right) g _ {L} (Y) (8) \\ = g _ {L} (Y) ^ {T} N T K g _ {L} (Y) (9) \\ \end{array} +$$ + +Second, Lubana & Dick (2021) present evidence that preserving the GF also implicitly preserves the model loss $L(\Theta_t)$ . In particular, preserving the GF also preserves the gradient of the loss w.r.t. the prediction $g_{L}(Y)$ . Hence, the relation (7) and the preservation $g_{L}(Y)$ imply that the NTK is also preserved when the GF is preserved. + +Furthermore, given that Taylor expansions (1) and (3) hold, the pruning criteria (4) which preserves the GF – which maintains the gradient-norm dynamics – is also preserving the NTK – which maintains the prediction dynamics. This remark is crucial since while the dynamics of the neural network's predictions during training can be approximated well by (1) during the lazy kernel regime, this approximation might not be accurate during the rich active regime. + +# 4.3. When to prune? + +First, we show in an introductory experiment that the pruning time has an important impact on the final accuracy of the pruned model. Hence, we train multiple ResNet50 models on CIFAR100 and prune each to $98\%$ from epoch 0 (i.e. before pruning) to epoch 80 (see Fig.2). We observe that (1) the longer we train the dense model before pruning, the higher the final accuracy of the sparse model, and most importantly (2) after a certain point in time, further training of the dense model before pruning does not bring significant improvement on the final accuracy. Indeed, we observe a $3\%$ improvement in the final accuracy of the sparse model when pruning at epoch 1 of training instead of before training, an $11\%$ improvement when pruning at epoch 26, and no great improvement when pruning after epoch 30. + +We now introduce the pruning time detection score used by EarlyCroP which is motivated from both practical and theoretical perspectives. EarlyCroP aims to detect the best time for pruning in two steps: (1) at every epoch we compute the pruning time score + +$$ +\Delta_ {0} ^ {t} = \left| \left| \Theta (t) - \Theta (0) \right| \right| ^ {2}, \tag {10} +$$ + +and, (2) if the difference of the scores at two subsequent epochs relative to the initial score $\Delta_0^1$ is smaller than a defined threshold $th$ , + +$$ +\frac {\left| \Delta_ {0} ^ {t} - \Delta_ {0} ^ {t - 1} \right|}{\left| \Delta_ {0} ^ {1} \right|} < t h \tag {11} +$$ + +we run the EarlyCroP pruning algorithm described in Algorithm 1. It can be clearly deduced that the smaller the pruning time score, the more negligible the second order term in eq. 3 will be, making the latter a good approximation. Additionally, by the triangle inequality, we can extract the following upper bound from 11 + +$$ +\frac {\left| \Delta_ {0} ^ {t} - \Delta_ {0} ^ {t - 1} \right|}{\left| \Delta_ {0} ^ {1} \right|} \leq \frac {\left\| \Theta (t) - \Theta (t - 1) \right\|}{\left\| \Theta (1) - \Theta (0) \right\|} \tag {12} +$$ + +which is expected to lie in $[0,1]$ when weights change less significantly over time. Hence, the scale of the threshold is expected to be similar for different models and datasets. The complexity of computing the score is $\mathcal{O}(m)$ where $m$ is the number of model parameters, thus incurring only minor computation overhead at every epoch to detect the pruning time. + +From a theoretical perspective, the pruning time detection algorithm's goal is to detect when the linearization of the prediction dynamics (1) assumed by the NTK holds during training. In the early phase of training called rich active regime, neural network parameters move to a significant distance from the initial weights. Thus the linearization of the prediction dynamics (1) usually does not hold in + +early training epochs and the NTK quickly changes. This rich active regime is crucial to achieve high performance, in particular for deep models (Woodworth et al., 2020). In the second phase of training called lazy kernel regime, the parameters move by a small distance, thus making the linearization (1) a good approximation of the training dynamics of the predictions (Sun, 2019). Since our importance weight score (4) assumes the linearization (1), the best moment to prune is when the model transitions to the lazy kernel regime during which the NTK is approximately constant. Further, previous works (Sun, 2019; ichi Amari, 2020; Ghorbani et al., 2020) showed that constancy of the NTK is a consequence of a constant weight norm during training. The transition to the lazy kernel training regime is gradual and can be detected when the relative change in the weight norm from initialization $\Delta_0^t$ becomes roughly constant i.e. when $\frac{|\Delta_0^t - \Delta_0^{t-1}|}{|\Delta_0^1|}$ becomes very close to 0. + +In practice, we expect the pruning time criteria to be a reliable indicator of the final accuracy of the pruned model. Indeed, we observed that the detection score correlates well with the final test accuracy of the sparse model (see Fig.2). It can be clearly seen that the smaller the detection score at the moment of pruning, the higher the final test accuracy of the pruned model. In practice, we observed in Fig. 2 and in Fig. 8 in the appendix that pruning to higher sparsities benefits more from longer training. Therefore, we use $th = 1 - \rho$ which connects the time pruning threshold $th$ to the target sparsity $\rho$ . As desired, a higher target sparsity $\rho$ leads to longer dense training (see Fig.8) + +![](images/6fd925b02c67258bcbf114eb98e1c4ecdbd2bd59e99b77b283faf2d02e12e4d3.jpg) +Figure 2. ResNet50 pruned to sparsity $98\%$ at different points during training on CIFAR10 plotted against the final test accuracy of the pruned model after 200 epochs of training (purple) and the difference between the Relative Weight Change in two subsequent epochs (blue). $\star$ denotes when the Relative Weight Change in two subsequent epochs is below the threshold $th = 1 - \rho$ . + +# 5. Empirical Evaluation + +We now show the effectiveness of our EarlyCroP for structured pruning (EarlyCroP-S) and unstructured pruning + +(EarlyCroP-U). For this we determine the point for early pruning as described in Section 4.3. We use CroP as our pruning criterion before training and CroPit if pruning is additionally performed iteratively. We use a cloud instance of GTX 1080 TIs for all experiments. Further details about the experimental setup can be found in the appendix. The code and further supplementary material is available online1. + +Image Classification. The datasets used for Image Classification are the common public benchmarks CIFAR10 (Krizhevsky & Hinton, 2009), CIFAR100 (Krizhevsky & Hinton, 2009), and Tiny-Imagenet (Deng et al., 2009). Regarding networks, we use ResNet18, VGG16, ResNeXt-101 32x16d and ResNeXt-101 32x48d. For unstructured pruning baselines, we use random pruning, SNIP (Lee et al., 2019), GraSP (Wang et al., 2020), and LTR (Frankle et al., 2020a). For structured pruning baselines, we use random pruning, EfficientConvNets (Li et al., 2016), GateDecorators (You et al., 2019), and SNAP (Verdenius et al., 2020). All models are trained for 80 epochs, except LTR which re-trains the network up to 10 times. We report train and test accuracy, weight and node sparsity, batch and total training time in seconds, GPU memory in GB, disk size in MB, carbon emitted from the extraction and training of the sparse model using CodeCarbon (Schmidt et al., 2021) in grams. Note that total training time includes the time to find and train the sparse model. + +Regression. We evaluate a Fully Convolutional Residual Network (Laina et al., 2016) on the NYU Depth Estimation task (Nathan Silberman & Fergus, 2012). We compare EarlyCroP-S and EarlyCroP-U against all unstructured baselines since they are stronger than the structured baselines. All pruned models are trained for 10 epochs. We report the performance using the Root Mean Squared Error (RMSE). + +Natural Language Processing (NLP). We evaluate the Pointer Sentinel Mixture Model(Merity et al., 2017) on the PTB language modeling dataset(Marcus et al., 1993). We compare EarlyCroP-S and EarlyCroP-U to all unstructured baselines since they are stronger than the structured baselines. We train the pruned models for 30 epochs and we report the achieved log perplexity. + +Reinforcement Learning (RL). We use the FLARE framework (Akbik et al., 2019) to evaluate a simple 3-layer FCNN with layer size 256 using the A2C algorithm on the classic control game CartPole-v0 (Brockman et al., 2016). We run 20 agents with 640 games each. We compare our EarlyCroPS and EarlyCroP-U against LTR and Random baselines. All pruned models are trained for 30 epochs. We report the performance of the pruned models using the average returned environment reward. + +# 5.1. Image Classification + +Accuracy. We present the accuracy over different sparsity levels for the model-dataset combinations ResNet18/ CIFAR10, ResNet18/Tiny-Imagenet, VGG16/CIFAR10, and VGG16/CIFAR100 in Figure 3 a-d, respectively. Our methods EarlyCroP-S and EarlyCroP-U consistently outperform all other methods but the LTR, where we perform on par. However, as will be discussed later, the LTR comes with a 3-5 times higher training time than the dense model while our methods reduce training time. There are two further exceptions when it comes to the best accuracy on ResNet18/Tiny-Imagenet. First, GateDecorators performs as well as EarlyCroP-S. Second, for lower sparsity rates, EarlyCroP-U is outperformed by some methods that prune before training. + +Structured vs. Unstructured. EarlyCroP-S closes the accuracy gap of existing approaches between unstructured and structured pruning on CIFAR10 dataset. However, a gap remains for the larger and more complex datasets CIFAR100 and Tiny-Imagenet. Nevertheless, structured pruning can be used to reduce the training time and memory requirements. This also implies that with our EarlyCroP-S we can use a larger model while saving compute (see Sec. 5.2). + +Training cost. In Tables 1 & 2 we complement the accuracy with the training time, batch time, GPU RAM, Disk space and $\mathrm{CO}_{2}$ emissions for a sparsity of $95\%$ on ResNet18/CIFAR10 and $98\%$ on VGG16/CIFAR10 respectively. We see that our EarlyCroP-S is not only preserving the high accuracy but also comes with significant improvement in training time (33% and $36\%$ resp.) and time per batch (39% and $61\%$ resp.). It is as efficient as the other structured pruning methods or outperforms them. When only considering the $\mathrm{CO}_{2}$ footprint, CroPit-S and SNAP outperform methods that prune later in training. In the appendix, we also give details about different model-dataset combinations. In summary, the stated observations also hold for the other evaluated model-dataset combinations. + +Pruning early vs. before. Pruning early in training (i.e. when we enter the lazy kernel regime) outperforms pruning before training. Our EarlyCroP-S and EarlyCroP-U have a clear edge over the methods that prune before training. This is even true if we use the same pruning criterion (CroP) and additionally prune iteratively (CroPit). The only drawback of pruning early in training vs. before is that for the first epochs we either require more GPU RAM or need to reduce the batch size. For the model size on disk we do not find a significant difference among pruning methods. + +# 5.2. Pruning a Large Model + +The goal of this experiment is two-fold: we show that (1) our criterion can be used to prune large models that don't + +
CroP-U (Before)CroP-S (Before)-----Random-U/S (Before)----LTR (After)----SNAP(Before)
CroPit-U (Before)CroPit-S (Before)-----GRASP (Before)----EfficientConvNets (After)----GateDecorators (After)
EarlyCroP-U (Early)EarlyCroP-S (Early)-----SNIP (Before)
+ +![](images/19933ca9a7380c43dc71ac1c2c1ef7895010bd32629d237e1ce68f12d4ab7b6f.jpg) +(a) + +![](images/1f7552c3f877c4522cf422bcc0f12e8674de4dec4ae774b5b0c4eb4760963336.jpg) +(b) + +![](images/54c86c1fae7902b1fe8cd49a1ba60a29769a5a8e119b806f11dd3a5812996704.jpg) + +![](images/02318a1db81cb6ca6fdd88053fcfaf8ecf152d882129dc91449fa53a13d942e0.jpg) +(c) + +![](images/200b291e6228d815b9bc991fd173f948ae497f6dbba112d876e80e422a32bafb.jpg) +Figure 3. Structured (Left) and Unstructured (Right) test accuracy for ResNet18/CIFAR10 (a), ResNet18/Tiny-Imagenet (b), VGG16/CIFAR10 (c), and VGG16/CIFAR100 (d) with increasing weight sparsity. + +![](images/7ebd32e271754f182abe66e76c183061d27abcfb68da33d9df1caea82998fb36.jpg) +(d) + +Table 1. Comparison between different pruning criteria on ResNet18/CIFAR10 at $95\%$ sparsity, averaged over three runs. Since for structured pruning we cannot precisely control the weight sparsity, we show results closest to $95\%$ weight sparsity. $\pm$ denotes standard deviation, and $\uparrow/\downarrow$ indicate metrics where higher/ lower is better. Bold/underline indicate best/second best results. GPU RAM and Disk correspond to those of the final pruned model. + +
MethodTest accuracy ↑Weight sparsityNode sparsityTraining time (h) ↓Batch time (ms) ↓GPU RAM (GB) ↓Disk (MB) ↓Emissions (g) ↓
StructuredDense91.5% ± 0.12--0.781092.3839883
Random-S86.3% ± 0.0693.7%75.0%0.68820.6224.938
SNAP87.6% ± 0.9493.6%72.6%0.70810.6325.439
CroP-S87.5% ± 0.3693.6%72.3%0.67910.6325.443
CroPit-S87.8% ± 0.3395.0%74.5%0.520.480.5919.635
EarlyBird84.3% ± 0.3295.3%65.0%0.48720.5819.155
EarlyCroP-S91.0% ± 0.5295.1%65.8%0.52660.5619.268
GateDecorators87.3% ± 0.0995.7%73.7%0.72830.5817.254
EfficientConvNets70.5% ± 0.5395.9%79.7%0.77830.7625.463
UnstructuredRandom-U84.9% ± 0.2495.0%-0.781022.8612.079
SNIP88.2% ± 0.5795.0%-0.791052.8612.080
GRASP88.4% ± 0.1395.0%-0.791062.8412.081
CroP-U87.9% ± 0.1695.0%-0.751072.8812.079
CroPit-U89.1% ± 0.2495.0%-0.801132.8812.087
EarlyCroP-U91.1% ± 0.2395.0%-0.74972.8612.083
LTR91.5% ± 0.2695.0%-1.941112.5112.0202
+ +Table 2. Comparison between different pruning criteria on VGG16/CIFAR10 at $98\%$ sparsity. Since for structured pruning we cannot precisely control the weight sparsity, we show results closest to $98\%$ weight sparsity. $\uparrow/\downarrow$ indicate metrics where higher/ lower is better. Bold/ underline indicate best/ second best results. GPU RAM and Disk correspond to those of the final pruned model. + +
MethodTest accuracy ↑Weight sparsityNode sparsityTraining time (h) ↓Batch time (ms) ↓GPU RAM (GB) ↓Disk (MB) ↓Emissions (g) ↓
-Dense90.2%--1.822901.021720246
StructuredRandom-S89.3%98.0%86.1%0.67820.2333.643
SNAP89.8%98.2%89.0%0.68890.223055
CroP-S91.1%98.0%88.0%0.71910.2333.683
CroPit-S92.4%98.0%88.0%0.811120.2330.4100
EarlyBird85.9%98%89 %0.521100.3236.2160
EarlyCroP-S93.0%98.0%89.0%1.161120.6336.0156
GateDecorators90.0%98.0%87.0%1.071110.2337.8143
EfficientConvNets84.2%98.0%86.0%1.66890.6434.2209
UnstructuredRandom-U88.5%98.0%-2.031591.2235.0247
SNIP90.1%98.0%-2.021571.2235.0248
GRASP92.0%98.0%-2.031571.2335.0249
CroP-U91.8%98.0%-2.021571.2235.0248
CroPit-U91.6%98.0%-2.021571.2235.0249
EarlyCroP-U93.0%98.0%-2.011571.2235.0250
LTR93.6%98.0%-4.071581.2235.0592
+ +fit on commodity GPUs, and (2) the resulting sparse model matches the performance of the dense one, and outperforms a dense model of the same size. To this end, we introduce the ResNext101_32x48d as our large model, a network that has 829 Million parameters and requires 15.5 GB to be loaded into GPU memory; exceeding the memory of common GPUs such as the RTX 3080 Ti. Nevertheless, with our method we can still efficiently train such a large model. For this, we perform one initial pruning step before training using the CPU and then continue on a commodity GPU as usual. We also introduce the ResNext101_32x16d as our smaller dense model which has 193 Million parameters and requires 3.9 GB to be loaded into GPU memory. The results of the experiment are depicted in Table 3. + +First, we observe that the large ResNext101_32x48d pruned to $98.5\%$ weight sparsity matches the performance of its dense counterpart in test accuracy. Moreover, training the sparse subnetwork has a 14 times smaller carbon footprint, is 7 times faster to train, is 192 times smaller on disk, and takes 4.9 times less GPU memory than the large dense model. Interestingly, the pruned model also outperforms the ResNext101_32x16d model of the same size, while training 6.2 times faster and emitting 9.5 times less carbon. Finally, we show that when training for more epochs, the sparse model achieves an even bigger performance gap compared to both dense models while still taking less total training time. This experiment not only shows that CroP-S makes training large models on commodity machines possible, but can extract sparse models that are more efficient and more + +accurate compared to dense models of the same size. + +Table 3. Comparison of a pruned ResNext101_32x48d (RN48) model and a similar sized dense ResNext101_32x16d (RN16) model (CIFAR10). RN48-S are models pruned with CroP-S. + +
ModelTest acc.Weight sparsityNode sparsityEpochsTraining time (h)VRAM (GB)Emissi- ons (g)
RN4892.4%--304.6018.84634
RN1692.1%--304.023.89445
RN48-S92.5%98.5%89.9%300.643.5647
RN48-S93.2%98.5%89.9%802.603.56194
+ +# 5.3. Regression + +Regarding Regression, we can see from Figure 5 that both variants of EarlyCroP preserve the dense model's RMSE even at $99.9\%$ weight sparsity. All Before training methods except GraSP have an instant increase to 0.20 RMSE with continuous decline at higher sparsities. Surprisingly, Random Pruning outperforms GraSP at all pruning ratios. This is due to GraSP pruning entire layers and limiting the network's learning capabilities. + +# 5.4. Natural Language Processing + +NLP presents itself as the most challenging out of all evaluated tasks. Nevertheless, both versions of EarlyCroP outperform all other baselines until $89\%$ sparsity (see Figure 6). Beyond that, the unstructured version is on par or slightly + +![](images/c90d338349d3852594316dcf2bac0aac2083c94e5d87b98fa9e31c1a41ec3815.jpg) +Figure 4. Sparse model performance on the classic control game Cartpole-v0 in average reward (higher is better) + +![](images/a2b4b97a1c31385fd4a88d4966874ef7ad3d50327d1aa6b1c43c71c60c24337f.jpg) +Figure 5. Sparse model performance on the NYU Depth Estimation task in RMSE (lower is better) + +better than other unstructured baselines whereas the structured version continues to outperform all compared baselines. In this task, the importance of early pruning is accentuated by the large gap between the early and before versions of CroP. Interestingly, LTR performs very poorly compared to all other baselines on all reported pruning ratios. Indeed, certain layers in the PSMM network converge to small weight magnitudes during training compared to the rest of the network. This means that any pruning method relying solely on the weight magnitudes, and operating at a global scale in the network, would prune these layers entirely, leading to an untrainable network. Thus, this experiment highlights the importance of gradient-based information when evaluating the importance of model parameters. We show additional NLP results by evaluating BERT on multiple language tasks (see Appendix E.2). + +![](images/9cfa2e338d98599cb4303f6c522caad91abbddf4987b72141021dfb36cd8f3de.jpg) +Figure 6. Sparse model performance on the PTB language modelling task in log perplexity (lower is better) + +# 5.5. Reinforcement Learning + +We can observe from Figure 4 that EarlyCroP outperforms LTR in both the structured and unstructured setting. Note that the EarlyCroP-S once again outperforms its unstructured counterpart. However, if we allow the unstructured models to train for a longer time, they achieve similar performance to the structured version. This can be explained by the ease of training of structured models, which are still fully-connected models where all computed gradients contribute to the weight updates, whereas unstructured models compute gradients that are not used by the pruned weights, rendering the training slower. + +# 6. Conclusion + +We have demonstrated that, for vision, NLP, and RL tasks, EarlyCroP-U extracts winning tickets matching and often outperforming those found by the LTR by pruning early in training when the model enters lazy kernel training. Additionally, we showed that EarlyCroP-S outperforms other structured methods, providing the best trade-off between final test accuracy and efficiency in terms of time, space, and carbon emissions. Finally, we show that we can use CroP-S to train models that do not fit on commodity GPUs by extracting sparse models that preserve the initial model's performance and outperform a similarly sized dense model for the same number of epochs. Thus, our methods bring tangible real-world benefits for researchers and practitioners. We hope that the results shown in this paper motivate more research on the study of structured pruning in the early phase of DNN training. + +# References + +Achille, A., Rovere, M., and Soatto, S. Critical learning periods in deep neural networks, 2019. 3 +Akbik, A., Bergmann, T., Blythe, D., Rasul, K., Schweter, S., and Vollgraf, R. Flair: An easy-to-use framework for state-of-the-art nlp. In *NAACL* 2019, 2019 Annual Conference of the North American Chapter of the Association for Computational Linguistics (Demonstrations), 2019. 6 +Bellec, G., Kappel, D., Maass, W., and Legenstein, R. Deep rewiring: Training very sparse deep networks. In International Conference on Learning Representations, 2018. 2 +Brockman, G., Cheung, V., Pettersson, L., Schneider, J., Schulman, J., Tang, J., and Zaremba, W. Openai gym, 2016. 6 +Buluç, A., Fineman, J. T., Frigo, M., Gilbert, J. R., and Leiserson, C. E. Parallel sparse matrix-vector and matrix-transpose-vector multiplication using compressed sparse blocks. In Proceedings of the Twenty-First Annual Symposium on Parallelism in Algorithms and Architectures, SPAA '09, 2009. 3 +Chen, T., Frankle, J., Chang, S., Liu, S., Zhang, Y., Wang, Z., and Carbin, M. The lottery ticket hypothesis for pretrained bert networks. Advances in Neural Information Processing Systems, 2020. 2 +de Jorge, P., Sanyal, A., Behl, H. S., Torr, P. H., Rogez, G., and Dokania, P. K. Progressive skeletonization: Trimming more fat from a network at initialization. arXiv preprint arXiv:2006.09081, 2020.3 +de Jorge, P., Sanyal, A., Behl, H., Torr, P., Rogez, G., and Dokania, P. K. Progressive skeletonization: Trimming more fat from a network at initialization. In International Conference on Learning Representations, 2021. 2 +Deng, J., Dong, W., Socher, R., Li, L.-J., Li, K., and Fei-Fei, L. Imagenet: A large-scale hierarchical image database. In 2009 IEEE Conference on Computer Vision and Pattern Recognition, 2009. 6, 2, 3 +Dettmers, T. and Zettlemoyer, L. Sparse networks from scratch: Faster training without losing performance. arXiv preprint arXiv:1907.04840, 2019. 2, 3 +Ding, X., Ding, G., Guo, Y., and Han, J. Centripetal sgd for pruning very deep convolutional networks with complicated structure. In 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2019. 3 + +Evci, U., Gale, T., Menick, J., Castro, P. S., and Elsen, E. Rigging the lottery: Making all tickets winners. In Proceedings of the 37th International Conference on Machine Learning, Proceedings of Machine Learning Research, 2020. 1, 2 +Frankle, J. and Carbin, M. The lottery ticket hypothesis: Finding sparse, trainable neural networks. In International Conference on Learning Representations, 2019. 1, 2, 3 +Frankle, J., Dziugaite, G. K., Roy, D., and Carbin, M. Linear mode connectivity and the lottery ticket hypothesis. In Proceedings of the 37th International Conference on Machine Learning, Proceedings of Machine Learning Research, 2020a. 1, 3, 6 +Frankle, J., Dziugaite, G. K., Roy, D. M., and Carbin, M. Pruning neural networks at initialization: Why are we missing the mark? arXiv preprint arXiv:2009.08576, 2020b.3 +Frankle, J., Dziugaite, G. K., Roy, D. M., and Carbin, M. Stabilizing the lottery ticket hypothesis, 2020c. 3 +Ghorbani, B., Mei, S., Misiakiewicz, T., and Montanari, A. Linearized two-layers neural networks in high dimension, 2020. 5 +Goldblum, M., Geiping, J., Schwarzschild, A., Moeller, M., and Goldstein, T. Truth or backpropaganda? an empirical investigation of deep learning theory, 2020. 2 +Gur-Ari, G., Roberts, D. A., and Dyer, E. Gradient descent happens in a tiny subspace. arXiv preprint arXiv:1812.04754, 2018.3 +Han, S., Pool, J., Tran, J., and Dally, W. Learning both weights and connections for efficient neural network. In Advances in Neural Information Processing Systems, 2015. 2 +Hassibi, B., Stork, D. G., and Wolff, G. J. Optimal brain surgeon and general network pruning. In IEEE International Conference on Neural Networks, 1993. 2 +He, Y., Liu, P., Wang, Z., Hu, Z., and Yang, Y. Filter pruning via geometric median for deep convolutional neural networks acceleration. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2019. 3 +He, Y., Dong, X., Kang, G., Fu, Y., Yan, C., and Yang, Y. Asymptotic soft filter pruning for deep convolutional neural networks. IEEE Transactions on Cybernetics, 50(8): 3594-3604, 2020. doi: 10.1109/TCYB.2019.2933477. 3 + +ichi Amari, S. Any target function exists in a neighborhood of any sufficiently wide random network: A geometrical perspective, 2020. 5 +Jacot, A., Hongler, C., and Gabriel, F. Neural tangent kernel: Convergence and generalization in neural networks. In NeurIPS, 2018. 3 +Kingma, D. P. and Ba, J. Adam: A method for stochastic optimization. In *ICLR (Poster)*, 2015. 2 +Krizhevsky, A. and Hinton, G. Learning multiple layers of features from tiny images. Master's thesis, Department of Computer Science, University of Toronto, 2009. 6, 2 +Laina, I., Rupprecht, C., Belagiannis, V., Tombari, F., and Navab, N. Deeper depth prediction with fully convolutional residual networks. In 3D Vision (3DV), 2016 Fourth International Conference on. IEEE, 2016. 6 +LeCun, Y., Denker, J. S., and Solla, S. A. Optimal brain damage. In Advances in Neural Information Processing Systems 2. 1990. 1, 2 +Lee, N., Ajanthan, T., and Torr, P. SNIP: Single-shot network pruning based on connection sensitivity. In International Conference on Learning Representations, 2019. 1, 2, 3, 6 +Li, H., Kadav, A., Durdanovic, I., Samet, H., and Graf, H. P. Pruning filters for efficient convnets. 2016. 2, 3, 6 +Liu, Z., Li, J., Shen, Z., Huang, G., Yan, S., and Zhang, C. Learning efficient convolutional networks through network slimming, 2017. 3 +Louizos, C., Welling, M., and Kingma, D. P. Learning sparse neural networks through $l_{0}$ regularization. In International Conference on Learning Representations, 2018. 2, 3 +Lubana, E. S. and Dick, R. A gradient flow framework for analyzing network pruning. In International Conference on Learning Representations, 2021. 2, 3, 4 +Lym, S., Choukse, E., Zangeneh, S., Wen, W., Sanghavi, S., and Erez, M. Prunetrain: Fast neural network training by dynamic sparse model reconfiguration. In Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis, SC '19, New York, NY, USA, 2019. Association for Computing Machinery. ISBN 9781450362290. doi: 10.1145/3295500.3356156. URL https://doi.org/10.1145/3295500.3356156.3 +Marcus, M. P., Marcinkiewicz, M. A., and Santorini, B. Building a large annotated corpus of english: The penn treebank. Comput. Linguist., 1993. ISSN 0891-2017. 6 + +Merit, S., Xiong, C., Bradbury, J., and Socher, R. Pointer sentinel mixture models. ArXiv, 2017. 6 +Mocanu, D. C., Mocanu, E., Stone, P., Nguyen, P. H., Gibescu, M., and Liotta, A. Scalable training of artificial neural networks with adaptive sparse connectivity inspired by network science. Nature communications, 2018. 2, 3 +Molchanov, P., Tyree, S., Karras, T., Aila, T., and Kautz, J. Pruning convolutional neural networks for resource efficient inference. In 5th International Conference on Learning Representations, ICLR 2017, Toulouse, France, April 24-26, 2017, Conference Track Proceedings, 2017. 1 +Mostafa, H. and Wang, X. Parameter efficient training of deep convolutional neural networks by dynamic sparse reparameterization. In Proceedings of the 36th International Conference on Machine Learning, Proceedings of Machine Learning Research, 2019. 2 +Nathan Silberman, Derek Hoiem, P. K. and Fergus, R. Indoor segmentation and support inference from rgbd images. In ECCV, 2012. 6 +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., and Chintala, S. Pytorch: An imperative style, high-performance deep learning library. In Advances in Neural Information Processing Systems 32. 2019. 2, 3 +Schmidt, V., Goyal, K., Joshi, A., Feld, B., Conell, L., Laskaris, N., Blank, D., Wilson, J., Friedler, S., and Luccioni, S. CodeCarbon: Estimate and Track Carbon Emissions from Machine Learning Computing. 2021. 6, 3 +Srinivas, S. and Babu, R. V. Generalized dropout. arXiv preprint arXiv:1611.06791, 2016. 2 +Su, J., Chen, Y., Cai, T., Wu, T., Gao, R., Wang, L., and Lee, J. D. Sanity-checking pruning methods: Random tickets can win the jackpot. Advances in Neural Information Processing Systems, 2020. 1, 3 +Sun, R. Optimization for deep learning: theory and algorithms, 2019. 5 +Tanaka, H., Kunin, D., Yamins, D. L., and Ganguli, S. Pruning neural networks without any data by iteratively conserving synaptic flow. arXiv preprint arXiv:2006.05467, 2020. 2, 3 +Verdenius, S., Stol, M., and Forre, P. Pruning via iterative ranking of sensitivity statistics. arXiv preprint arXiv:2006.00896, 2020. 2, 3, 4, 6 + +Wang, C., Grosse, R. B., Fidler, S., and Zhang, G. Eigendamage: Structured pruning in the kronecker-factored eigenbasis. In Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, Long Beach, California, USA, Proceedings of Machine Learning Research, 2019. 2 +Wang, C., Zhang, G., and Grosse, R. Picking winning tickets before training by preserving gradient flow. In International Conference on Learning Representations, 2020. 1, 2, 3, 4, 6 +Woodworth, B., Gunasekar, S., Lee, J. D., Moroshko, E., Savarese, P., Golan, I., Soudry, D., and Srebro, N. Kernel and rich regimes in overparametrized models. In Proceedings of Thirty Third Conference on Learning Theory, 2020. 5 +You, H., Li, C., Xu, P., Fu, Y., Wang, Y., Chen, X., Baraniuk, R. G., Wang, Z., and Lin, Y. Drawing early-bird tickets: Toward more efficient training of deep networks. In International Conference on Learning Representations, 2020. 2, 3 +You, Z., Yan, K., Ye, J., Ma, M., and Wang, P. Gate decorator: Global filter pruning method for accelerating deep convolutional neural networks, 2019. 3, 6 +Zhou, A., Ma, Y., Zhu, J., Liu, J., Zhang, Z., Yuan, K., Sun, W., and Li, H. Learning N:M Fine-grained Structured Sparse Neural Networks From Scratch. 9th International Conference on Learning Representations, {ICLR} 2021, pp. 15, 2021. 4 +Zhou, H., Lan, J., Liu, R., and Yosinski, J. Deconstructing lottery tickets: Zeros, signs, and the supermask. In Advances in Neural Information Processing Systems, 2019. 2 + +# Supplementary Material + +# A. Training and Inference Cost Computation + +This section details the computations in Figure 1. We introduce the V100 16GB GPU (2.48\$/h) and the V100 32GB GPU (4.96\$/h). We use the total training time needed to train RN48 and RN48-S for 30 epochs each (see Table 3. Consequently, in order to train RN48, we need $4.96\$/h \times 4.6h = 22.816$ . In order to train RN48-S, we need $2.48\$/h \times 0.64h = 1.59$ . + +# B. Algorithm + +Algorithm 1 Early-CroP +1: Initialize the weights $\Theta$ , weight mask $Mask_0$ with all 1s, pruning ratio $\rho$ , maximum dense training time $m$ , score threshold $th$ , and the number of pruning iterations $it$ ; +2: $\Theta_0 = \Theta$ +3: $\Theta_{prev} = \Theta$ +4: while $t(epoch) < m$ do +5: Do one SGD epoch; +6: $\text{diff} = \frac{||\Theta(t) - \Theta(0)||^2}{||\Theta(0)||^2} - \frac{||\Theta(t-1) - \Theta(0)||^2}{||\Theta(0)||^2}$ +7: if diff $\leq$ th then +8: break; +9: end if +10: $\Theta_{prev} = \Theta$ +11: end while +12: while $i \leq it$ do +13: $\rho_i = \rho_{final} - (\rho_{final} - 1/2) \times (1/2)^i$ +14: $I(\Theta) = |\Theta_t^T H_L(\Theta_t)g_L(\Theta_t)|$ +15: $Mask_i = CroP(I(\Theta), p_i)$ +16: Apply Mask on Network +17: end while +18: Apply Mask on Network +19: while $t \leq t_{max}$ do +20: Do one SGD epoch; +21: end while + +# C. Experimental Setup + +# C.1. Optimization + +Image Classification. For all experiments, we use the ADAM(Kingma & Ba, 2015) optimizer and a learning rate of $2e - 3$ . The One Cycle Learning Rate scheduler is used to train all models except VGG16. The batch size used for CIFAR10 and CIFAR100 experiments is 256 while for Tiny-Imagenet it is 128. All sparse models are allowed to train the same amount of epochs (80) to converge which, except for LTR, includes the number of epochs required to extract the sparse model. In the case of LTR the final sparse + +model is allowed to train for 80 epochs. + +Regression. For all experiments, we use a batch size of 8, the ADAM optimizer with a learning rate of $1e - 5$ . All pruned models are trained for 10 epochs. + +Natural Language Processing. For all experiments, we use a batch size of 128, and the ADAM optimizer with a learning rate of $1e - 3$ . All pruned models are trained for 30 epochs. + +Reinforcement Learning. A description of the models used and number of runs used for each environment can be found in Table 4. + +Table 4. A summary of the setup used in Reinforcement Learning + +
NameNetworkAlgorithmAgentsGames
CartPole-v0MLP(128-128-128-out)A2C168000
Acrobot-v1MLP(256-256-256-out)A2C168000
LunarLander-v2MLP(256-256-256-out)A2C168000
+ +# C.2. Datasets Pre-Processing + +CIFAR10 (Krizhevsky & Hinton, 2009). We augment the normalized CIFAR10 with Random Crop and Random Horizontal Flip. Images are additionally resized to $64 \times 64$ . + +CIFAR100 (Krizhevsky & Hinton, 2009). We augment the normalized CIFAR100 with Random Crop, Random Horizontal Flip, and Random Rotation. + +Tiny-Imagenet (Deng et al., 2009). We normalize the dataset and resize each image to $224 \times 224$ . + +# D. Evaluation Metrics + +In this section we describe how specific metrics are calculated. + +Time. We report time in two separate ways. First, we report the total time required (Training time), which is defined from the start of the experiment until the sparse model's training is finished. Second, we report the time it takes to perform a full forward and backward pass (Batch time) on a given batch using the CUDA time measurement tool (Paszke et al., 2019). + +GPU RAM. The RAM footprint of a process refers to how much memory it consumes on the GPU. This effectively includes the costs of loading the model and performing a + +training step on it. We use the CUDA memory measurement tool to report this metric(Paszke et al., 2019). + +Disk Storage. We estimate the storage needed to store a model on disk using the CSR sparse matrix format (Buluc et al., 2009). Similarly to (Verdenius et al., 2020), we used a ratio of 16:1 float precision on all vectors of the CSR format. + +Energy Emissions. We estimate $\mathrm{CO}_{2}$ emissions in g using CodeCarbon emissions tracker (Schmidt et al., 2021). These estimates consider all emissions from the start of experiments until the end of training. + +# E. Additional Results + +# E.1. Reinforcement Learning + +See Figure 7 for experiments on the Acrobot-v1 and LunarLander-v2 environments. + +# E.2. Natural Language Processing + +We evaluated BERT on multiple language tasks (see Table 8). At the same pruning sparsity, EarlyCroP-U outperforms LTR on 5 out of 8 tasks while training $10 \times$ faster. + +# E.3. Pruning Point Experiments + +In Figure 8 we present more experiments on pruning models at different points in training. We can clearly observe a correlation between the desired pruning rate and the optimal time to prune. The higher the desired final sparsity, the longer the network should be trained before being pruned. + +# E.4. VGG16/CIFAR100 + +See Table 5 for comparisons between different pruning criterions at the same pruning level on VGG16/CIFAR100. + +# E.5. ResNet18/TinyImageNet + +See Table 6 for comparisons between different pruning criteri-zions at the same pruning level on ResNet18/Tiny-Imagenet. + +# E.6.VGG16/ImageNet + +In Table 7 we present a comparison between a dense VGG16 and a sparse VGG16 pruned using EarlyCroP-S on the ImageNet-2012 (ILSVRC2012) (Deng et al., 2009) classification dataset. Given 62 hours of training on ImageNet2012 (ILSVRC2012) on a signle V100 GPU, EarlyCroP-S on VGG16 (50% weights pruned) achieves an accuracy of $61.43\%$ while the dense model only achieves $58.78\%$ . More + +over, for the same number of training epochs, EarlyCrop-S achieves $60.01\%$ in 51 hours while the dense model achieves $58.78\%$ in 62 hours. + +![](images/fd6c08c891b8c8deff2ad53493e3fed4df89e3b564f5cdd3b60b5b7cb4e679fe.jpg) + +![](images/9c72cfb26e26f6953d38d3137f733d484ecce36b42282822ebd9917aa6da5290.jpg) +(a) + +![](images/805d5fa843b0f1f92897a38afe1d6a2e3c4df7d294f3315fbc1626cd3704ca9d.jpg) +(b) +Figure 7. Sparse model performance on classic control games (a) Acrobot-v1 and (b) LunarLander-2 + +![](images/d44153bb9bf88513b6ab99adf703a51d1f53c87b504de2ebfd28c20c5f23b995.jpg) +(a) + +![](images/107645c4294b93c695fad15065571a722c58ddc8f8c1fc80e738e39625ed2187.jpg) +(b) + +![](images/b202efb7c5fa583d93d8891e59c03eb7afe89eadded2a7b5a36d5a169b73dab0.jpg) +(c) +Figure 8. ResNet18 pruned to sparsity $80\%$ (a), $98\%$ (b), and $99.5\%$ (c) at different points during training on CIFAR10 plotted against the final test accuracy of the pruned model after 80 epochs of training (purple) and the difference between the Relative Weight Change in two subsequent epochs (blue). All pruned models are trained for 80 epochs. $\star$ denotes when the Relative Weight Change in two subsequent epochs is below $th < 1 - \rho$ + +Table 5. Comparison between different pruning criteria on VGG16/CIFAR100 at $98\%$ sparsity. Since for structured pruning we cannot precisely control the weight sparsity, we show results closest to $98\%$ weight sparsity. $\uparrow/\downarrow$ indicate metrics where higher/ lower is better. Bold/ underline indicate best/ second best results. GPU RAM and Disk correspond to those of the final pruned model. + +
MethodTest accuracy ↑Weight sparsityNode sparsityTraining time (h) ↓Batch time (ms) ↓GPU RAM (GB) ↓Disk (MB) ↓Emissions (g) ↓
-Dense62.1%--0.771141.03174588
StructuredRandom-S53.9%98.0%86.0%0.59530.233529
SNAP49.3%98.0%89.0%0.67540.163633
CroP-S57.4%98.0%89.0%0.61460.233635
CroPit-S56.5%98.1%89.0%0.62440.233330
EarlyBird60.7%98.0%89.0%0.56680.203662
EarlyCroP-S62.2%97.9%88.0%0.64690.233658
GateDecorators55.0%97.9%87.0%0.61780.233668
EfficientConvNets29.5%98.0%86.0%0.72550.243683
UnstructuredRandom-U55.8%98.0%-0.741181.233599
SNIP61.9%98.0%-0.791091.243590
GRASP63.4%98.0%-0.791131.243591
CroP-U63.8%98.0%-0.741091.233594
CroPit-U56.3%98.0%-0.741111.233591
EarlyCroP-U65.1%98.0%-0.741091.233591
LTR64.7%98.0%-3.441091.2835301
+ +Table 6. Comparison between different pruning criteria on ResNet18/TinyImageNet at $90\%$ sparsity. Since for structured pruning we cannot precisely control the weight sparsity, we show results closest to $90\%$ weight sparsity. $\uparrow/\downarrow$ indicate metrics where higher/ lower is better. Bold/ underline indicate best/ second best results. GPU RAM and Disk correspond to those of the final pruned model. + +
MethodTest accuracy ↑Weight sparsityNode sparsityTraining time (h) ↓Batch time (ms)↓GPU RAM (GB) ↓Disk (MB) ↓Emissions (g) ↓
-Dense51.3%--7.263203.53569882
StructuredRandom-S37.3%91.2%80.0%6.232891.0851464
SNAP38.3%90.4%82.6%6.062680.8455514
CroP-S39.1%90.1%77.7%6.722371.1154615
CroPit-S39.1%91.4%79.3%6.662361.0849591
EarlyCroP-S39.2%90.8%84.1%7.032020.2549676
GateDecorators30.1%89.2%91.2%6.201930.8761930
EfficientConvNets27.7%91.0%79.8%6.602260.2252769
UnstructuredRandom-U49.3%90.0%-7.253514.2057932
SNIP46.2%90.0%-7.273144.1857854
GRASP43.7%90.0%-7.273154.2257881
CroP-U46.7%90.0%-7.263144.2257877
CroPit-U19.1%90.0%-7.263134.2257890
EarlyCroP-U49.8%90.0%-7.263144.2357880
LTR46.3%90.0%-44.76033.68575540
+ +Table 7. EarlyCroP-S results on VGG16/ImageNet at $50\%$ weight sparsity + +
MethodTop-1 AccuracyTop-5 AccuracyTrain Time (hours)EpochsBatch Time (seconds)GPU Memory (GB)
Dense58.78%82.55%62181.0112.15
EarlyCroP-S61.43%87.01%62260.6610.63
EarlyCroP-S60.01%83.38%51180.6610.63
+ +Table 8. Comparison between LTH and EarlyCroP-U on different learnable BERT tasks. + +
MNLIQQPSTS-BWNLIQNLIRTESST-2CoLATraining time
Dense BERT82.3990.1988.4454.9389.1463.3092.1254.511x
Sparsity70%90%50%90%70%60%60%50%
LTR (Rewind 0)%82.4589.2088.1254.9388.0563.0691.7452.0510x
LTR (Rewind 50)%82.9489.5488.4153.3288.7262.4592.6652.0010x
EarlyCroP-U82.1189.9988.0256.3389.1262.192.0352.21x
\ No newline at end of file diff --git a/winningthelotteryaheadoftimeefficientearlynetworkpruning/images.zip b/winningthelotteryaheadoftimeefficientearlynetworkpruning/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..50f3b5b9860c3990a3661e8c24f52c86b32b1f9b --- /dev/null +++ b/winningthelotteryaheadoftimeefficientearlynetworkpruning/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b6a15b3a8ada5a9ab5e969470ee58b9ed1d4119cbe42c1ce0e0b27d44f864ce0 +size 837412 diff --git a/winningthelotteryaheadoftimeefficientearlynetworkpruning/layout.json b/winningthelotteryaheadoftimeefficientearlynetworkpruning/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..cb1a9836d455a3f96b8d207c943a12b80bb9f947 --- /dev/null +++ b/winningthelotteryaheadoftimeefficientearlynetworkpruning/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:841e9976872eff47bb55eb115e2cb4a85108094e7ef65602c33e62a8bb5da4a5 +size 507584 diff --git a/xaifortransformersbetterexplanationsthroughconservativepropagation/e86dd8c6-500c-4a4d-8738-6245dc83ab97_content_list.json b/xaifortransformersbetterexplanationsthroughconservativepropagation/e86dd8c6-500c-4a4d-8738-6245dc83ab97_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..a3ef9ee058480770efaa2bb4027df2598ff623b9 --- /dev/null +++ b/xaifortransformersbetterexplanationsthroughconservativepropagation/e86dd8c6-500c-4a4d-8738-6245dc83ab97_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a1004820488d20a50eca59a2f5e998ec2c40c63b7f771baa3337f0d86da58fd8 +size 129502 diff --git a/xaifortransformersbetterexplanationsthroughconservativepropagation/e86dd8c6-500c-4a4d-8738-6245dc83ab97_model.json b/xaifortransformersbetterexplanationsthroughconservativepropagation/e86dd8c6-500c-4a4d-8738-6245dc83ab97_model.json new file mode 100644 index 0000000000000000000000000000000000000000..c6e945c127ef512d426e219ad1afb4351ea646bc --- /dev/null +++ b/xaifortransformersbetterexplanationsthroughconservativepropagation/e86dd8c6-500c-4a4d-8738-6245dc83ab97_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea13ca9b9b546205da4624af907bb7607ef7923b695dc021b6cd3056457c126d +size 156754 diff --git a/xaifortransformersbetterexplanationsthroughconservativepropagation/e86dd8c6-500c-4a4d-8738-6245dc83ab97_origin.pdf b/xaifortransformersbetterexplanationsthroughconservativepropagation/e86dd8c6-500c-4a4d-8738-6245dc83ab97_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..76e87a85f32481fd550b575c56aa3d5175210af6 --- /dev/null +++ b/xaifortransformersbetterexplanationsthroughconservativepropagation/e86dd8c6-500c-4a4d-8738-6245dc83ab97_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d970d1a0ce93d22983d9a93fb325077f0ae49488467aef19910e3411d77e72d4 +size 4536841 diff --git a/xaifortransformersbetterexplanationsthroughconservativepropagation/full.md b/xaifortransformersbetterexplanationsthroughconservativepropagation/full.md new file mode 100644 index 0000000000000000000000000000000000000000..620a13e9db84377f6ccb3617f8307ab1bcf7dd60 --- /dev/null +++ b/xaifortransformersbetterexplanationsthroughconservativepropagation/full.md @@ -0,0 +1,669 @@ +# XAI for Transformers: Better Explanations through Conservative Propagation + +Ameen Ali $^{1}$ Thomas Schnake $^{2,3}$ Oliver Eberle $^{2,3}$ Grégoire Montavon $^{2,3}$ Klaus-Robert Müller $^{2,3,4,5}$ Lior Wolf + +# Abstract + +Transformers have become an important workhorse of machine learning, with numerous applications. This necessitates the development of reliable methods for increasing their transparency. Multiple interpretability methods, often based on gradient information, have been proposed. We show that the gradient in a Transformer reflects the function only locally, and thus fails to reliably identify the contribution of input features to the prediction. We identify Attention Heads and LayerNorm as the main reasons for such unreliable explanations and propose a more stable way for propagation through these layers. Our proposal, which can be seen as a proper extension of the well-established LRP method to Transformers, is shown both theoretically and empirically to overcome the deficiency of a simple gradient-based approach, and achieves state-of-the-art explanation performance on a broad range of Transformer models and datasets. + +# 1. Introduction + +Transformer models (Vaswani et al., 2017) have attracted increasing interest and shown excellent performance in domains such as natural language processing (NLP) (Vaswani et al., 2017; Devlin et al., 2019; Radford et al., 2019), vision (Dosovitskiy et al., 2021) or graphs (Ying et al., 2021; Yun et al., 2019). Yet, their typically very high complexity (up to billions of parameters (Narayanan et al., 2021)) makes these models notoriously intransparent and their predictions inaccessible to the user. Since Transformer models have + +1The School of Computer Science, Tel-Aviv University, Israel 2Machine Learning Group, Technische Universität Berlin, Berlin, Germany 3BIFOLD - Berlin Institute for the Foundations of Learning and Data, Berlin, Germany 4Department of Artificial Intelligence, Korea University, Seoul, Korea 5Max Planck Institute for Informatics, Saarbrücken, Germany. Correspondence to: Ameen Ali <ameenali@mail.tau.ac.il>. + +Proceedings of the $39^{th}$ International Conference on Machine Learning, Baltimore, Maryland, USA, PMLR 162, 2022. Copyright 2022 by the author(s). + +heavy application in potentially sensitive domains, e.g. as support in recruiting processes (Aleisa et al., 2021), the development of methods that explain their decisions is essential since they allow one to verify whether the model makes fair decisions and does not discriminate protected classes (Bolukbasi et al., 2016; Gonen & Goldberg, 2019). + +In this work, we ask how to bring Explanable AI to Transformers in a theoretically sound manner, focusing in particular on the axiom of conservation, which underlies a number of popular explanation techniques (Bach et al., 2015; Lundberg & Lee, 2017; Sundararajan et al., 2017). We embed our analysis in the Layer-wise Relevance Propagation (LRP) framework (Bach et al., 2015), which allows us to analyze conservation at the level of individual modules and layers of the Transformer model. Our analysis reveals that the conservation properties of existing XAI techniques can be severely impaired when extended to Transformer models. We propose a theoretically grounded, and easy to implement countermeasure, consisting of strategically 'detaching' part of the Transformer model's forward computation before computing explanations. + +We provide qualitative and quantitative experiments on different data domains, such as natural language understanding, computer vision and graph analysis. Comparison is performed with state-of-the-art baseline explanation methods for Transformers. For the quantitative analysis, we perform different input perturbation schemes, in which we track the behavior of the model when relevant or irrelevant features are added to or removed from the input data sample. The proposed explanation method for Transformers presents excellent performance on the qualitative and quantitative experiments and outperforms all existing baseline methods in most of the tasks. Hence, our fairly intuitive explanation method provides both theoretical soundness in its formal derivation and leading performance on many important data domains. Our code is publicly available. $^{1}$ + +# 2. Related Work + +The approaches for Transformer explanation can be divided into (1) methods that extract the attention heads from each Transformer block, using them for interpretation, (2) gradient-based methods, and (3) perturbation-based methods. We would like to mention a few of these previous works. + +The extraction of the attention heads from an attention module, to understand or visualize the prediction strategy of the model, has a long history (Bahdanau et al., 2015), also for non-Transformer architectures, yet it is known to be myopic and unreliable (Jain & Wallace, 2019). Besides the simple extraction of the raw attention weights, there have been attempts to use the attention heads for defining more elaborate explanation mechanisms, such as 'Attention Rollout' and 'Attention Flow' (Abnar & Zuidema, 2020). + +Other authors incorporate gradient methods to explain Transformer models, such as integrated gradient (Wallace et al., 2019) or input gradients (Atanasova et al., 2020). The gradient methods Saliency, Gradient $\times$ Input (GI) or Guided Backpropagation has already been applied in numerous models and domains, found their use in Transformers, as well Atanasova et al. (2020). + +In particular, there have been multiple attempts to implement the layer-wise relevance propagation (LRP) method (Bach et al., 2015) in Transformers (Voita et al., 2019) and other attention-based models (Ding et al., 2017). In addition, LRP has been applied to explain predictions of other models on NLP tasks (Wu & Ong, 2021), such as BERT (Devlin et al., 2019). Other approaches to LRP / gradient propagation in Transformer blocks can be found in (Chefer et al., 2021a;b), where the relevancy scores are obtained by combining attention scores with LRP or attention gradients. + +There are also a few examples in which perturbation-based methods used input reductions (Feng et al., 2018; Prabhakaran et al., 2019) to determine the most relevant parts of the input, by observing change in model confidence or Shapley values (Lundberg & Lee, 2017; Atanasova et al., 2020). + +The experiments we conduct employ both the conventional Transformer, as well as a Transformers on graphs. Specifically, we employ the recent Graphormer model of Ying et al. (2021). Other graph Transformers include (Yun et al., 2019; Yoo et al., 2020; Maziarka et al., 2020; Zhao et al., 2021). A simple explainability procedure based on the obtained attention maps is presented by Yun et al. (2019). + +Previous works on explainability in graph neural networks include gradient-based methods (Pope et al., 2019), graph decomposition (Schnake et al., 2021) graph perturbations (Ying et al., 2019; Luo et al., 2020), and a local approxima + +tion using simpler models (Huang et al., 2020). + +For a more general review of explainable AI, we refer to (Montavon et al., 2018; Guidotti et al., 2019; Samek et al., 2019; Danilevsky et al., 2020; Arrieta et al., 2020; Samek et al., 2021). + +# 3. A Theoretical View on Explaining Transformers + +Very recently, techniques such as Gradient $\times$ Input (GI) (Shrikumar et al., 2017; Ancona et al., 2019) or Layer-wise Relevance Propagation (LRP) (Bach et al., 2015) have been extended to explain Transformers (Voita et al., 2019; Wu & Ong, 2021). New explanation techniques, such as attention rollouts (Abnar & Zuidema, 2020), or other generic ways to aggregate attention information (Chefer et al., 2021a;b) have also been developed for a similar purpose. These recent works have provided empirical evidence that Transformers can be made explainable to a significant extent. + +In this section, we aim to gain a better theoretical understanding of the problem of explaining Transformers, drawing on the same 'axiomatic approach' (Shapley, 1953; Strumbelj & Kononenko, 2010; Sundararajan et al., 2017; Montavon, 2019; Hesse et al., 2021) used for analyzing and developing Explainable AI in the context of standard deep neural networks. A main axiom employed in Explainable AI, especially for the task of attribution, is conservation. The conservation axiom (also known as completeness or efficiency) states that scores assigned to input variables and forming the explanation must sum to the output of the network, in other words, each input variable contributes a share of the predicted score at the output. Workhorses of XAI, such as Layer-wise Relevance Propagation (Bach et al., 2015), Gradient $\times$ Input (Shrikumar et al., 2017; Srinivas & Fleuret, 2019; Hesse et al., 2021)), Integrated Gradients (Sundararajan et al., 2017) or Shapley Values (Strumbelj & Kononenko, 2010; Lundberg & Lee, 2017), are either designed to satisfy this conservation axiom, have been shown to satisfy it for certain models, or can be derived from it directly. + +The Layer-wise Relevance Propagation framework (Bach et al., 2015) considers a particularly strong form of conservation, where each layer, component, or even neuron in the network is subject to the conservation axiom. In particular, the 'relevance' received by a given layer/component/neuron from the layer above must be fully redistributed to the layer below. Many relevance propagation rules have been developed within the LRP framework to address the specificities of different data and architectures. Interestingly, the rudimentary but popular Gradient $\times$ Input method, although commonly viewed as a gradient-based method, can also be embedded in the LRP framework (Shrikumar et al., 2017; Ancona et al., 2019; Montavon, 2019), and potentially be + +used as a starting point (or default choice) for setting propagation rules. Furthermore, with this embedding into LRP, one can perform a detailed analysis of the GI explanation procedure, identifying layers or components where the conservation breaks, and possibly derive better propagation rules for these layers in a second step. + +Denote by $(x_{i})_{i}$ and $(y_{j})_{j}$ the vectors of neurons representing the input and output of some layer or component of interest in a neural network, and by $f$ the output of the neural network. Gradient $\times$ Input attributions on these two vector representations can be computed as: + +$$ +\mathcal {R} \left(x _ {i}\right) = x _ {i} \cdot \left(\partial f / \partial x _ {i}\right) \tag {1} +$$ + +$$ +\mathcal {R} (y _ {j}) = y _ {j} \cdot (\partial f / \partial y _ {j}) \tag {2} +$$ + +respectively. Recall that the gradients at different layers of a neural network are related via the chain rule as follows: + +$$ +\frac {\partial f}{\partial x _ {i}} = \sum_ {j} \frac {\partial y _ {j}}{\partial x _ {i}} \frac {\partial f}{\partial y _ {j}} \tag {3} +$$ + +Injecting (1) and (2) into (3), the gradient propagation rule can be converted into an equivalent relevance propagation rule: + +$$ +\mathcal {R} \left(x _ {i}\right) = \sum_ {j} \frac {\partial y _ {j}}{\partial x _ {i}} \frac {x _ {i}}{y _ {j}} \mathcal {R} \left(y _ {j}\right), \tag {4} +$$ + +using the convention $0 / 0 = 0$ . This is the LRP view on GI. With such interpretation, we can study whether GI is conservative layer-wise or at the level of the given component, by testing whether $\sum_{i}\mathcal{R}(x_{i}) = \sum_{j}\mathcal{R}(y_{j})$ . If this holds for every component of the neural network, then conservation also holds globally. We next show that two components of the Transformer cause a significant break of conservation and therefore require an improved propagation rule. + +# 3.1. Propagation in Attention Heads + +Let us consider the attention head, which makes use of a Query-Key-Value mechanism, and which is a core component of Transformers. As defined in (Vaswani et al., 2017), attention heads have the structure + +$$ +Y = \operatorname {s o f t m a x} \left(\frac {1}{\sqrt {d _ {K}}} \left(X ^ {\prime} W _ {Q}\right) \left(X W _ {K}\right) ^ {\top}\right) X \tag {5} +$$ + +where $X = (x_{i})_{i}$ and $X' = (x_{j}')_{j}$ are the input sequences of token embeddings, $Y = (y_{j})_{j}$ is the sequence of output embeddings, $d_{K}$ is the dimensionality of the Key-vector, and $W_{\{Q,K,V\}}$ are learned projection matrices. In the equation above, we omitted the multiplication by the embedding $W_{V}$ , since the latter can be viewed as a subsequent linear layer and can therefore be treated separately. For the purposes of our analysis, we rewrite Eq. (5) as: + +$$ +y _ {j} = \sum_ {i} x _ {i} p _ {i j} \tag {6} +$$ + +where + +$$ +p _ {i j} = \frac {\exp (q _ {i j})}{\sum_ {i ^ {\prime}} \exp (q _ {i ^ {\prime} j})} +$$ + +is the softmax computation and $q_{ij} = \frac{1}{\sqrt{d_K}} x_i^\top W_K W_Q^\top x_j'$ is the matching function between tokens of the two input sequences. Note that the output of Eq. (6) depends on the input tokens both explicitly, via the term $x_i$ , and via the gating term $p_{ij}$ , which itself depends on $x$ and $x'$ . Also, we observe that for each index $j$ , we have an associated distribution $p_j = (p_{ij})_i$ , and we denote by $\mathbb{E}_j[\cdot]$ and $\mathrm{Cov}_j(\cdot,\cdot)$ , respectively, the expectation and covariance over this distribution, e.g. $\mathbb{E}_j[x] = \sum_i x_i p_{ij}$ . + +We analyze the relevance propagation associated with applying Gradient $\times$ Input to the Transformer model. For this, we define input token relevance as $\mathcal{R}(x_i) = x_i^\top (\partial f / \partial x_i)$ and $\mathcal{R}(x_j') = x_j'\top (\partial f / \partial x_j')$ , and output token relevance as $\mathcal{R}(y_j) = y_j^\top (\partial f / \partial y_j)$ . + +Proposition 3.1. Assume that the inputs to the attention head and its softmax gate are centered, i.e. $\mathbb{E}_j[q_{:j}] = 0$ and $\mathbb{E}_j[x] = 0$ under all probability distributions $p_j$ . The relevance propagation associated with Gradient $\times$ Input is characterized by the conservation equation: + +$$ +\begin{array}{l} \sum_ {i} \mathcal {R} (x _ {i}) + \sum_ {j} \mathcal {R} (x _ {j} ^ {\prime}) \\ = \sum_ {j} \mathcal {R} \left(y _ {j}\right) + 2 \sum_ {j} \operatorname {C o v} _ {j} \left(q: j, x\right) ^ {\top} \frac {\partial f}{\partial y _ {j}} \tag {7} \\ \end{array} +$$ + +This implies that conservation breaks if the rightmost term is non-zero. + +The proof can be found in Appendix A. Prop 3.1 implies that conservation between layers may not hold in the presence of covariates between $q_{:j}$ and $x$ , something that is likely to occur, since the former is a function of the latter. Note that the centering assumption we made in the Proposition above mainly serves to arrive at a simple and intuitive conservation equation. We provide the more general equation in Appendix A. + +To address the lack of conservation in Gradient $\times$ Input (and the resulting consequence that some attention heads may be over- or underrepresented in the explanation), we will propose in Section 4 an alternative propagation rule that retains the conservation property and also works better empirically. + +# 3.2. Propagation in LayerNorm + +Another layer that is rather specific to the Transformer is 'LayerNorm'. For our analysis, we focus on the core part of LayerNorm, consisting of centering and standardization + +![](images/8b3f1f261f0550dba099bac5e45938213409b18e87432537fa2f76cd4d1e7101.jpg) +(a) + +![](images/aa95c9a683b6aff23c0804a09bdf0814fc92d9fdb5e8ce98559f3ecf3dc3aa60.jpg) +(b) +Figure 1. Diagram of specific modules found in Transformer architectures: (a) attention head, (b) LayerNorm. Modules are depicted with the types of nonlinearities they incorporate (bilinear form, softmax, division by the norm), and annotated with the variables used in this paper. Red arrows denote the relevance propagation process under study. + +(and ignore the subsequent affine transformation): + +$$ +y _ {i} = \frac {x _ {i} - \mathbb {E} [ x ]}{\sqrt {\epsilon + \operatorname {V a r} [ x ]}} \tag {8} +$$ + +Here, $\mathbb{E}[\cdot ]$ and $\mathrm{Var}[\cdot ]$ denote the mean and variance over all activations of the corresponding channel (and potentially minibatch). + +Proposition 3.2. The relevance propagation associated with Gradient $\times$ Input is characterized by the conservation equation: + +$$ +\sum_ {i} \mathcal {R} \left(x _ {i}\right) = \left(1 - \frac {\operatorname {V a r} [ x ]}{\epsilon + \operatorname {V a r} [ x ]}\right) \sum_ {i} \mathcal {R} \left(y _ {i}\right) \tag {9} +$$ + +The proof is given in Appendix B. We observe that conservation is never satisfied. Conservation breaks especially strongly when $\epsilon$ is small compared to $\operatorname{Var}[x]$ . This relevance collapse can be observed in Fig. 2. + +![](images/d5805ff92f23b3c3ce147787baa87d398d75593fa1b2c5e5ac1ab9c55618c06a.jpg) + +![](images/1affc5b507d208c800d59cab53b319669a0e3aaebfaa5c02b23ed3a93f3620dc.jpg) +Figure 2. Comparison of the relevance associated with Gradient $\times$ Input before and after propagation in LayerNorm. We can observe a 'relevance collapse' (visible on the right of the peak activation). + +# 4. Better LRP Rules for Transformers + +We propose to address the deficiencies of Gradient $\times$ Input revealed by our layer-wise analysis. Specifically, we take + +the LRP view on Gradient $\times$ Input as a starting point (Eq. (4)) and replace the implicit propagation rules in attention heads and LayerNorm (two components we identified as breaking conservation) by ad-hoc propagation rules that are conservative by design. + +Specifically, we propose at explanation time to make a locally linear expansion of the attention head by viewing the gating terms $p_{ij}$ as constants. Consequently, these terms can be interpreted as the weights of a linear layer locally mapping the input sequence $x$ to the output sequence $y$ . We can then use the canonical LRP rule for linear layers defined as + +$$ +\mathcal {R} \left(x _ {i}\right) = \sum_ {j} \frac {x _ {i} p _ {i j}}{\sum_ {i ^ {\prime}} x _ {i ^ {\prime}} p _ {i ^ {\prime} j}} \mathcal {R} \left(y _ {j}\right) \quad (\text {A H - r u l e}) +$$ + +to propagate the relevance scores from the layer output to the layer input. With such a reformulation, we also note that the query sequence $x'$ appears disconnected, and consequently, we have implicitly $\mathcal{R}(x_j') = 0$ . This strategy has also been used and justified theoretically for LSTM blocks (Arras et al., 2019), and has been shown empirically to yield superior performance to gradient-based methods, in particular Gradient $\times$ Input. + +Furthermore, to address the particularly severe break of conservation in LayerNorm, we propose again a locally linear expansion at explanation time, by viewing the multiplicative factor $\alpha = (\sqrt{\epsilon + \operatorname{Var}[x]})^{-1}$ as constant. The entire LayerNorm operation can then be expressed by the linear transformation $\alpha C x$ where $C = I_{N} - \frac{1}{N} \mathbf{1}_{(N \times N)}$ is the 'centering matrix' and where $N$ is the number of tokens in the input sequence. Using again the same canonical LRP rule for linear layers, this time with weights $\alpha C$ , we obtain: + +$$ +\mathcal {R} \left(x _ {i}\right) = \sum_ {j} \frac {x _ {i} \cdot \left(\delta_ {i j} - \frac {1}{N}\right)}{\sum_ {i ^ {\prime}} x _ {i ^ {\prime}} \cdot \left(\delta_ {i ^ {\prime} j} - \frac {1}{N}\right)} \mathcal {R} \left(y _ {j}\right) \quad (\text {L N - r u l e}) +$$ + +where $(\delta_{ij} - \frac{1}{N})$ is another way of writing $C_{ij}$ and the factor $\alpha$ present in the numerator and denominator cancels out. + +In practice, these rules do not need to be implemented explicitly. We can simply observe that they are effectively the same rules as those induced by Gradient $\times$ Input, with the gating and rescaling terms in their respective layers treated as constant (i.e. detached in the forward computation so that the gradient does not propagate through it). We therefore propose the following implementation trick for the rules above: + +Implementation Trick: To compute the proposed improved LRP explanation, rewrite Eq. (6) as + +$$ +y _ {j} = \sum_ {i} x _ {i} [ p _ {i j} ]. _ {\mathrm {d e t a c h ()}} +$$ + +in every attention head, and rewrite Eq. (8) as + +$$ +y _ {i} = \frac {x _ {i} - \mathbb {E} [ x ]}{\left[ \sqrt {\epsilon + \operatorname {V a r} [ x ]} \right] _ {\text {. d e t a c h ()}}} +$$ + +in every LayerNorm. Then extract the LRP explanation by calling Gradient $\times$ Input on the resulting function $f$ . + +This trick makes the method straightforward to implement, as it simply consists of adding detach() calls at the appropriate locations in the neural network code, and then running standard Gradient $\times$ Input. Furthermore, the runtime is at least as good as Gradient $\times$ Input, and typically better, due to the resulting simplification of the gradient computation. + +# 5. Experimental Setup + +The proposed approach is tested on several Transformer models trained on various datasets. We benchmark the performance of our method against a number of other approaches proposed in the literature and commonly used for explaining Transformer-type architectures. + +# 5.1. Datasets + +We use the following datasets from natural language processing, image classification, as well as molecular modeling to evaluate the different XAI approaches. For the NLP experiments, we consider sentiment classification on the SST-2 (Socher et al., 2013) and IMDB datasets (Maas et al., 2011) which contain 11,844 and 50,000 movie reviews, respectively, for binary classification into negative or positive sentiment. In addition, we use the TweetEval Dataset (Xiong et al., 2019) for tweet classification on sentiment (59,899), hate detection (12,970) and emotion recognition (5,052). Furthermore, the SILICONE Dataset (Chapuis et al., 2020) is also used for emotion detection tasks (Semaine 13,708) and utterance sentiment analysis (Meld-S 5,627). + +For experiments with graph Transformers, the MNIST su + +perpixels data (Monti et al., 2017) is extracted from 70,000 samples for digit classification. Each node represents one image patch (superpixel), and is connected to its neighbors. Another graph dataset is based on the MoleculeNet (Wu et al., 2018) benchmark: the BACE dataset contains 1,522 compounds, together with their structures and binary labels indicating a binding result for a set of inhibitors of human $\beta$ -secretase 1 (BACE-1)(Subramanian et al., 2016). + +# 5.2. Benchmark Methods + +First, we compare to a 'Gradient $\times$ Input' (Denil et al., 2014; Shrikumar et al., 2017; Atanasova et al., 2020) baseline without considering any modifications to the individual gradient computations as described in Section 3. + +In addition, we compute averages over last-layer attention head vectors ('Attention-last') as proposed in Hollenstein & Beinborn (2021) as well as 'Rollout' and attention flow ('A-flow') (Abnar & Zuidema, 2020) which capture the layer-wise structure of deep Transformer models in comparison to raw attention head analysis. 'Generic Attention Explainability' (GAE) by Chefer et al. (2021a) propagates attention gradients together with gradients from other parts of the network, resulting in state-of-the-art performance in explaining Transformer architectures. + +We consider three variants of our proposed LRP-based technique. First 'LRP (AH)' where propagation through attention heads is handled via the AH-rule described in Section 4. For any other layers, we use the GI-equivalent propagation rule (i.e. in practice simply propagating gradient without detaching terms). Then 'LRP (LN)' where propagation through LayerNorm is handled via the LN-rule. Lastly 'LRP (AH+LN)' which applies both the AH-Rule and LN-Rule in respective layers. + +# 6. Results + +We now turn to evaluating the LRP-based method we have proposed. We first validate that conservation is indeed maintained, and then continue with quantitative perturbation experiments. Finally, we visualize the different explanations produced by these methods qualitatively. + +# 6.1. Conservation + +As a starting point, we would like to verify whether the insights produced in Section 3 on the conservation, or lack thereof, also hold empirically. We consider for this our two Transformer models trained on the SST-2 and MNIST datasets, and compute GI and LRP (AH+LN) explanations. We then compare the score produced at the output of the Transformer network against the sum of explanation scores over input features of the network. For this purpose, the input features are the positionally encoded embedding vectors + +present in the first layer. + +![](images/2ec0660b9195b5a025215887ec8f8d0b2aa5a4a1ae9c96a928fb01d8d5c0eab2.jpg) +Figure 3. Conservation, or lack thereof, of GI and LRP attributions on two Transformer models. The two axes represent the output score and the sum of explanation scores over the neural network input variables. Each point in the scatter plot represents one example. The closer the points to the diagonal, the more conservative the explanation technique. + +The results are shown in Fig. 3. Evidently, our LRP approach produces explanations that reflect the output score much more closely than GI, although mild breaks of conservation still occur (likely due to the presence of non-attributable biases in linear layers). Surprisingly, GI explanation scores on MNIST are almost anticorrelated with the output of the model. This clearly highlights a major problem with interpreting GI explanations as attributions of the function output in the context of Transformers. In Appendix D we also provided experiments that show if other explainability methods fulfill conservation. + +# 6.2. Quantitative Evaluation + +We now test the performance of different explanation methods using an input perturbation scheme in which the most or least relevant input nodes are considered (Schnake et al., 2021). Two different settings are considered for the Graph Transformer experiments. For the activation task, a good explanation gives an ordering from most to least relevant nodes that when added to an empty graph activate the network output maximally and as quickly as possible. Thus, we observe the output probability $p_c(x)$ of the correct class $c$ and report the area under the activation curve (AUAC) with higher AUAC indicating a more faithful explanation with regards to the correct prediction. + +In the pruning task, we start with the original graph and remove nodes in the order from smallest to largest absolute values. We measure AU-MSE, which is the area under the mean squared error $(y_0 - y_{m_t})^2$ , with the model output logits of the unpruned model $y_0$ and $y_{m_t}$ representing the output graph after applying the masking $m_t$ at step $t$ to the input graph. A lower AU-MSE is desired and indicates that removing less relevant nodes has little effect on prediction. + +Table 1. AUAC - area under activation curve. Higher AUAC is better and indicates that adding the most relevant nodes strongly activates the correct model prediction. A-Flow is a computationally very expensive method and was therefore omitted for some methods. + +
MethodIMDBSST-2BACEMNISTT-EmotionsT-HateT-SentimentMeld-SSemaine
Random.673.664.624.324.516.640.484.460.432
A-Last.708.712.620.862.542.663.515.483.451
A-Flow-.711.637------
Rollout.738.713.653.358.554.659.520.489.441
GAE.872.821.675.426.675.762.611.548.532
GI.920.847.646.942.652.772.651.591.529
LRP(AH).911.855.645.942.675.797.668.594.544
LRP (LN).935.907.702.947.735.829.710.632.593
LRP(AH+LN).939.908.707.948.750.838.713.635.606
+ +For the NLP experiments, we consider token sequences instead of graph nodes. The activation task starts with an empty sentence of "UNK" tokens, which are then gradually replaced with the original tokens in the order of highest to lowest relevancy. In the pruning task, we remove tokens from lowest to highest absolute relevance by replacing them with "UNK" tokens, similarly to the ablation experiments of Abnar & Zuidema (2020). + +In Table 1 and 2, we report results for the activation and pruning tasks and observe that the proposed handling of the gradient in the attention head (AH) and in layer normalization (LN) during backpropagation indeed results in consistently better performance across all datasets. We see the greatest improvement when applying both the proposed detaching of gating and rescaling terms (AH+LN) together. In addition, explanations based on gradient information are superior to raw attention-based methods (A-Last, Rollout, A-Flow). In Figure 4 we show activation and pruning curves for the SST-2 dataset in a Transformer and the BACE dataset on a Graphormer model and include them for all other datasets in Appendix H. Additional experiments for inference time analysis over the different explanation methods are provided in Appendix E. We note that the application of the proposed gradient rules leads to a gradual improvement over naive gradient implementations of GI, especially during the transition from very relevant to rather relevant inputs for the activation task. This suggests that the improved LRP explanations are both sparser and more effective at determining the most relevant input nodes, while attributing low relevance to task-irrelevant input nodes. We will inspect this effect qualitatively in the next section. + +![](images/c61b0c73a37c1e2892c71912eb1b357549b59ee8544dd74a956db94a365b8964.jpg) + +![](images/74921bc2c3484701fefbd332c3dad66393c18772abdc8f02c1d6d0e843b5e1df.jpg) + +![](images/268341ee7bb8bb8993c1a4d7efed5537c26b796ed466ae6380b2f43d94cd0804.jpg) +Figure 4. Evaluation of explanations using input perturbations. Results for SST-2 (top row) and BACE (lower row) are shown for the activation task, in which the most relevant nodes are added first (left column), and for pruning, in which the nodes of least absolute relevance are removed first (right column). + +![](images/d4feaa38a391743922f6f2e86ed38a8b860491d31dc17ab019686f3fcc96dc08.jpg) +Figure 5. Visualisation of the attribution scores per word in a sentence of the SST-2 dataset when predicting the sentiment of the sentence. Opaque red color indicates that the word contributes positively to the prediction, blue indicates that the word has a negative contribution. The heatmaps of the methods 'A-last', 'A-flow' and 'Rollout' are limited to non-negative scores. + +
RandomRolloutLRP (AH)
A-FlowGAELRP (LN)
A-LastGILRP (AH+LN)
+ +# 6.3. Qualitative Results + +In this section we will examine the explanations produced with different methods qualitatively for both Transformer and Graphormers. + +In Figure 5 we see the relevance scores of different attribution methods when interpreting the prediction of the Transformer model on a sentence from the SST-2 dataset with positive sentiment. We provide additional examples in Appendix F. We can see that most of the methods show that the model focuses on the words "best" and "virtues", which is a reasonable strategy, since they contribute clearly to a positive sentiment. It is also visible that 'A-last' has a more distinct positive or negative focus on the token "eastwood" which suggests an over-confidence in names or entities (we will return to this in section 6.4). Our proposed methods, 'LRP (AH)' and 'LRP (AH+LN)', consider this entity token to be less relevant for the task (mild coloring) and instead highlight tokens that provide a more general strategy for detecting positive sentiment in a more pronounced manner. + +The explanations obtained for a Graphormer model trained on MNIST superpixels are depicted in Fig. 6 and we provide additional examples in Appendix G. Evidently, the proposed + +Table 2. AU-MSE - area under the mean squared error $\left( {{y}_{0} - {y}_{{m}_{t}}}\right) {}^{2}$ curve for pruning. Lower is better and indicates that removing less relevant nodes has little effect on the model prediction. + +
MethodIMDBSST-2BACEMNISTT-EmotionsT-HateT-SentimentMeld-SSemaine
Random2.163.971.9569.824.259.122.872.541.92
A-Last1.652.561.9945.823.737.771.901.741.42
A-Flow-2.521.87------
Rollout1.042.431.77115.22.856.551.711.531.40
GAE1.632.261.6659.812.217.401.611.561.37
GI0.872.102.0618.062.096.691.411.571.43
LRP(AH)0.772.022.0818.031.836.431.431.691.38
LRP (LN)0.691.781.6517.551.555.021.251.501.13
LRP(AH+LN)0.651.561.6117.491.474.881.231.481.08
+ +
A-last[CLS] has a lot of the virtues of eastwood at his best. [SEP]
A-Flow[CLS] has a lot of the virtues of eastwood at his best. [SEP]
Rollout[CLS] has a lot of the virtues of eastwood at his best. [SEP]
GAE[CLS] has a lot of the virtues of eastwood at his best. [SEP]
GI[CLS] has a lot of the virtues of eastwood at his best. [SEP]
LRP (AH)[CLS] has a lot of the virtues of eastwood at his best. [SEP]
LRP (AH+LN)[CLS] has a lot of the virtues of eastwood at his best. [SEP]
+ +improved explanations using LRP (AH) and LRP (AH+LN) indeed highlight the superpixels that contain digit information more reliably than the other approaches. The advantage of conserving information is clearly visible when comparing naive LRP with LRP (AH+LN) where the effect of distorted relevance propagation is apparent. The weaker performance of raw attention-based methods (A-Last, Rollout and GAE) in the perturbation experiments can now be explained by a lack of specificity to the salient digit in favor of attributing more relevance to uninformative background superpixels. + +# 6.4. Use Case: Analyzing Bias in Transformers + +We now use our method on a popular Transformer architecture, DistilBERT (Sanh et al., 2019), to study the detection of systematic bias in machine learning systems through XAI. We download the publicly available checkpoint for + +![](images/4ab46317ccec78b82b80532e1d4e435b3f5fedd1fdae322f0869b30c5a68c262.jpg) +A-Last + +![](images/fc6a88cfdbe63aa3664802f1c4ab5b1f7c203d28c329d1f4a16a11436646b776.jpg) +Rollout + +![](images/1d17cd22813b4ffae2fe82bc2eba548fef05d5bf424b77601de1bcadd3f0c2cb.jpg) +GAE +LRP (AH+LN) + +![](images/64252ede611f61e8c29bfd89c3c27a63c93af4917f0ceb22c7de340b00ef6592.jpg) +GI + +![](images/7f773038c0028081ad4e0cbf685ccc46ffd2d978be03753e627f19739d140ac3.jpg) +LRP (AH) + +![](images/d371a7c5affc4ea49737facea36774cd226c59d1f455131197f667ae6507a85d.jpg) +Figure 6. Explanations of MNIST superpixels on a Graphormer model for digit classification. Relevance of a node in the graph is indicated by color and opacity. Red/Blue contribute positively/negatively to the prediction and magnitude is encoded via color opacity. + +sentiment classification on SST-2 from HuggingFace $^2$ and apply the implementation trick introduced in Section 4. In order to detect such bias, template-based approaches, i.e. “ is a successful ”, have been used to test the behavior of the model regarding different systematic relations between, for example, demographics and most likely model predictions (Kiritchenko & Mohammad, 2018; Prabhakaran et al., 2019; De-Arteaga et al., 2019; Ribeiro et al., 2020; Ousidhoum et al., 2021). While this is a flexible approach, it involves the risk of producing model inputs that are out of the training distribution and thus can cause unstable predictions. + +Instead, we study relevance attribution to bias-sensitive groups of tokens that are of interest. In this example, we explore the possible gender bias in sentiment analysis using the DistilBERT model. For this, we explain the difference between positive and negative model outputs for sentiment classification to observe which entities and related gender may exhibit a tendency to be more/less relevant to change the classification towards a positive/negative sentiment. + +In Figure 7 (left) we first of all observe that there is no consistent bias for female or male names. Overall, there are more male than female names in the dataset, but the distributions of positive/negative sentiment attributed to them are similar. However, we do observe biased model responses towards certain entity categories: After ranking entities based on their assigned relevance from most to least relevant in Figure 7 (right) we observe that common Western male names such as "lee", "barry" or "coen" can modulate sentiment the strongest towards positive. Interestingly, the first female + +entity, "sally jesse raphael", is ranked high because of her typically male family name "raphael". At the other extreme, among the names with the strongest negative impact on sentiment, we find a non-Western family name ("chan") and male political figures ("saddam hussein", "castro"). + +Because our XAI-based approach disentangles the contribution of individual words from that of other words in the sentence, our approach is more immune to confounders than a naive approach that would simply look at the correlation between name occurrence and predicted sentiment. + +# 7. Conclusion + +Transformers are a major development in machine learning, with a strong uptake in practical applications, in particular NLP. Consequently, there is a need to obtain transparency regarding the decisions made by these models. + +In this work, we have shown that one cannot take for granted that common XAI methods will necessarily continue to work well on Transformer models, as they do on standard deep neural networks. In particular, within the framework of Layer-wise Relevance Propagation, we have shown that GI fails to implement conservation, a common property of attribution techniques. Furthermore, our analysis pinpointed that attention heads and LayerNorms need to be addressed specifically. We also proposed specific and easily to implement LRP rules for these layers. + +Empirically, our method systematically achieves state-of-the-art results on Transformer and Graphormer models over a broad range of datasets. Lastly, we have showcased our explanation technique on the problem of detecting biases in a sentiment model. Our explanation technique was able to characterize model bias in a detailed manner, without having to generate counterfactual examples and the risk of stepping out of the data manifold. In conclusion, our proposed novel XAI framework for Transformers will ultimately contribute to a safer, more transparent and fair use of state-of-the-art machine learning techniques. + +# Acknowledgements + +KRM was partially supported by the German Ministry for Education and Research under Grant 01IS14013AE, Grant 01GQ1115, Grant 01GQ0850, as BIFOLD (ref. 01IS18025A and ref. 01IS18037A) and the Institute of Information & Communications Technology Planning & Evaluation (IITP) grants funded by the Korea Government under Grants 2017-0-00451 and 2019-0-00079. + +This project has received funding from the European Research Council (ERC) under the European Unions Horizon 2020 research, innovation programme (grant ERC CoG 725974). + +![](images/87026ac10821b1bb9256a8a7f58a9a6858b8d2b084c24d30b43194171248b660.jpg) +Figure 7. Investigating gender bias in a pre-trained DistilBERT model for sentiment classification on SST-2 movie reviews. Distribution of normalized name occurrences over relevance scores is shown along with sentence samples that contain names that most (top rows)/least (lower rows) influence a classification towards positive/negative sentiment. + +# References + +Abnar, S. and Zuidema, W. H. Quantifying attention flow in transformers. In Jurafsky, D., Chai, J., Schluter, N., and Tetreault, J. R. (eds.), Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, ACL 2020, pp. 4190-4197, 2020. +Aleisa, M. A., Beloff, N., and White, M. Airm: a new ai recruiting model for the saudi arabia labor market. In Arai, K. (ed.), Intelligent Systems Conference (IntelliSys) 2021, volume 3: 296 of Lecture Notes in Networks and Systems, pp. 105-124, Cham, September 2021. Springer. +Ancona, M., Ceolini, E., Öztireli, C., and Gross, M. H. Gradient-based attribution methods. In *Explainable AI: Interpreting, Explaining and Visualizing Deep Learning*, volume 11700 of Lecture Notes in Computer Science, pp. 169-191. Springer, 2019. +Arras, L., Arjona-Medina, J., Widrich, M., Montavon, G., Gillhofer, M., Müller, K.-R., Hochreiter, S., and Samek, W. Explaining and Interpreting LSTMs. In Samek, W., Montavon, G., Vedaldi, A., Hansen, L. K., and Müller, K.-R. (eds.), Explainable AI: Interpreting, Explaining and Visualizing Deep Learning, volume 11700 of Lecture Notes in Computer Science, pp. 211-238. Springer, Cham, 2019. +Arrieta, A. B., Rodríguez, N. D., Ser, J. D., Bennetot, A., Tabik, S., Barbado, A., García, S., Gil-Lopez, S., Molina, D., Benjamins, R., Chatila, R., and Herrera, F. Explainable artificial intelligence (XAI): concepts, taxonomies, opportunities and challenges toward responsible AI. Information Fusion, 58:82-115, 2020. +Atanasova, P., Simonsen, J. G., Lioma, C., and Augenstein, I. A diagnostic study of explainability techniques for text classification. In Webber, B., Cohn, T., He, Y., and Liu, Y. (eds.), Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing, EMNLP 2020, Online, November 16-20, 2020, pp. 3256-3274. Association for Computational Linguistics, 2020. + +Bach, S., Binder, A., Montavon, G., Klauschen, F., Müller, K.-R., and Samek, W. On pixel-wise explanations for non-linear classifier decisions by layer-wise relevance propagation. PLoS ONE, 10(7):e0130140, 2015. +Bahdanau, D., Cho, K., and Bengio, Y. Neural machine translation by jointly learning to align and translate. In Bengio, Y. and LeCun, Y. (eds.), 3rd International Conference on Learning Representations, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings, 2015. +Bolukbasi, T., Chang, K.-W., Zou, J., Saligram, V., and Kalai, A. Man is to computer programmer as woman is to homemaker? debiasing word embeddings. In Proceedings of the 30th International Conference on Neural Information Processing Systems, pp. 4356-4364, Red Hook, NY, USA, 2016. Curran Associates Inc. +Chapuis, E., Colombo, P., Manica, M., Labeau, M., and Clavel, C. Hierarchical pre-training for sequence labelling in spoken dialog. In Findings of the Association for Computational Linguistics: EMNLP 2020, pp. 2636-2648, 2020. +Chefer, H., Gur, S., and Wolf, L. Generic attention-model explainability for interpreting bi-modal and encoder-decoder transformers. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 397-406, 2021a. +Chefer, H., Gur, S., and Wolf, L. Transformer interpretability beyond attention visualization. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 782-791, 2021b. +Danilevsky, M., Qian, K., Aharonov, R., Katsis, Y., Kawas, B., and Sen, P. A survey of the state of explainable AI for natural language processing. In AACL/IJCNLP, pp. 447-459. Association for Computational Linguistics, 2020. +De-Arteaga, M., Romanov, A., Wallach, H., Chayes, J., Borgs, C., Chouldechova, A., Geyik, S., Kenthapadi, K., + +and Kalai, A. T. Bias in bios: A case study of semantic representation bias in a high-stakes setting. In Proceedings of the Conference on Fairness, Accountability, and Transparency, pp. 120-128, New York, NY, USA, 2019. Association for Computing Machinery. +Denil, M., Demiraj, A., and de Freitas, N. Extraction of salient sentences from labelled documents. ArXiv, abs/1412.6815, 2014. +Devlin, J., Chang, M., Lee, K., and Toutanova, K. 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, NAACL-HLT 2019, pp. 4171-4186, 2019. +Ding, Y., Liu, Y., Luan, H., and Sun, M. Visualizing and understanding neural machine translation. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, pp. 1150-1159, 2017. +Dosovitskiy, A., Beyer, L., Kolesnikov, A., Weissenborn, D., Zhai, X., Unterthiner, T., Dehghani, M., Minderer, M., Heigold, G., Gelly, S., Uszkoreit, J., and Houlsby, N. An image is worth 16x16 words: Transformers for image recognition at scale. In 9th International Conference on Learning Representations, ICLR 2021, 2021. +Feng, S., Wallace, E., Grissom II, A., Iyyer, M., Rodriguez, P., and Boyd-Graber, J. Pathologies of neural models make interpretations difficult. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 3719-3728, Brussels, Belgium, October-November 2018. Association for Computational Linguistics. +Gonen, H. and Goldberg, Y. Lipstick on a pig: Debiasing methods cover up systematic gender biases in word embeddings but do not remove them. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 609-614, 2019. +Guidotti, R., Monreale, A., Ruggieri, S., Turini, F., Giannotti, F., and Pedreschi, D. A survey of methods for explaining black box models. ACM Comput. Surv., 51(5): 93:1-93:42, 2019. +Hesse, R., Schaub-Meyer, S., and Roth, S. Fast axiomatic attribution for neural networks. In Beygelzimer, A., Dauphin, Y., Liang, P., and Vaughan, J. W. (eds.), Advances in Neural Information Processing Systems, 2021. +Hollenstein, N. and Beinborn, L. Relative importance in sentence processing. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics + +and the 11th International Joint Conference on Natural Language Processing, pp. 141-150, 2021. +Huang, Q., Yamada, M., Tian, Y., Singh, D., Yin, D., and Chang, Y. Graphlime: Local interpretable model explanations for graph neural networks. arXiv preprint arXiv:2001.06216, 2020. +Jain, S. and Wallace, B. C. Attention is not Explanation. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 3543-3556, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. +Kiritchenko, S. and Mohammad, S. Examining gender and race bias in two hundred sentiment analysis systems. In Proceedings of the Seventh Joint Conference on Lexical and Computational Semantics, pp. 43-53, 2018. +Lundberg, S. M. and Lee, S. A unified approach to interpreting model predictions. In Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, pp. 4765-4774, 2017. +Luo, D., Cheng, W., Xu, D., Yu, W., Zong, B., Chen, H., and Zhang, X. Parameterized explainer for graph neural network. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, volume 33, 2020. +Maas, A. L., Daly, R. E., Pham, P. T., Huang, D., Ng, A. Y., and Potts, C. Learning word vectors for sentiment analysis. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, pp. 142-150, 2011. +Maziarka, L., Danel, T., Mucha, S., Rataj, K., Tabor, J., and Jastrzkebski, S. Molecule attention transformer. arXiv preprint arXiv:2002.08264, 2020. +Montavon, G. Gradient-based vs. propagation-based explanations: An axiomatic comparison. In *Explainable AI: Interpreting, Explaining and Visualizing Deep Learning*, pp. 253-265. Springer International Publishing, 2019. +Montavon, G., Samek, W., and Müller, K. Methods for interpreting and understanding deep neural networks. *Digit. Signal Process.*, 73:1-15, 2018. +Monti, F., Boscaini, D., Masci, J., Rodolà, E., Svoboda, J., and Bronstein, M. M. Geometric deep learning on graphs and manifolds using mixture model cnns. In 2017 IEEE Conference on Computer Vision and Pattern Recognition, pp. 5115-5124, 2017. + +Narayanan, D., Shoeybi, M., Casper, J., LeGresley, P., Patwary, M., Korthikanti, V., Vainbrand, D., Kashinkunti, P., Bernauer, J., Catanzaro, B., Phanishayee, A., and Zaharia, M. Efficient large-scale language model training on GPU clusters using megatron-lm. In SC '21: The International Conference for High Performance Computing, Networking, Storage and Analysis, 2021. +Ousidhoum, N., Zhao, X., Fang, T., Song, Y., and Yeung, D.-Y. Probing toxic content in large pre-trained language models. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing, pp. 4262-4274. Association for Computational Linguistics, 2021. +Pope, P. E., Kolouri, S., Rostami, M., Martin, C. E., and Hoffmann, H. Explainability methods for graph convolutional neural networks. In 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 10772-10781, 2019. +Prabhakaran, V., Hutchinson, B., and Mitchell, M. Perturbation sensitivity analysis to detect unintended model biases. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing, EMNLP-IJCNLP, pp. 5739-5744, 2019. +Radford, A., Wu, J., Child, R., Luan, D., Amodei, D., Sutskever, I., et al. Language models are unsupervised multitask learners. OpenAI blog, 2019. +Ribeiro, M. T., Wu, T. S., Guestrin, C., and Singh, S. Beyond accuracy: Behavioral testing of nlp models with checklist. In Proc. Association for Computational Linguistics (ACL), pp. 4902-4912, 2020. +Samek, W., Montavon, G., Vedaldi, A., Hansen, L. K., and Müller, K.-R. (eds.). Explainable AI: Interpreting, Explaining and Visualizing Deep Learning, volume 11700 of Lecture Notes in Computer Science. Springer, 2019. +Samek, W., Montavon, G., Lapuschkin, S., Anders, C. J., and Müller, K.-R. Explaining deep neural networks and beyond: A review of methods and applications. Proceedings of the IEEE, 109(3):247-278, 2021. +Sanh, V., Debut, L., Chaumond, J., and Wolf, T. Distilbert, a distilled version of bert: smaller, faster, cheaper and lighter. ArXiv, abs/1910.01108, 2019. +Schnake, T., Eberle, O., Lederer, J., Nakajima, S., Schütt, K. T., Müller, K.-R., and Montavon, G. Higher-order explanations of graph neural networks via relevant walks. IEEE Transactions on Pattern Analysis and Machine Intelligence, pp. 10.1109/TPAMI.2021.3115452, 2021. + +Shapley, L. S. A Value for n-Person Games, pp. 307-318. Princeton University Press, 1953. +Shrikumar, A., Greenside, P., and Kundaje, A. Learning important features through propagating activation differences. In Proceedings of the 34th International Conference on Machine Learning - Volume 70, ICML'17, pp. 3145-3153, 2017. +Socher, R., Perelygin, A., Wu, J., Chuang, J., Manning, C. D., Ng, A. Y., and Potts, C. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pp. 1631-1642, 2013. +Srinivas, S. and Fleuret, F. Full-gradient representation for neural network visualization. In Advances in Neural Information Processing Systems 32: Annual Conference on Neural Information Processing Systems 2019, pp. 4126-4135, 2019. +Strumbelj, E. and Kononenko, I. An efficient explanation of individual classifications using game theory. J. Mach. Learn. Res., 11:1-18, 2010. +Subramanian, G., Ramsundar, B., Pande, V., and Denny, R. A. Computational modeling of $\beta$ -secretase 1 (bace-1) inhibitors using ligand based approaches. Journal of chemical information and modeling, 56(10):1936-1949, 2016. +Sundararajan, M., Taly, A., and Yan, Q. Axiomatic attribution for deep networks. In ICML, volume 70 of Proceedings of Machine Learning Research, pp. 3319-3328. PMLR, 2017. +Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, L., and Polosukhin, I. Attention is all you need. In Advances in neural information processing systems, pp. 5998-6008, 2017. +Voita, E., Talbot, D., Moiseev, F., Sennrich, R., and Titov, I. Analyzing multi-head self-attention: Specialized heads do the heavy lifting, the rest can be pruned. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 5797-5808, 2019. +Wallace, E., Tuyls, J., Wang, J., Subramanian, S., Gardner, M., and Singh, S. AllenNLP interpret: A framework for explaining predictions of NLP models. In Proceedings 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, pp. 7-12, 2019. +Wu, Z. and Ong, D. C. On explaining your explanations of bert: An empirical study with sequence classification. CoRR, abs/2101.00196, 2021. + +Wu, Z., Ramsundar, B., Feinberg, E. N., Gomes, J., Geniesse, C., Pappu, A. S., Leswing, K., and Pande, V. Moleculenet: a benchmark for molecular machine learning. Chemical science, 9(2):513-530, 2018. + +Xiong, W., Wu, J., Wang, H., Kulkarni, V., Yu, M., Guo, X., Chang, S., and Wang, W. Y. Tweetqa: A social media focused question answering dataset. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 5020-5031, 2019. + +Ying, C., Cai, T., Luo, S., Zheng, S., Ke, G., He, D., Shen, Y., and Liu, T.-Y. Do transformers really perform badly for graph representation? In Thirty-Fifth Conference on Neural Information Processing Systems, 2021. + +Ying, R., Bourgeois, D., You, J., Zitnik, M., and Leskovec, J. Gnnexplainer: Generating explanations for graph neural networks. Advances in neural information processing systems, pp. 9240-9251, 2019. + +Yoo, S.-Y., Kim, Y.-S., Lee, K., Jeong, K., Choi, J., Lee, H., and Choi, Y. S. Graph-aware transformer: Is attention all graphs need? ArXiv, abs/2006.05213, 2020. + +Yun, S., Jeong, M., Kim, R., Kang, J., and Kim, H. J. Graph transformer networks. In Advances in Neural Information Processing Systems 32: Annual Conference on Neural Information Processing Systems 2019, pp. 11960-11970, 2019. + +Zhao, J., Li, C., Wen, Q., Wang, Y., Liu, Y., Sun, H., Xie, X., and Ye, Y. Gophormer: Ego-graph transformer for node classification. arXiv preprint arXiv:2110.13094, 2021. + +# A. Derivations for Attention Heads + +# A.1. Gradient of Softmax + +We first consider the softmax function given by: + +$$ +p _ {i j} = \frac {\exp (q _ {i j})}{\alpha_ {j}} \quad \alpha_ {j} = \sum_ {i} \exp (q _ {i j}) +$$ + +where $q_{ij}$ is a shortcut notation for $q(x_i, x_j')$ . We can derive its gradient with respect to the tokens $x_i$ and $x_j'$ : + +$$ +\begin{array}{l} \frac {\partial p _ {k j}}{\partial x _ {i}} = \frac {1}{\alpha_ {j} ^ {2}} \Big (\exp (q _ {k j}) \frac {\partial q _ {k j}}{\partial x _ {i}} \alpha_ {j} - \exp (q _ {k j}) \exp (q _ {i j}) \frac {\partial q _ {i j}}{\partial x _ {i}} \Big) \\ = p _ {k j} \frac {\partial q _ {k j}}{\partial x _ {i}} - p _ {k j} p _ {i j} \frac {\partial q _ {i j}}{\partial x _ {i}} \\ = p _ {k j} [ \delta_ {i k} - p _ {i j} ] \frac {\partial q _ {i j}}{\partial x _ {i}} \\ \end{array} +$$ + +and + +$$ +\begin{array}{l} \frac {\partial p _ {i l}}{\partial x _ {j} ^ {\prime}} = \frac {1}{\alpha_ {l} ^ {2}} \Big (\exp (q _ {i l}) \frac {\partial q _ {i l}}{\partial x _ {j} ^ {\prime}} \alpha_ {l} \\ - \exp (q _ {i l}) \delta_ {j l} \sum_ {k} \exp (q _ {k l}) \frac {\partial q _ {k l}}{\partial x _ {j} ^ {\prime}}) \\ = p _ {i l} \frac {\partial q _ {i l}}{\partial x _ {j} ^ {\prime}} - p _ {i j} \delta_ {j l} \sum_ {k} p _ {k j} \frac {\partial q _ {k j}}{\partial x _ {j} ^ {\prime}} \\ = \delta_ {j l} p _ {i j} \left(\frac {\partial q _ {i j}}{\partial x _ {j} ^ {\prime}} - \mathbb {E} _ {j} \left[ \frac {\partial q _ {: j}}{\partial x _ {j} ^ {\prime}} \right]\right) \\ \end{array} +$$ + +# A.2. Gradient Propagation Rule for Attention Heads + +We recall that the attention head stated in Section 3.1 produces the output + +$$ +y _ {j} = \sum_ {i} x _ {i} p _ {i j}. +$$ + +We then state the multivariate chain rule for propagating gradients into tokens of the first sequence and resolve local derivatives, making use in particular of the preliminary derivations of Appendix A.1: + +$$ +\begin{array}{l} \frac {\partial f}{\partial x _ {i}} = \sum_ {j} \left(\frac {\partial y _ {j}}{\partial x _ {i}} + \sum_ {k} \frac {\partial p _ {k j}}{\partial x _ {i}} \frac {\partial y _ {j}}{\partial p _ {k j}}\right) \frac {\partial f}{\partial y _ {j}} \\ = \sum_ {j} p _ {i j} \frac {\partial f}{\partial y _ {j}} + \sum_ {j k} p _ {k j} \left[ \delta_ {i k} - p _ {i j} \right] \frac {\partial q _ {i j}}{\partial x _ {i}} x _ {k} ^ {\top} \frac {\partial f}{\partial y _ {j}} \\ = \sum_ {j} p _ {i j} \frac {\partial f}{\partial y _ {j}} + \sum_ {j} p _ {i j} \frac {\partial q _ {i j}}{\partial x _ {i}} (x _ {i} - \mathbb {E} _ {j} [ x ]) ^ {\top} \frac {\partial f}{\partial y _ {j}} \\ \end{array} +$$ + +Similarly, we get for the second sequence: + +$$ +\begin{array}{l} \frac {\partial f}{\partial x _ {j} ^ {\prime}} = \sum_ {l} \sum_ {i} \frac {\partial p _ {i l}}{\partial x _ {j} ^ {\prime}} \frac {\partial y _ {l}}{\partial p _ {i l}} \frac {\partial f}{\partial y _ {l}} \\ = \sum_ {l} \sum_ {i} \delta_ {j l} p _ {i j} \left(\frac {\partial q _ {i j}}{\partial x _ {j} ^ {\prime}} - \mathbb {E} _ {j} \left[ \frac {\partial q _ {: j}}{\partial x _ {j} ^ {\prime}} \right]\right) x _ {i} ^ {\top} \frac {\partial f}{\partial y _ {l}} \\ = \sum_ {i} p _ {i j} \left(\frac {\partial q _ {i j}}{\partial x _ {j} ^ {\prime}} - \mathbb {E} _ {j} \left[ \frac {\partial q _ {: j}}{\partial x _ {j} ^ {\prime}} \right]\right) x _ {i} ^ {\top} \frac {\partial f}{\partial y _ {j}} \\ = \mathbb {E} _ {j} \left[ \left(\frac {\partial q _ {: j}}{\partial x _ {j} ^ {\prime}} - \mathbb {E} _ {j} \left[ \frac {\partial q _ {: j}}{\partial x _ {j} ^ {\prime}} \right]\right) x ^ {\top} \right] \frac {\partial f}{\partial y _ {j}}. \\ \end{array} +$$ + +# A.3. Relevance Conservation + +Computing the relevance for the first sequence + +$$ +\begin{array}{l} \sum_ {i} \mathcal {R} (x _ {i}) = \sum_ {i} x _ {i} ^ {\top} \frac {\partial f}{\partial x _ {i}} \\ = \sum_ {j} \mathcal {R} (y _ {j}) + \sum_ {i j} p _ {i j} x _ {i} ^ {\top} \frac {\partial q _ {i j}}{\partial x _ {i}} (x _ {i} - \mathbb {E} _ {j} [ x ]) ^ {\top} \frac {\partial f}{\partial y _ {j}} \\ = \sum_ {j} \mathcal {R} (y _ {j}) + \sum_ {j} \mathbb {E} _ {j} \left[ q _ {: j} \cdot (x - \mathbb {E} _ {j} [ x ]) ^ {\top} \right] \frac {\partial f}{\partial y _ {j}} \\ \end{array} +$$ + +and for the second sequence + +$$ +\begin{array}{l} \sum_ {j} \mathcal {R} \left(x _ {j} ^ {\prime}\right) = \sum_ {j} x _ {j} ^ {\prime \top} \frac {\partial f}{\partial x _ {j} ^ {\prime}} \\ = \sum_ {j} x _ {j} ^ {\prime} ^ {\top} \mathbb {E} _ {j} \left[ \left(\frac {\partial q _ {: j}}{\partial x _ {j} ^ {\prime}} - \mathbb {E} _ {j} \left[ \frac {\partial q _ {: j}}{\partial x _ {j} ^ {\prime}} \right]\right) x ^ {\top} \right] \frac {\partial f}{\partial y _ {j}} \\ = \sum_ {j} \mathbb {E} _ {j} \left[ (q _ {: j} - \mathbb {E} _ {j} [ q _ {: j} ]) x ^ {\top} \right] \frac {\partial f}{\partial y _ {j}}, \\ \end{array} +$$ + +and summing the two scores, we obtain: + +$$ +\begin{array}{l} \sum_ {i} \mathcal {R} (x _ {i}) + \sum_ {j} \mathcal {R} \left(x _ {j} ^ {\prime}\right) \\ = \sum_ {j} \mathcal {R} \left(y _ {j}\right) + \sum_ {j} \left(\mathbb {E} _ {j} \left[ \left(q _ {: j} - \mathbb {E} _ {j} \left[ q _ {: j} \right]\right) x ^ {\top} \right] \right. \\ \left. + \mathbb {E} _ {j} \left[ q _ {: j} \cdot (x - \mathbb {E} _ {j} [ x ]) ^ {\top} \right]\right) \frac {\partial f}{\partial y _ {j}} \\ \end{array} +$$ + +Making the further assumption that the first sequence of tokens and the softmax input both have expected value zero, we obtain the simplified form: + +$$ +\begin{array}{l} \sum_ {i} \mathcal {R} (x _ {i}) + \sum_ {j} \mathcal {R} (x _ {j} ^ {\prime}) \\ = \sum_ {j} \mathcal {R} (y _ {j}) + \sum_ {j} 2 \operatorname {C o v} _ {j} (q _ {: j}, x) ^ {\top} \frac {\partial f}{\partial y _ {j}} \\ \end{array} +$$ + +# B. Derivations for LayerNorm + +The core part of LayerNorm can be decomposed into two parts: + +$$ +\widetilde {x} _ {i} = x _ {i} - \mathbb {E} [ x ] \tag {10} +$$ + +$$ +y _ {i} = \frac {\widetilde {x} _ {i}}{\sqrt {\epsilon + \mathbb {E} [ \widetilde {x} ^ {2} ]}} \tag {11} +$$ + +i.e. a centering followed by a rescaling, where $\mathbb{E}[\cdot ]$ is computed over a uniform distribution, i.e. $\mathbb{E}[x] = \frac{1}{N}\sum_{i}x_{i}$ + +# B.1. Centering step + +We first analyze GI relevance conservation in the centering step. For this, we make use of Eq. (4) of the main paper, and perform a summation over input variables on both sides: + +$$ +\sum_ {i} \mathcal {R} \left(x _ {i}\right) = \sum_ {i} \sum_ {j} \frac {\partial \widetilde {x} _ {j}}{\partial x _ {i}} \frac {x _ {i}}{\widetilde {x} _ {j}} \mathcal {R} \left(\widetilde {x} _ {j}\right) \tag {12} +$$ + +Observing that $\widetilde{x}_j(x)$ is a homogeneous function of degree one, and that consequently $\sum_{i}x_{i}\frac{\partial\widetilde{x}_{j}}{\partial x_{i}} = \widetilde{x}_{j}$ for all $j$ , Eq. (12) reduces to + +$$ +\sum_ {i} \mathcal {R} \left(x _ {i}\right) = \sum_ {i} \mathcal {R} \left(\widetilde {x} _ {i}\right) \tag {13} +$$ + +# B.2. Rescaling step + +We now analyze conservation in the rescaling part of Layer-Norm. The local derivative is given by: + +$$ +\begin{array}{l} \frac {\partial y _ {j}}{\partial \widetilde {x} _ {i}} = \frac {\delta_ {i j}}{\sqrt {\epsilon + \mathbb {E} [ \widetilde {x} ^ {2} ]}} - \frac {\widetilde {x} _ {j}}{\left(\sqrt {\epsilon + \mathbb {E} [ \widetilde {x} ^ {2} ]}\right) ^ {2}} \\ = \frac {\delta_ {i j}}{\sqrt {\epsilon + \mathbb {E} [ \widetilde {x} ^ {2} ]}} - \frac {\frac {1}{N} \widetilde {x} _ {i} \widetilde {x} _ {j}}{\left(\sqrt {\epsilon + \mathbb {E} [ \widetilde {x} ^ {2} ]}\right) ^ {3}} \\ \end{array} +$$ + +We can now analyze conservation by applying Eq. (4) of the paper: + +$$ +\begin{array}{l} \sum_ {i} \mathcal {R} (\widetilde {x} _ {i}) = \sum_ {i} \sum_ {j} \frac {\partial y _ {j}}{\partial \widetilde {x} _ {i}} \frac {\widetilde {x} _ {i}}{y _ {j}} \mathcal {R} (y _ {j}) \\ = \sum_ {i} \sum_ {j} \left(\frac {\delta_ {i j}}{\sqrt {\epsilon + \mathbb {E} [ \tilde {x} ^ {2} ]}} \right. \\ - \left. \frac {\frac {1}{N} \widetilde {x} _ {i} \widetilde {x} _ {j}}{\left(\sqrt {\epsilon + \mathbb {E} \left[ \widetilde {x} ^ {2} \right]}\right) ^ {3}}\right) \frac {\widetilde {x} _ {i}}{y _ {j}} \mathcal {R} (y _ {j}) \\ = \sum_ {i} \sum_ {j} \left(\delta_ {i j} y _ {i} - \frac {1}{N} y _ {i} y _ {i} y _ {j}\right) \cdot \frac {1}{y _ {j}} \mathcal {R} (y _ {j}) \\ = \sum_ {j} \left(1 - \mathbb {E} \left[ y ^ {2} \right]\right) \mathcal {R} \left(y _ {j}\right) \\ = \left(1 - \frac {\mathbb {E} [ \widetilde {x} ^ {2} ]}{\epsilon + \mathbb {E} [ \widetilde {x} ^ {2} ]}\right) \sum_ {j} \mathcal {R} (y _ {j}) \\ \end{array} +$$ + +Hence, after combining with the centering step, we obtain the conservation equation: + +$$ +\sum_ {i} \mathcal {R} \left(x _ {i}\right) = \left(1 - \frac {\operatorname {V a r} [ x ]}{\epsilon + \operatorname {V a r} [ x ]}\right) \sum_ {i} \mathcal {R} \left(y _ {i}\right) \tag {14} +$$ + +where conservation holds only approximately for large values of $\epsilon$ . + +# C. Implementation Details + +For SST-2 and IMDB sentiment classification, the embeddings module and the tokenizer are initialized from pretrained BERT-Transformers (textattack/bert-base-uncased{sst-2/imdb}). We report the following test accuracies after optimization: $81.3\%$ for SST-2, $88.1\%$ on IMDB. For training, we use batchesizes of $bs = 32$ and optimize the model parameters using the AdamW optimizer with a learning rate of $lr = 2e - 5$ for a maximal number of $T = 20$ epochs or until early stopping for decreasing validation performance is reached. For the other NLP tasks we follow the same settings, except that we initialize the embedding model and the tokenizer from a HuggingFace pre-trained BERT-Transformer (bert-base-uncased). + +For the BACE and MNIST-Superpixels datasets, the recent Graphormer model is used. We train a 2-layer graphormer + +model with a batchsize of $bs = 64$ and AdamW as an optimizer with $lr = 2e - 4$ . The model is trained for 1000 epochs for the BACE dataset and 10 epochs for MNIST-Superpixels, achieving an accuracy of $97.2\%$ for MNIST, and a ROC-ACC of $83.5\%$ for BACE. + +# D. Additional Conservation Experiments + +In this section, we show the conservation experiment results for three additional baselines (GAE, Rollout and A-Flow). Results are shown in Fig. 8 for the SST-2 dataset. For A-Flow we use $30\%$ of the dataset. We observe that the conservation does not hold for these baseline explanation methods. + +![](images/92700acb4bc1cbc81de377b7ab6252c5f4d8f17781679436ba31321598725c8a.jpg) +Figure 8. Conservation experiment for additional explainability baselines used in the experiments. + +# E. Runtime Analysis + +In this section, we report the time needed for each explanation method to produce an explanation. Wall-clock elapsed time for running each method averaged over all of the samples on the SST-2 dataset (results are reported in seconds): random $6e - 5$ , A-Last 0.0002, Rollout 0.0004, GAE 0.016, GI 0.017, LRP(AH) 0.014, LRP(AH + LN) 0.012. (In comparison, prediction takes 0.024.) Our method is competitive with SOTA explanation techniques. + +# F. Additional Qualitative Results on SST-2 + +![](images/59e387935dfa067af96fa4c7c16ff58ae3e3c957c4543d635266758c887dd5f7.jpg) + +![](images/a5310845957b31c6683583b1df7c0baab949183a5addc94a5b0d81fdf2df79df.jpg) + +![](images/9a40a1496bba9a4cc61d8544c21ba61b445129962a2859f86353c7b71184a9b9.jpg) + +![](images/848ac42ee1f7c1ee92bfea720048517710ebcb1528072d496241baccf5a4b47d.jpg) + +![](images/adeca14dec34168355ed40e0704f05a666a29558fa11dc363fa0d456f09ebc51.jpg) + +![](images/b17548071afa47a0c287e69eacae638e6b93903c28695c134b7ff51c72dc9366.jpg) + +![](images/9b1618e2086b97cd4af62cdb4bbc2ab721e6a5ebae6f76438e5ae67d141e69df.jpg) + +![](images/d9c2ea989007856477006376dad96ef54c8ebde652ca313d7b7854971f77f7f0.jpg) + +# G. Additional Qualitative Results on MNIST Superpixels + +![](images/2a003eba49651cd82d1a7431c325b60671fcf73601a2ca0b2a5197bd3b4442e4.jpg) +A-Last + +![](images/a66848939391aad34604ecd591b6760d7c3cd7073a1396be03527e6c07b28259.jpg) +Rollout + +![](images/095aa5f97c7ea24b172a47c8d8a501e86e3d120f03d4482d582130f63a812c99.jpg) +GAE + +![](images/3a1f1e4d56fec338645d8d2fa36c9a516bf80f1e574aa4e16a704d48abc226ac.jpg) +A-Last + +![](images/6e5009d903f5232c0c57303476270073b657d3dd6d3a77cb9cd1864086f1df9c.jpg) +Rollout + +LRP (AH) + +![](images/ec2d45653bffced35511db9d6c2b070940ec8a2f58f76ccb9fdb348551711e8e.jpg) +GAE + +![](images/f229e14b97fb0e695a72d298bb19cddfbdb49eab754ce5cb8eec985c748ed392.jpg) +GI + +![](images/8a8886b3e2a4044d60f5b961833d85bf6184c739e8083ce10b91dfaeefee13e1.jpg) +LRP (AH) + +![](images/444bc1dd73736bde4b851735d2415a0386d5146ee5c70b3063af7fdab160ba81.jpg) +LRP (AH + LN) + +![](images/6396cd39fab14a514b3d15b70217ec26fba6860fb02b9fc04278e548c70253b4.jpg) +GI + +LRP (AH) + +![](images/a6da5cc0624acbc28015d4092730cdbc991326c06118db26f5a3981f689fef4f.jpg) + +![](images/3ac9c82e59af7246bacf4097570732b04fee583fea8efee6cd584a7f668980b1.jpg) +LRP (AH + LN) + +![](images/a28b65b2ab14ddad501a3433e1646ee014634639d1271fef4f0b71b6863c24ab.jpg) +A-Last + +![](images/1d962b9a2e2bef531a373bb6d07839a10fae1f8d9c66241f8ff62051dd0169e0.jpg) +Rollout + +![](images/6ff42d06c758dbf55bb1c7fce1ca62a21d499cd48c21795e8ee3394f314de91c.jpg) +GAE + +![](images/588ae8c36bf13ab413a7f2fd1fd861fa8a6d9944720d3466749cd41c67ad98fb.jpg) +A-Last + +![](images/2acdcab74aa2359e094f93a9efda02d49279f4e863968ca8e20ee334a5890d49.jpg) +Rollout + +![](images/20d024f1d1486ed139d547c3a24f61b7fa2cf1925256ee11fb446a7c5c2c7557.jpg) +GAE + +![](images/93134945fca68221ee9f669517881d4e4a3a7926cb83ca9984e4f0ccbba5dd40.jpg) +GI + +![](images/4b9bc7c09a7cff42080c44daa04f24fb2ab25c6a1fb97f55feca4119c747046f.jpg) +LRP (AH) + +![](images/a46006300028ebf33e23d0c11b1aa5737ea8deb9d97a202a93e5923813fee1a8.jpg) +LRP (AH + LN) + +![](images/1fed77a3e6124fc4f0c18e7eef0a9929b729c44ef46987daa872f3bffc401f70.jpg) +GI + +![](images/1138c576cd4b341555eeec31d6b68fb8861fb5a010acab9e12057795314a73f9.jpg) +A-Last + +![](images/6ca45660b94c5869b029f9d47b80b13e5a04573228424fc79e73fe861ce790a0.jpg) +LRP (AH) + +![](images/1cd69abc92a0c245e353ea990aa7c79dfa4e47b22c9db632587852f115ccb11c.jpg) +Rollout + +![](images/b040e6e95ea4e403e4d8a0d6e394e71317cd310810359d2445fcd5eabb53d557.jpg) +LRP (AH + LN) + +![](images/c18c0ac2946ffdd2c74d3d5393c4df79c2c8f744cf767a049800055e48e6a563.jpg) +GAE + +![](images/7455ff51b80a6691b1706476fee16f93f4b2d3a5313f3e561d7dbf4c442b3f61.jpg) +GI + +![](images/9a1501abd85477ec5c0b98ef9344f9f2bea402f54e64c95483465eee32f52979.jpg) +Rollout +LRP (AH) + +![](images/bbcbddbb7202d67271c6e36df58d786b17dfaa5134d46d0b53604ba1633fd711.jpg) +GAE +LRP $(\mathrm{AH} + \mathrm{LN})$ + +![](images/bbd0a6714155fa227988afc0dd3c4e32825277c953b2b1d7a496a6f6d9945fa3.jpg) +GI + +![](images/385c8f1f6a70691e7d508c9c69492a0a03f1793c0dc395cbe2b69edd9ca78224.jpg) +LRP (AH) + +![](images/d825cc6c81401c2aac4796a2e9f31a307c99b5d301dd79f48ecb9e589d73a484.jpg) +LRP (AH + LN) + +# H. Perturbation Experiments + +![](images/ab687d4ad6f434921b48313793c7b87556394a5595b476f4e23bd1eee74ce5b0.jpg) +IMDB + +![](images/9b971432ff07ee40f511d25ee5bc69860716e7816af782a7c7af1b32c23dee02.jpg) +Twitter-Emotions + +![](images/df896c0f2bf3c7349c11a4061cfe66c4ea6c0bcc9147659b686eca2d4f365c09.jpg) +Twitter-Sentiment + +![](images/073981ca14a0d445895e084b669e41889f6ce0bb8a4e2c9dae650f30e667a38f.jpg) +Twitter-Hate + +![](images/6ac3d6e51bd4fcb670bad856042cbaa9c121d5f77ae82b46671aa45c6b897022.jpg) +Semaine + +![](images/faeb6f0d18d718cbca2c02b7806458395c36bfdea2e9e959abbe058ad33d3714.jpg) +Meld-S \ No newline at end of file diff --git a/xaifortransformersbetterexplanationsthroughconservativepropagation/images.zip b/xaifortransformersbetterexplanationsthroughconservativepropagation/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..aa91a6232b13c35b607ade98bd16c669240a75ea --- /dev/null +++ b/xaifortransformersbetterexplanationsthroughconservativepropagation/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:77c7391a7375153a1637fd6c85686b3a1447cc0a9e97c4c6c2e23e8288a7dcb7 +size 1403324 diff --git a/xaifortransformersbetterexplanationsthroughconservativepropagation/layout.json b/xaifortransformersbetterexplanationsthroughconservativepropagation/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..f964bb0d47b5a5ef28ad1cd59b9822a1403144b0 --- /dev/null +++ b/xaifortransformersbetterexplanationsthroughconservativepropagation/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:195bd436a86d9bd7e133b211cc164cb9c75eb09b66bd14b0cd3e2c3db5c6d8f3 +size 671413 diff --git a/youonlycutonceboostingdataaugmentationwithasinglecut/e1a4c87c-244d-4125-b259-9db5870d8733_content_list.json b/youonlycutonceboostingdataaugmentationwithasinglecut/e1a4c87c-244d-4125-b259-9db5870d8733_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..fbb44b40236f0b79413f4f182bf1325e98aad9bc --- /dev/null +++ b/youonlycutonceboostingdataaugmentationwithasinglecut/e1a4c87c-244d-4125-b259-9db5870d8733_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a40472e94b71bb452b77410a2848cf6fdda31ff26bd9b9dda8a8a251cacf6db9 +size 117478 diff --git a/youonlycutonceboostingdataaugmentationwithasinglecut/e1a4c87c-244d-4125-b259-9db5870d8733_model.json b/youonlycutonceboostingdataaugmentationwithasinglecut/e1a4c87c-244d-4125-b259-9db5870d8733_model.json new file mode 100644 index 0000000000000000000000000000000000000000..82c0db90c0cdadf8cc5537c3211b1a15f5e796eb --- /dev/null +++ b/youonlycutonceboostingdataaugmentationwithasinglecut/e1a4c87c-244d-4125-b259-9db5870d8733_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f1c3ecb4e117db1a7a262a0d4114914810a3ef7ec5eb473186b1ede0b2ca1e91 +size 143327 diff --git a/youonlycutonceboostingdataaugmentationwithasinglecut/e1a4c87c-244d-4125-b259-9db5870d8733_origin.pdf b/youonlycutonceboostingdataaugmentationwithasinglecut/e1a4c87c-244d-4125-b259-9db5870d8733_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..d4c3bf00766b46a2fb43176aa30af76f8e485a86 --- /dev/null +++ b/youonlycutonceboostingdataaugmentationwithasinglecut/e1a4c87c-244d-4125-b259-9db5870d8733_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3df17aa994fb277dcd3a82fc85f248b67b3f0b28096b71822ab6b52fb2b88267 +size 2327288 diff --git a/youonlycutonceboostingdataaugmentationwithasinglecut/full.md b/youonlycutonceboostingdataaugmentationwithasinglecut/full.md new file mode 100644 index 0000000000000000000000000000000000000000..08427d6a494827fb160c547d2eabc7008f546f9c --- /dev/null +++ b/youonlycutonceboostingdataaugmentationwithasinglecut/full.md @@ -0,0 +1,476 @@ +# Junlin Han $^{123}$ Pengfei Fang $^{12}$ Weihao Li $^{1}$ Jie Hong $^{12}$ Mohammad Ali Armin $^{1}$ Ian Reid $^{3}$ Lars Petersson $^{1}$ Hongdong Li $^{2}$ + +# Abstract + +We present You Only Cut Once (YOCO) for performing data augmentations. YOCO cuts one image into two pieces and performs data augmentations individually within each piece. Applying YOCO improves the diversity of the augmentation per sample and encourages neural networks to recognize objects from partial information. YOCO enjoys the properties of parameter-free, easy usage, and boosting almost all augmentations for free. Thorough experiments are conducted to evaluate its effectiveness. We first demonstrate that YOCO can be seamlessly applied to varying data augmentations, neural network architectures, and brings performance gains on CIFAR and ImageNet classification tasks, sometimes surpassing conventional image-level augmentation by large margins. Moreover, we show YOCO benefits contrastive pre-training toward a more powerful representation that can be better transferred to multiple downstream tasks. Finally, we study a number of variants of YOCO and empirically analyze the performance for respective settings. Code is available at GitHub. + +# 1. Introduction + +Deep neural networks have been widely applied to various computer vision tasks such as image classification (He et al., 2016b; Krizhevsky et al., 2012; Simonyan & Zisserman, 2014), semantic segmentation (Long et al., 2015; Chen et al., 2014), and object detection (He et al., 2017; Girshick et al., 2014). However, with the rapid gains in computational resources, neural networks can easily overfit a training set with numerous images (Russakovsky et al., 2015), leading to a large generalization gap on test data. + +$^{1}$ Data61-CSIRO, Canberra, Australia $^{2}$ Australian National University, Canberra, Australia $^{3}$ University of Adelaide, Adelaide, Australia. Correspondence to: Junlin Han . + +Proceedings of the $39^{th}$ International Conference on Machine Learning, Baltimore, Maryland, USA, PMLR 162, 2022. Copyright 2022 by the author(s). + +![](images/e25730f0fbb1ec3394e683016b480012bd5043959749346fed3c8e24b236bca2.jpg) +Figure 1. YOCO cuts one image into two equal pieces, either in the height or the width dimension. The same data augmentations are performed independently within each piece. Augmented pieces are then concatenated together to form one single augmented image. The upper row shows the results of YOCO applied to Color jitter, where the two pieces are both augmented, producing a diversified fully-augmented image. The lower row presents the result of employing YOCO to Horizontal flip, only the left piece has been augmented, yielding a partially-augmented image. + +In addition, neural networks can be effortlessly fooled by adversarial examples or attacks (Hendrycks et al., 2021a; Madry et al., 2018). Thus, to improve the generalization performance and robustness of neural networks, multiple training strategies have been proposed mainly from two views: regularization techniques (Srivastava et al., 2014; Huang et al., 2016; Szegedy et al., 2016) and data augmentations (Krizhevsky et al., 2012). In this work, we focus on improving data augmentations in particular. + +Standard data augmentations are mostly performed at the image-level, which yields all-round performance improvements in both generality and robustness. Usually, image-level augmentation preserves semantics globally, following humans' cognitive intuition. Yet, human beings are also able to recognize objects from partial information alone. Patches, i.e., the internal information of images, are strong natural signals. Before the deep learning era, the power of patches has been exploited in many low-level vision (Efros & Leung, 1999; Kervrann & Boulanger, 2006) and high-level vision (Sivic & Zisserman, 2003; Csurka et al., 2004; Lazebnik et al., 2006) works. Recently, splitting one image into multiple non-overlapping patches as the input for neural networks is a key success of Vision Transformer (ViT) (Dosovitskiy et al., 2020). However, how to perform + +![](images/49386c0b8b2951b34b1cd57a981aba5e37ee6b1a370f90cf42918dea4bb21e57.jpg) +Original + +![](images/1a164d85f22794c7ca3f015dcfe9cad46ff6a5aff5e9fc96daeb4cb752c4391c.jpg) +Horizontal flip + +![](images/4308a82b2979e65ec17fa5a92bab74a2f054d45e1056b7f73e0bcf2f6ea72ed9.jpg) +Color jitter + +![](images/edbd5f22b4e77a39d8b4b93b3ed31228fea4b6f71a3670ebf8d9d0d927e08365.jpg) + +![](images/a669336b57fe2b37238e946bf99e72e16256d4bdf6c9bb991560669c0fb6b500.jpg) + +![](images/f078ebe478ba4c21c6be290f60598a9bdf304f397e4f7c61472c7a8654689efb.jpg) + +![](images/ebc65c59b19417a7624457fe372101039b18c0277463b4ac20cbfe54d6686ec1.jpg) + +![](images/c544ba1f4d0f56af5c7834f1dddf22891e19d9334fe4556e48a537bf818d960d.jpg) +Mixing image +Figure 2. Illustrations of the studied augmentations in classification tasks. We roughly classify data augmentations into five categories. For each category, we study the two most representative augmentations. We also combine two augmentations as a group, forming a new category named group of augmentations. + +![](images/4cd975741580d3510c9bb1604773ec52c47f82c32a74adc9046b10a706ffada5.jpg) +Vertical flip +Geometric transformation + +![](images/0b8aefd9d0f8197a45f820cae00f708ea6f69351b5316ec40479892bb692201d.jpg) +Gaussian blur Photometric transformation + +![](images/f3ee2d67ef2098312f04f7d2e2fbff150984a2610e02f086f7b21b0003b4e474.jpg) +Random erasing +Cutout Information dropping + +![](images/79c541a74d81a54088a98d84ea67373ed6393e3a78fb4b6132456766ef9c67ba.jpg) +AutoAug +RandAug Search-based + +![](images/b6eda7aa3a95198aff992a8e6bd8a8c15c1853597cfae6b617876c3862da9d93.jpg) +Mixup +CutMix Mix-based + +![](images/54c819751606082d6a0495dac668c921057e97884fa25cfb3b4d5715bfbce36a.jpg) +Jitter + AutoAug (G1) +Mixup + Erasing (G2) +Group + +data augmentations at a non-image level (in other words, patch-level or piece-level) is rarely studied. + +From the above, we hypothesize that it is desirable to propose a strategy of performing augmentations beyond the image level. An image can be seen as a combination of multiple patches, or even two pieces. For a specific augmentation, we may perform this augmentation on these pieces individually and combine transformed pieces back to a single image. Such a strategy should increase the diversity in both local regions level as well as at the holistic image level and may also encourage neural networks to share the same cognitive ability of recognizing objects from partial information like humans can. + +Following our hypothesis, we propose You Only Cut Once (YOCO), a simple method of performing data augmentations. Specifically, YOCO cuts one image into two equal pieces, in either the height dimension or the width dimension, performs data augmentations individually within each piece, and concatenates the two augmented pieces back together, as shown in Figure 1. + +We conduct extensive evaluations of YOCO on various augmentations, neural network architectures, datasets, and challenging tasks. For image classification tasks on CIFAR-10 and CIFAR-100, YOCO can be seamlessly applied to almost all (11 out of 12) data augmentations, where we evaluate YOCO with 7 neural network architectures and 12 augmentations. YOCO boosts 11 augmentations to train classification models with better generalization abilities. For ImageNet, we evaluate generality, partial image recognition, calibration, robustness against adversarial attacks, corruption robustness, and robustness under distribution shifts. The six most representative augmentations are evaluated + +(the first row of Figure 2). For every evaluation metric, YOCO outperforms image-level augmentation overall. + +Next, we study the effect of YOCO on contrastive pretraining and conduct experiments based on MoCo v2 (Chen et al., 2020b) and SimSiam (Chen & He, 2021). YOCO benefits the contrastive self-supervised representation learning, where a more powerful representation is produced, which can be better transferred to classification, object detection, and instance segmentation tasks. + +YOCO is parameter-free, easy to employ, and boosts almost all augmentations for free. As the presented YOCO is with the most simplified setting, we study some more complex design choices with more hyper-parameters embedded. Lastly, we analyze and study four questions (1): how does YOCO work? (2): when to employ YOCO? (3): why should we employ YOCO? and (4): does YOCO help other vision tasks? + +# 2. Related work + +# 2.1. Data Augmentation + +Data augmentation is an effective strategy for training neural networks. We roughly divide common data augmentations into five categories, and for each category, we choose the two most representative augmentations: (1) Geometric transformation (Horizontal flip and Vertical flip), (2) Photometric transformation (Color jitter and Gaussian blur), (3) Information dropping (Random erasing (Zhong et al., 2020) and Cutout (DeVries & Taylor, 2017)), (4) Search-based (AutoAug (Cubuk et al., 2018) and RandAug (Cubuk et al., 2020)), and (5) Mix-based (Mixup (Zhang et al., 2017) and CutMix (Yun + +et al., 2019)). To study the effect of YOCO applied to multiple augmentations, we further combine two augmentations as a group, forming category (6) group of augmentations (Color jitter + AutoAug (G1) and Mixup + Random erasing (G2)). Figure 2 presents all augmentations we studied. We leave feature-level augmentation (Upchurch et al., 2017; Wang et al., 2021) and GAN-based augmentation (Bowles et al., 2018) for future study. + +Search-based augmentation utilizes reinforcement learning to search from a pool of augmentation policies for an optimal combination. Mix-based augmentation employs multi-image information by creating mixed input images with soft labels for training. Augmentations are important for multiple vision tasks. For instance, recent contrastive learning methods (He et al., 2020; Chen et al., 2020a;b; Chen & He, 2021) relies heavily on multiple data augmentations to construct contrastive pairs. All these augmentations are previously performed at the image-level, we study how to perform augmentations at a non-image level in multiple vision tasks. + +# 2.2. Patches in Vision + +Patches have been widely used as strong signals for various vision tasks, in both conventional methods, and learning-based methods. Applications include texture synthesis (Efros & Leung, 1999), image denoising (Kervrann & Boulanger, 2006), image-to-image translation (Park et al., 2020; Han et al., 2021b), super-resolution (Shocher et al., 2018), bag-of-features based classification (Sivic & Zisserman, 2003; Csurka et al., 2004; Lazebnik et al., 2006). Recently, both CNNs and ViTs leverage patches as the input for classification networks (Brendel & Bethge, 2019; Dosovitskiy et al., 2020). + +Patches are also employed in data augmentation. For instance, Patch Gaussian (Lopes et al., 2019) applies Gaussian Blur to only a portion of the images. Cut, Paste and Learn (Dwibedi et al., 2017) generates large annotated instance datasets by cutting object instances and pasting them on backgrounds. Georgakis et al. (Georgakis et al., 2017) superimposes 2D object images into real environments images. CutMix (Yun et al., 2019) replaces one patch of an image with a patch from another image. PAA (Lin et al., 2021) extends the setting of AutoAug (Cubuk et al., 2018) by searching augmentation policies in pre-defined patches. Qin et al. (Qin et al., 2021) improves the robustness of ViTs through patch-based negative augmentation. However, no existing work has studied how to generally perform the same augmentation at a non-image level. + +# 3. Method + +This section presents the proposed YOCO method. Let $X \in \mathbb{R}^{C \times H \times W}$ denote an image and $a(\cdot)$ denote data augmentations, where $a(\cdot): \mathbb{R}^{C \times H \times W} \to \mathbb{R}^{C \times H \times W}, X' = a(X)$ . Here $X'$ is the augmented image and $a(\cdot)$ can be one of any data augmentations or multiple data augmentations. In contrast to standard image-level augmentation, which applies the augmentation to the image directly as $X' = a(X)$ , YOCO first cuts the image into two equally sized pieces, in either height or width dimension with equal probability, as + +$$ +\left[ \boldsymbol {X} _ {1}, \boldsymbol {X} _ {2} \right] = \operatorname {c u t} _ {\mathrm {H}} (\boldsymbol {X}), \text {i f} 0 < p \leq 0. 5, \text {s . t .} \boldsymbol {X} _ {i} \in \mathbb {R} ^ {C \times \frac {H}{2} \times W} +$$ + +or + +$$ +\left[ \boldsymbol {X} _ {1}, \boldsymbol {X} _ {2} \right] = \operatorname {c u t} _ {\mathrm {W}} (\boldsymbol {X}), \text {i f} 0. 5 < p < 1, \text {s . t .} \boldsymbol {X} _ {i} \in \mathbb {R} ^ {C \times H \times \frac {W}{2}}, +$$ + +where $p$ is sampled from $(0,1)$ uniformly (i.e., $p\in U(0,1))$ $\mathbf{X}_i$ are cut pieces, $\mathrm{cut}_{\mathrm{H}}(\cdot)$ and $\mathrm{cut}_{\mathrm{W}}(\cdot)$ represent the cut operation in the height dimension and the width dimension, respectively. + +Then $a(\cdot)$ is applied separately within each piece, and augmented pieces are concatenated back together as + +$$ +\boldsymbol {X} ^ {\prime} = \operatorname {c o n c a t} \left[ a _ {1} \left(\boldsymbol {X} _ {1}\right), a _ {2} \left(\boldsymbol {X} _ {2}\right) \right]. +$$ + +Augmentations are determined by randomness, which include random probabilities of being applied, random operations, and random magnitudes. Both $a_1(\cdot)$ and $a_2(\cdot)$ are instances of $a(\cdot)$ , though applying the same data augmentation $a(\cdot)$ , they may behave differently, thereby increasing the diversity in both the local region level and the holistic image level. + +YOCO presented so far is in the most simple format, where the number of cuts and the position of the cut are both fixed. We also formulate a more general format of YOCO. In the general setting, You Only Cut Once (YOCO) becomes You Cut Many Times, where $M$ cuts in the height dimension and $N$ cuts in the width dimension are applied, such that $(M + 1)*(N + 1)$ pieces of internal regions can be obtained as $\left[\mathbf{X}_1,\mathbf{X}_2,\dots,\mathbf{X}_{(N + 1)*M},\mathbf{X}_{(N + 1)*(M + 1)}\right] = \mathrm{cut}^{M*N}(\mathbf{X})$ , where the position of cuts can be chosen uniformly or randomly. The identical procedure is also applied to those pieces, by $\mathbf{X}' = \mathrm{concat}_{i = 1,j = 1}^{M + 1,N + 1}\left[a_{i*j}(\mathbf{X}_{i*j})\right]$ . + +# 4. Classification + +In this section, we evaluate YOCO for its capability to improve image classifiers in multiple classification settings. Firstly, we study the effect of YOCO on CIFAR-10 and CIFAR-100 (Krizhevsky et al., 2009) datasets among 7 different models (5 CNN and 2 ViT) and 12 augmentations. + +
ModelsGeometric trans H flipV flipPhotometric trans JitterBlurInformation dropping ErasingCutoutSearch-based AutoAugRandAugMix-based MixupCutMixGroup G1G2
PreResNet18 + YOco △4.64+0.415.905.52-0.384.794.70-0.095.295.00-0.294.324.28-0.044.664.36-0.303.713.38-0.334.184.08-0.103.233.11-0.123.453.38-0.073.693.56-0.133.633.25-0.38
Xception + YOco △4.62+0.295.205.11-0.094.524.51-0.015.314.65-0.664.074.070.004.153.94-0.213.563.31-0.254.013.95-0.063.703.17-0.533.663.22-0.444.043.32-0.723.413.20-0.21
DenseNet121 + YOco △4.58+0.515.215.09-0.034.724.70-0.025.094.76-0.334.174.13-0.044.554.25-0.303.833.67-0.164.223.91-0.313.713.28-0.433.533.50-0.033.983.50-0.483.573.36-0.21
ResNeXt50 + YOco △4.69+0.10+0.415.125.03-0.094.744.60-0.145.665.27-0.394.183.96-0.224.934.64-0.293.653.26-0.394.093.91-0.183.693.45-0.243.523.44-0.083.793.26-0.533.663.41-0.25
WRN-28-10 + YOco △3.51+0.024.104.09-0.013.633.44-0.193.993.97-0.022.922.89-0.033.262.96-0.302.722.62-0.103.233.05-0.182.602.46-0.142.862.82-0.042.752.65-0.102.792.35-0.44
ViT + YOco △4.69+0.235.515.34-0.174.744.70-0.045.494.95-0.544.324.18-0.144.444.42-0.023.763.54-0.224.133.96-0.173.673.17-0.503.493.21-0.283.823.51-0.313.273.14-0.13
Swin + YOco △4.83+0.025.275.25-0.024.904.40-0.505.155.12-0.034.264.23-0.034.554.03-0.523.633.54-0.094.154.13-0.023.563.16-0.403.643.22-0.423.743.44-0.303.583.46-0.12
Average △+0.27-0.11-0.14-0.32-0.07-0.28-0.22-0.15-0.34-0.19-0.37-0.25
+ +Table 1. Test top-1 error rate on CIFAR-10. We evaluate 12 augmentations on 7 network architectures. Among 84 results, 76 of them are improved by applying YOco. Improved results are highlighted in blue. Best viewed in color. Standard deviations lie in (0.04, 0.15). Average $\triangle$ is the difference between YOco and image-level augmentation, which is based on the mean of 21 independent runs in total. + +
ModelsGeometric trans H flipV flipPhotometric trans JitterBlurInformation dropping ErasingCutoutSearch-based AutoAugRandAugMix-based MixupCutMixGroup G1G2
PreResNet18 + YOco △23.36 + 24.66 +1.3025.16 24.73 -0.4323.95 23.62 -0.3325.96 25.11 -0.8524.03 23.94 -0.0925.01 23.41 -1.6021.94 20.55 -1.3922.70 22.70 0.0021.32 19.62 -1.7020.05 19.30 -0.7522.97 21.06 -1.9121.23 20.92 -0.31
Xception + YOco △23.34 + 24.46 +1.1225.16 24.65 -0.5123.39 23.42 +0.0326.17 25.51 -0.6625.01 23.74 -1.2725.44 23.56 -1.8822.50 20.29 -2.2122.87 22.45 -0.4221.41 19.96 -1.4520.17 19.25 -0.9223.02 20.75 -2.2721.79 20.68 -1.11
DenseNet121 + YOco △23.14 + 24.21 +1.0723.71 24.62 +0.9124.25 23.14 -1.1126.21 24.68 -1.5323.97 23.34 -0.6324.71 23.83 -0.8822.43 20.63 -1.8022.66 23.11 +0.4521.17 19.87 -1.3019.50 19.26 -0.2422.80 21.13 -1.6721.23 20.95 -0.28
ResNeXt50 + YOco △24.60 + 25.11 +0.5124.61 -24.22 -0.3923.58 23.76 +0.1825.86 25.66 -0.2024.50 23.51 -0.9924.84 23.77 -1.0722.32 21.01 -1.3122.77 22.47 -0.3020.78 19.74 -1.0419.72 19.68 -0.0422.69 20.58 -2.1121.69 20.55 -1.14
WRN-28-10 + YOco △19.90 + 20.44 +0.5421.70 21.34 -0.3619.54 19.59 +0.0521.95 21.17 -0.7819.79 19.65 -0.1419.73 19.68 -0.0518.07 17.17 -0.9019.25 19.29 +0.0418.93 17.64 -1.2917.03 17.29 +0.2618.39 18.89 -0.5017.74 17.72 -0.02
ViT + YOco △23.67 + 24.52 +0.8524.01 24.74 +0.7324.53 23.49 -1.0426.06 25.04 -1.0224.09 23.20 -0.8925.10 23.38 -1.7222.14 20.61 -1.5322.79 22.34 -0.4521.15 19.26 -1.8920.27 19.17 -1.1022.75 20.85 -1.9021.64 21.20 -0.44
Swin + YOco △23.57 + 24.66 +1.0924.51 24.37 -0.1424.04 23.96 -0.0825.49 25.39 -0.1024.81 23.22 -1.5925.11 23.86 -1.2522.30 20.70 -1.6023.14 22.62 -0.5221.42 19.43 -1.9919.78 19.74 -0.0422.92 20.75 -2.1721.26 20.88 -0.38
Average △+0.93-0.03-0.33-0.73-0.80-1.21-1.53-0.17-1.52-0.40-1.79-0.53
+ +Table 2. Test top-1 error rate on CIFAR-100, where 12 augmentations and 7 network architectures are evaluated. YOCO outperforms image-level augmentation in 68 results out of 84 results. blue indicates improved results. Best viewed in color. Standard deviations are between (0.09, 0.41). Average $\triangle$ is the difference between YOCO and image-level augmentation over 21 independent trials. + +Next, we validate YOCO on ImageNet-1K (henceforth referred to as ImageNet) (Russakovsky et al., 2015). Due to that ImageNet is a large-scale dataset containing more than 1.2M training images from 1K categories, we generally and thoroughly evaluate YOCO on ImageNet to explore its potential. + +# 4.1. CIFAR Experiments + +Experimental setup. We train 5 CNN architectures (Pre-ResNet18 (He et al., 2016a), Xception (Chollet, 2017), + +DenseNet121 (Huang et al., 2017), ResNeXt50 (Xie et al., 2017), WRN-28-10 (Zagoruyko & Komodakis, 2016)) and 2 ViT models (ViT (Dosovitskiy et al., 2020) and Swin (Liu et al., 2021)) under the same training recipe, which mostly follows the training setting used in Co-Mixup (Kim et al., 2021). That is, models are trained for 300 epochs, with an initial learning rate of 0.1 decayed by a factor 0.1 at epochs 100 and 200. We employ the SGD optimizer with a momentum of 0.9 and a weight decay of 0.0001. We use a batch size of 100, and models are trained on 2 GPUs. Training images are randomly cropped to $32 \times 32$ resolution with + +zero padding followed by random Horizontal flip. Other augmentations are added based on this setup. + +Results. We report the best results based the mean of three independent trials. Table 1 and Table 2 present the results on CIFAR-10 and CIFAR-100, respectively. On CIFAR-10, among 12 augmentations, YOCO boosts 11 of them, toward a more generalized image classifier. For all 84 results, YOCO improves 76 of them, showing the superiority generalization of YOCO over image-level augmentation. The improvements are non-trivial (average improvement $\geq$ $0.2\%$ ) for Blur, Cutout, AutoAug, Mixup, G1, and G2. On CIFAR-100, YOCO also boosts 11 augmentations, with 68 results improved. The improvements of applying YOCO are notable (average improvement $\geq$ $0.7\%$ ) for Blur, Erasing, Cutout, AutoAug, Mixup, and G1. + +For both CIFAR-10 and CIFAR-100, we also observe that applying YOco to Horizontal flip degrades the performance. We analyse the reasons empirically in Section 7. The computational cost and memory usage of YOco are both negligible. Compared to image-level augmentation, YOco runs at an identical speed. Thereby, YOco boosts nearly all augmentations for free. + +# 4.2. ImageNet Experiments + +Experimental setup. We follow a simple training recipe used in CutMix (Yun et al., 2019). In doing so, we train a standard ResNet50 (He et al., 2016b) for 300 epochs, with an initial learning rate of 0.1, decayed by a factor of 0.1 at epochs 75, 150, and 225. We employ the SGD optimizer with a momentum of 0.9 and models are trained with a weight decay of 0.0001. We employ a batch size of 256, and 4 GPUs are used for training. Training images are randomly cropped to $224 \times 224$ resolution followed by random Horizontal flip prior to any other augmentations. We evaluate and test 6 representative augmentations as shown in the first row of Figure 2. + +# 4.2.1. EVALUATION PROTOCOL + +For models trained on ImageNet, other than generalization, we also evaluate partial image recognition, calibration, robustness against adversarial attacks, corruption robustness, and robustness under distribution shifts. + +Partial image recognition. One design goal of YOCO is to inspire neural networks to share the same ability of recognizing objects from partial information like human can. We thus design a non-overlapping 4 crop evaluation. Specifically, we load test images in $512 \times 512$ resolution, and images are center cropped to $448 \times 448$ resolution, following the most common crop ratio of 0.875. We employ two cuts, one in the height dimension and one in the width dimension, to cut $448 \times 448$ images into 4 non-overlapping + +$224 \times 224$ resolution pieces. Four cropped pieces are evaluated and we report the mean of the results. + +Calibration. We follow the evaluation protocol used in PixMix (Hendrycks et al., 2021b). The calibration task aims to match the empirical frequency of correctness. The posteriors from a model should satisfy + +$$ +\mathbb {P} \left(Y = \arg \max _ {i} f (X) _ {i} \mid \max _ {i} f (X) _ {i} = C\right) = C, +$$ + +where $f$ is an image classifier, $X, Y$ are random variables representing the data distribution. We use RMS calibration error (Hendrycks et al., 2018) and adaptive binning (Nguyen & O'Connor, 2015). + +Adversarial attack. We employ two adversarial attacks, FGSM (Goodfellow et al., 2014) and PGD (Madry et al., 2018), to verify the robustness of image classifiers. We borrow the implementation from Torchattacks (Kim, 2020). For all attacks, we apply an $\ell_{\infty}$ budget of 8/255. PGD is with 4 steps of optimization. We do not use larger steps of optimization as the accuracy can decline to zero for nonadversarially trained image classifiers. + +Corruption robustness. Following Co-Mixup (Kim et al., 2021), we evaluate image classifiers on two challenging corrupted test sets, to verify the generalization ability and robustness on unseen environments. The corrupted test sets are created with the following operations: (1) replace the background with a random image and (2) adding Gaussian noise to the background. + +Distribution shift. We employ ImageNet-A (Hendrycks et al., 2021a), one of the most challenging ImageNet test sets containing natural adversarial examples, to verify the performance of image classifiers against input data distribution shifts. + +# 4.2.2. RESULTS + +We report both best and last results. All results are summarized in Table 3. Visualizations on classification results are available in the Appendix D. + +Generality. Among 5 tested augmentations, YOCO outperforms image-level augmentation in terms of generalization. Considering its negligible cost, such improvement brought from YOCO is huge. For example, applying YOCO to Horizontal flip and AutoAug improves the last top-1 accuracy by $0.42\%$ and $0.72\%$ respectively. + +Partial image recognition. YOCO improves the ability of image classifiers in recognizing objects from partial information. YOCO applied to 5 augmentations can reach improved performance. For Random erasing, dissimilar to other augmentations, applying YOCO does not involve changing the structure/consistency of images, thereby the partial image recognition ability is not improved. + +
AugsGeneralization CleanPartial CleanCalibration Clean, RMS↓Adversarial attacksCorruptionsDistribution shift ImageNet-A
FGSM attackPGD attackRandom replaceGaussian noise
H flip77.10/76.5955.21/56.146.42/8.8117.28/21.019.37/14.9858.90/58.7773.58/72.923.39/4.29
+ YOCO77.28/77.0156.27/56.447.87/8.1920.59/21.8814.21/15.2159.11/58.9173.63/72.963.80/4.32
△+0.18/+0.42+1.06/+0.30+1.45/-0.62+3.31/+0.87+4.84/+0.23+0.21/+0.14+0.05/+0.04+0.41/+0.03
Jitter77.15/76.8756.04/56.348.06/8.1918.31/18.8011.07/11.8959.11/58.8273.74/73.383.98/4.13
+ YOCO77.35/77.1256.41/56.607.50/8.0716.32/17.775.96/6.9059.40/59.3274.46/74.144.29/4.56
△+0.20/+0.25+0.37/+0.26-0.56/-0.12-1.99/-1.03-5.11/-4.99+0.29/+0.50+0.72/+0.76+0.31/+0.43
Erasing77.40/77.0956.75/56.827.67/7.8822.01/22.6712.74/13.3158.75/58.4473.81/73.484.11/4.32
+ YOCO77.29/77.2056.66/56.767.57/8.0022.34/22.8212.93/14.0058.80/58.8573.95/73.594.12/4.28
△-0.11/+0.11-0.09/-0.06-0.10/+0.12+0.33/+0.15+0.19/+0.69+0.05/+0.41+0.14/+0.11+0.01/-0.04
AutoAug77.55/76.9355.61/55.056.17/6.7311.51/11.622.05/2.1858.36/58.1274.45/73.854.54/4.69
+ YOCO77.88/77.6556.48/56.526.04/6.2512.09/11.731.11/0.8658.90/58.2976.03/75.705.01/4.80
△+0.33/+0.72+0.87/+1.47-0.13/-0.48+0.58/+0.11-0.94/-1.32+0.54/+0.17+1.58/+1.85+0.47/+0.11
Mixup77.72/77.6755.27/55.408.23/9.0335.92/35.417.90/7.4461.46/61.0775.47/75.128.37/8.59
+ YOCO77.81/77.7456.00/55.974.04/4.4239.63/39.6713.02/13.6361.14/60.8575.10/74.888.27/8.55
△+0.09/+0.07+0.73/+0.57-4.19/-4.61+3.71/+4.26+5.12/+6.19-0.32/-0.22-0.37/-0.24-0.10/-0.04
G177.61/77.1955.57/55.246.29/6.1913.11/13.222.34/2.8758.94/58.9975.22/74.945.01/5.22
+ YOCO77.76/77.6456.00/55.976.17/6.0213.62/13.611.82/2.6159.15/59.0375.73/75.595.41/5.47
△+0.15/+0.45+0.43/+0.73-0.12/-0.17+0.51/+0.39-0.52/-0.26+0.21/+0.04+0.51/+0.65+0.40/+0.25
+ +Table 3. Results of applying YOCO to train a ResNet50 on ImageNet. We evaluate generalization (top-1 accuracy), partial image recognition (top-1 accuracy), calibration (RMS), robustness against adversarial attacks (top-1 accuracy), corruption robustness (top-1 accuracy), and robustness under distribution shifts (top-1 accuracy). We report both best result (left) and last result (right). Improved results are highlighted in blue color. Best viewed in color. $\triangle$ is the difference between YOCO and image-level augmentation. + +Calibration. In terms of calibration, YOCO improves 4 augmentations. For Horizontal flip, the RMS of best result is increased from 6.42 to 7.87, while the last result conversely benefits from YOCO. Epoch 171 produces the best result for image-level augmentation while the best result after applying YOCO is at epoch 235. The inconsistent results are might due to classification models does not suffer from overfitting and overconfidence in the middle stage of training. To conclude, YOCO helps image classifiers to have better-calibrated predictions most of the time. + +Adversarial attack. For robustness against adversarial attacks, augmentations that do not involve color transformations usually benefit from YOCO, where YOCO hurts the robustness when applied to Color Jitter, AutoAug, and G1, but is helpful for all other augmentations. YOCO applied to color transformations breaks the color consistency of images. We suppose this property is not good for defending adversarial attacks. YOCO still performs well overall, as applying YOCO can be effectual for other augmentations, where YOCO approximately doubles the results of Mixup under PGD attack. + +Corruption robustness. YOCO consistently shows better performance when evaluated with challenging corrupted images. 5 augmentations are boosted by YOCO. The improvements are particularly considerable for AutoAug, where the best top-1 accuracy is improved with the performance margins of $0.54\%$ and $1.58\%$ for Random replacement and Gaussian noise correspondingly. This suggests that when only partial information is available, YOCO with better ability in recognizing partial objects behaves more robustly. + +Distribution shift. Testing with the challenging ImageNet-A test set, YOCO again outperforms image-level augmentations overall. Improving the results on ImageNet-A is + +difficult, but applying YOCO to augmentations including Horizontal flip, Color jitter, AutoAug, and G1 realizes improved results, showing the superiority of YOCO. + +Reported results. We find that the ResNet50 implemented in timm (Wightman, 2019) yields a better performance than Pytorch/Torchvision inbuilt ResNet50 and original ResNet50 implemented in (He et al., 2016b). For a fair comparison, all ImageNet experiments are based on the timm implementation. For image-level augmentation, we report our reproduced results. Our reproduced results are usually higher than previously reported results. For instance, the best Top-1 accuracy for Horizontal flip is reported as $77.1\%$ by us, while being previously (same training recipe) reported as $76.3\%$ (Yun et al., 2019). + +# 5. Contrastive Learning + +One core step of contrastive learning is to create two views from one image by data augmentations. YOCO increases the diversity of data, applying YOCO to contrastive learning yields more challenging views. However, strong augmentations are usually not beneficial to contrastive learning (Chen et al., 2020a). In this section, we verify whether YOCO benefits MoCo v2 (Chen et al., 2020b) and SimSiam (Chen & He, 2021) in the pre-training stage. The learned embedding is evaluated via multiple downstream tasks. Specifically, we evaluate the classification performance on ImageNet, under both the linear protocol and semi-supervised fine-tuning settings. The downstream tasks include VOC (Everingham et al., 2010) detection, COCO (Lin et al., 2014) detection and COCO instance segmentation. + +
MethodImageNet classificationVOC detectionCOCO detectionCOCO instance seg
linear protocol1% label10% labelAP50APAP75AP50APAP75APmask50APmaskAPmask75
MoCo v267.534.561.181.956.862.957.338.040.854.133.335.5
+YOCO67.634.961.582.456.663.657.438.141.654.133.435.5
SimSiam68.117.157.380.254.560.051.433.536.148.729.932.0
+YOCO68.317.357.780.254.560.153.134.637.350.130.832.9
+ +# 5.1. Experimental Setup + +Pre-training. We first apply YOCO to Horizontal flip only. Following the training setting introduced in MoCo v2 and SimSiam, we pre-train them with YOCO for 200 and 100 epochs respectively. The models are pre-trained following the same settings as their own base methods. The backbone is ResNet50. More details of training settings are provided in the Appendix C. + +Linear protocol. We freeze the learned embedding and train a linear classifier on top of it. The experimental setting are identical to the same settings as their own base methods. + +Fine-tuning. We also fine-tune the learned feature under the semi-supervised setting on ImageNet with $1\%$ and $10\%$ label fractions, where labels are provided by SimCLR (Chen et al., 2020a). The fine-tuning setting follows Jigsaw Clustering (Chen et al., 2021). + +VOC detection. We mostly follow the setting used in MoCo. Faster R-CNN (Ren et al., 2015) with the C4-backbone is fine-tuned on VOC 2007 trainval + 2012 train and evaluated on the VOC 2007 test. Due to a GPU limit, all experiments are conducted using 4 GPUs, whereas 8 GPUs are used in MoCo. We halve the batch size from 16 to 8, double the max iterations from 24K to 48K, and scale the base learning rate from 0.02 to 0.01. All reported results are the average over 3 trials under this setting. The results of MoCo v2 and SimSiam baseline are reproduced by us using the corresponding official pre-trained ResNet50 models. + +COCO detection and instance segmentation. Following MoCo, the model is Mask R-CNN (He et al., 2017) with a C4 backbone. Similar to VOC, batch size and base learning rate are halved while the maximum iteration is doubled, from 90K to 180K. The results of baselines are also reproduced by us under this setting. + +# 5.2. Results + +Table 4 depicts the results. Among multiple tasks, both MoCo v2 and SimSiam benefit from YOCO. + +The effect of YOCO applied to other augmentations is also studied, where we gradually increase the number of augmentations that are being applied with YOCO, specifically, we study YOCO applied to (1): Horizontal + +Table 4. Results of contrastive learning. MoCo v2 and SimSiam are pre-trained for 200 and 100 epochs in ImageNet, respectively. All are based on ResNet50 pre-trained with two $224\times 224$ views. The evaluation metric of ImageNet classification is Top-1 accuracy. + +
MethodImageNet classificationVOC detection
linear protocol1% label10% labelAP50APAP75
MoCo v267.534.561.181.956.862.9
(1)67.634.961.582.456.663.6
(2)67.334.861.382.556.963.4
(3)67.234.561.282.456.662.7
(4)67.034.461.082.156.061.9
+ +Table 5. The effect of YOCO applied to multiple augmentations in contrastive learning. We study YOCO applied to (1): Horizontal flip, (2): Horizontal flip + Gaussian blur, (3): Horizontal flip + Gaussian blur + Grayscale, and (4): Horizontal flip + Gaussian blur + Grayscale + Color jitter. + +flip, (2): Horizontal flip + Gaussian blur, (3): Horizontal flip + Gaussian blur + Grayscale, and (4): Horizontal flip + Gaussian blur + Grayscale + Color jitter. The results are presented in Table 5, where YOCO applied to more augmentations hurts the learned representation, suggesting that crafting more challenging views in moderation is helpful for contrastive representation learning. + +Detailed training settings are provided in the Appendix C. + +# 6. Ablation study + +The concept of YOCO is presented in a simple way, where YOCO only involves one cut and the position of that cut is fixed. The general format of YOCO may involve multiple cuts and random positions of cuts. It naturally gives rise to questions like: Will it be beneficial if the position of the cut varies? How many cuts are needed to boost data augmentations? In this section, we aim to explore the optimal setting of YOCO. + +Experiments are performed on the CIFAR-100 dataset. All reported results are the mean of PreResNet18 and DenseNet121. We study 5 augmentations (the first row of Figure 2, except for G1). + +Position of the cut. We employ the beta distribution $\text{Beta}(\alpha, \alpha)$ to sample the position of the cut, where we set $\alpha$ as 0.2, 0.4, 0.6, 0.8, and 1.0. The results are presented in Table 6. Compared to the fixed position, randomly sampled positions can be better applied to Horizontal flip and AutoAug but hurt the performance of being applied to Color jitter, Erasing, and Mixup. As + +the position of the cut behaves differently with augmentations, it is hard to select the optimal position. Designing an augmentation-specific strategy to select the optimal position of the cut might be a potential way to further improve the performance of YOCO. + +
αAugmentations
H flipJitterErasingAutoAugMixup
0.276.276.375.979.879.7
0.475.976.575.879.879.7
0.676.576.476.379.979.8
0.876.476.375.979.879.5
1.076.476.275.780.279.4
YOCO75.676.676.479.480.3
+ +Number of cuts. For both cuts in the height dimension and the width dimension, we set the number of cuts to 1, 2, and 3. We report the results of all combinations in Table 7. For all augmentations, increasing the number of cuts hurts the performance. More cuts further increase the diversity of data, yielding the data to be too complex to learn from. This is particularly obvious when augmentations involve geometric transforms, as the semantic consistency is often corrupted when a large number of cuts are applied. For large-scale datasets such as ImageNet, we also observe a similar trend. Thus, You Only Cut Once is sufficient. + +Table 6. Position of the cut. Test top-1 accuracy on CIFAR-100 are reported. We randomly sample the position of the cut from a beta distribution $\mathrm{Beta}(\alpha, \alpha)$ . + +
Number H,WAugmentations
H flipJitterErasingAutoAugMixup
1,170.876.176.077.879.4
1,269.175.976.077.279.2
1,368.075.575.976.779.2
2,169.776.575.976.980.1
2,268.775.975.676.579.6
2,367.975.775.676.279.5
3,169.975.975.877.080.2
3,267.675.875.576.379.8
3,367.475.275.576.079.6
YOCO75.676.676.479.480.3
+ +# 7. Analysis and Discussion + +# 7.1. How Does YOCO Work? + +We classify training data into two main categories, namely original data and augmented data, where the augmented data involves fully-augmented data, partially-augmented data, and diversified fully-augmented data. In most cases, YOCO is capable of creating two additional kinds of augmented data than image-level augmentation, partially-augmented data, and diversified fully-augmented data, as shown in Figure 1. We study the effect of YOCO by exploring the performance of classifiers trained with each kind of data solely. Results are summarized in Table 8. + +Table 7. Number of cuts. We report test top-1 accuracy on CIFAR-100. The number of cuts are set to 1, 2, or 3 for both height dimension and width dimension. + +
CombinationAugmentations
H flipJitterErasingMixup
Original72.776.876.876.8
Fully-aug71.776.276.578.8
Partially-aug74.276.576.579.6
Diversified fully-aug72.576.376.979.7
+ +Table 8. How does YOCO work? Test top-1 accuracy on CIFAR-100. We train image classifiers with one kind of data solely. + +Trained with one kind of data solely, partially-augmented data and diversified fully-augmented data both outperform fully-augmented data. This might be the reason for the superior performance of YOCO, where these two kinds of data further increase the diversity of augmented data, such that neural networks can learn more meaningful knowledge. + +# 7.2. When to Employ YOCO? + +We focus on studying when to employ YOCO in classification tasks. From both CIFAR and ImageNet results, YOCO outperforms image-level augmentation among most augmentations. However, YOCO applied to Horizontal flip hurts the performance of image classifiers on the CIFAR dataset. CIFAR mostly contains iconic object images, that is, the object, as a foreground part, occupies to most of the image. We hypothesise that YOCO applied to Horizontal flip ruins the structure/consistency of iconic object images. For more complex images (either more objects or more background components) such as ImageNet, YOCO can be applied to Horizontal flip, as the structural information for the foreground object can be kept in more cases, while the image diversity regarding background/object location is improved. Also, the random resized crop pre-processing plays an important role, as it may change a non-iconic object image to a iconic object image and vice versa. + +To verify our hypothesis, we evaluate on Oxford Flower102 (Nilsback & Zisserman, 2008) (fine-grained flower classification dataset containing iconic flower images) and $10\%$ ImageNet. Results are presented in Figure 3. For iconic object images, YOCO is better than image-level augmentation only when a wider crop range is employed while YOCO always performs better on non-iconic object images. Thereby we conclude that for most augmentations, YOCO can outperform image-level augmentation, but for Horizontal flip YOCO should be employed depending on the properties and crop ratio of the dataset. + +# 7.3. Why Should We Employ YOCO? + +In the real-world environment, it is impossible to guarantee complete images as the source of inputs. That said, for a robust vision system applied in real-world practice, having the ability to recognize partial patterns is a must. In + +![](images/af2fd8149e65ca8db858d19b0d768acda897552eb5591bb63677ebc919b54e15.jpg) +Figure 3. When to employ YOCO? Results of Horizontal flip performed with image-level augmentation and YOCO on Oxford Flower102 (left) and $10\%$ ImageNet (right). We test multiple crop scale $(\alpha, 1)$ . + +common practice, neural networks mostly gain such ability from the random resized crop. Applying YOCO to multiple augmentations further equips neural networks to have stronger partial recognition abilities, which also result in better holistic level recognition abilities for the neural networks. + +YOCO is a booster for training more robust vision systems that can be applied in varying complex real scenarios. YOCO also serves as a free plug-and-play for various vision tasks, where no extra computation costs are brought, no parameters need to be manually selected, and no complicated implementation is required. + +# 7.4. Does YOCO Help Other Vision Tasks? + +YOCO boosts data augmentation in multiple high-level vision tasks, trained from scratch, or transferred from contrastive pre-training. We thus study whether YOCO helps other vision tasks, where we employ image deraining (Zamir et al., 2021; Han et al., 2021a) and image super-resolution (Yoo et al., 2020), two representative low-level vision tasks, to further verify the generality of YOCO. + +Image deraining: We include two augmentations, Horizontal flip and Vertical flip, along with YOCO, to the training process of MPRNet (Zamir et al., 2021). Besides the augmentations, MPRNet is trained with the identical dataset (synthetic rain dataset (Zamir et al., 2021) with 13712 pairs) and training settings. Results are presented in Table 9. Our gain over the baseline is 0.73dB on the Rain100L test set. + +
MethodsTest100Rain100HRain100LTest2800Test1200Average
MPRNet30.2730.4136.4033.6432.9132.73
+ YOco30.3330.5337.1333.6432.8432.89
+ +Image super-resolution: Following CutBlur (Yoo et al., 2020), we evaluate YOco applied to mixture of augmen + +tations (Cutout, CutMix, Mixup, CutMixup, RGB perm, Blend, and CutBlur) on two common datasets, DIV2K (Agustsson & Timofte, 2017) and RealSR (Cai et al., 2019). All experiments are conducted using the CARN (Ahn et al., 2018) model, where the training settings follows CutBlur but without pre-training on DIV2K in $\times 2$ scale. In the synthetic training setting, models trained on the DIV2K dataset are evaluated on multiple test sets. Table 10 presents the results, where YOCO consistently outperforms image-level augmentation regardless of test sets in the synthetic setting, and shows on par performance in the realistic setting. + +Table 9. Image deraining. PSNR results of YOCO applied to image deraining tasks. We choose the state-of-the-art MPRNet as our baseline. Results are further improved with YOCO. + +
AugSyntheticRealistic
DIV2KSet14Urban100Manga109RealSR
No aug28.8328.4925.8230.1128.78
+ Image-level28.8328.4825.8230.0828.99
+YOCCO28.8428.5025.8330.1128.99
+ +Table 10. Super-resolution. Quantitative comparison (PSNR) on super-resolution (scale $\times 4$ ) task in both synthetic and realistic settings. We evaluate the performance of image-level augmentation and YOCO applied to mixture of augmentations (7 in total). + +We believe that our results on low-level vision further validate the generality and robustness of YOCO. + +# 8. Limitation + +Though thorough empirical results show the superiority and generality of YOCO, the theoretical foundation can be further developed for shedding light on the interpretability of YOCO. Additionally, applying YOCO can be harmful to certain classes in the supervised classification task, as the effect of data augmentation is class dependent (Balestriero et al., 2022). To achieve superior classification performance, designing a class-specific strategy of applying YOCO is desirable. + +# 9. Conclusion + +We propose YOCO to boost augmentations, where YOCO has shown positive results in a variety of computer vision tasks and datasets. The competitiveness of our minimalist YOCO suggests that performing data augmentations can be a core component in training neural networks. We hope our study will attract the community's attention in revisiting how to perform data augmentations. + +# Acknowledgement + +We would like to thank the anonymous reviewers for their constructive feedback. + +# References + +Agustsson, E. and Timofte, R. Ntire 2017 challenge on single image super-resolution: Dataset and study. In Proceedings of the IEEE conference on computer vision and pattern recognition workshops, pp. 126-135, 2017. +Ahn, N., Kang, B., and Sohn, K.-A. Fast, accurate, and lightweight super-resolution with cascading residual network. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 252-268, 2018. +Balestriero, R., Bottou, L., and LeCun, Y. The effects of regularization and data augmentation are class dependent. arXiv preprint arXiv:2204.03632, 2022. +Bowles, C., Chen, L., Guerrero, R., Bentley, P., Gunn, R., Hammers, A., Dickie, D. A., Hernández, M. V., Wardlaw, J., and Rueckert, D. Gan augmentation: Augmenting training data using generative adversarial networks. arXiv preprint arXiv:1810.10863, 2018. +Brendel, W. and Bethge, M. Approximating cnns with bag-of-local-features models works surprisingly well onImagenet. arXiv preprint arXiv:1904.00760, 2019. +Cai, J., Zeng, H., Yong, H., Cao, Z., and Zhang, L. Toward real-world single image super-resolution: A new benchmark and a new model. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 3086-3095, 2019. +Chen, L.-C., Papandreou, G., Kokkinos, I., Murphy, K., and Yuille, A. L. Semantic image segmentation with deep convolutional nets and fully connected crfs. arXiv preprint arXiv:1412.7062, 2014. +Chen, P., Liu, S., and Jia, J. Jigsaw clustering for unsupervised visual representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11526-11535, 2021. +Chen, T., Kornblith, S., Norouzi, M., and Hinton, G. A simple framework for contrastive learning of visual representations. In International conference on machine learning, pp. 1597-1607. PMLR, 2020a. +Chen, X. and He, K. Exploring simple siamese representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 15750-15758, 2021. +Chen, X., Fan, H., Girshick, R., and He, K. Improved baselines with momentum contrastive learning. arXiv preprint arXiv:2003.04297, 2020b. +Chollet, F. Xception: Deep learning with depthwise separable convolutions. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1251-1258, 2017. + +Csurka, G., Dance, C., Fan, L., Willamowski, J., and Bray, C. Visual categorization with bags of keypoints. In Workshop on statistical learning in computer vision, ECCV, volume 1, pp. 1-2. Prague, 2004. +Cubuk, E. D., Zoph, B., Mane, D., Vasudevan, V., and Le, Q. V. Autoaugment: Learning augmentation policies from data. arXiv preprint arXiv:1805.09501, 2018. +Cubuk, E. D., Zoph, B., Shlens, J., and Le, Q. V. 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. +DeVries, T. and Taylor, G. W. Improved regularization of convolutional neural networks with cutout. arXiv preprint arXiv:1708.04552, 2017. +Dosovitskiy, A., Beyer, L., Kolesnikov, A., Weissenborn, D., Zhai, X., Unterthiner, T., Dehghani, M., Minderer, M., Heigold, G., Gelly, S., et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020. +Dwibedi, D., Misra, I., and Hebert, M. Cut, paste and learn: Surprisingly easy synthesis for instance detection. In Proceedings of the IEEE international conference on computer vision, pp. 1301-1310, 2017. +Efros, A. A. and Leung, T. K. Texture synthesis by nonparametric sampling. In Proceedings of the seventh IEEE international conference on computer vision, volume 2, pp. 1033-1038. IEEE, 1999. +Everingham, M., Van Gool, L., Williams, C. K., Winn, J., and Zisserman, A. The Pascal visual object classes (voc) challenge. International journal of computer vision, 88 (2):303-338, 2010. +Georgakis, G., Mousavian, A., Berg, A. C., and Kosecka, J. Synthesizing training data for object detection in indoor scenes. Robotics: Science and Systems (RSS), 2017. +Girshick, R., Donahue, J., Darrell, T., and Malik, J. Rich feature hierarchies for accurate object detection and semantic segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 580-587, 2014. +Goodfellow, I. J., Shlens, J., and Szegedy, C. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014. +Han, J., Li, W., Fang, P., Sun, C., Hong, J., Armin, M. A., Petersson, L., and Li, H. Blind image decomposition. In arXiv preprint arXiv:2108.11364, 2021a. + +Han, J., Shoeiby, M., Petersson, L., and Armin, M. A. Dual contrastive learning for unsupervised image-to-image translation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops, 2021b. +He, K., Zhang, X., Ren, S., and Sun, J. Identity mappings in deep residual networks. In European conference on computer vision, pp. 630-645. Springer, 2016a. +He, K., Zhang, X., Ren, S., and Sun, J. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770-778, 2016b. +He, K., Gkioxari, G., Dollar, P., and Girshick, R. Mask cnn. In Proceedings of the IEEE international conference on computer vision, pp. 2961-2969, 2017. +He, K., Fan, H., Wu, Y., Xie, S., and Girshick, R. Momentum contrast for unsupervised visual representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 9729-9738, 2020. +Hendrycks, D., Mazeika, M., and Dietterich, T. Deep anomaly detection with outlier exposure. arXiv preprint arXiv:1812.04606, 2018. +Hendrycks, D., Zhao, K., Basart, S., Steinhardt, J., and Song, D. Natural adversarial examples. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 15262-15271, 2021a. +Hendrycks, D., Zou, A., Mazeika, M., Tang, L., Song, D., and Steinhardt, J. Pixmix: Dreamlike pictures comprehensively improve safety measures. arXiv preprint arXiv:2112.05135, 2021b. +Huang, G., Sun, Y., Liu, Z., Sedra, D., and Weinberger, K. Q. Deep networks with stochastic depth. In European conference on computer vision, pp. 646-661. Springer, 2016. +Huang, G., Liu, Z., Van Der Maaten, L., and Weinberger, K. Q. Densely connected convolutional networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 4700-4708, 2017. +Kervrann, C. and Boulanger, J. Optimal spatial adaptation for patch-based image denoising. IEEE Transactions on Image Processing, 15(10):2866-2878, 2006. +Kim, H. Torchattacks: A pytorch repository for adversarial attacks. arXiv preprint arXiv:2010.01950, 2020. +Kim, J.-H., Choo, W., Jeong, H., and Song, H. O. Co-mixup: Saliency guided joint mixup with supermodular diversity. *ICLR*, 2021. + +Krizhevsky, A., Hinton, G., et al. Learning multiple layers of features from tiny images. 2009. +Krizhevsky, A., Sutskever, I., and Hinton, G. E. Imagenet classification with deep convolutional neural networks. Advances in neural information processing systems, 25: 1097-1105, 2012. +Lazebnik, S., Schmid, C., and Ponce, J. Beyond bags of features: Spatial pyramid matching for recognizing natural scene categories. In 2006 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR'06), volume 2, pp. 2169-2178. IEEE, 2006. +Lin, S., Yu, T., Feng, R., Li, X., Jin, X., and Chen, Z. Local patch autoaugment with multi-agent collaboration. arXiv preprint arXiv:2103.11099, 2021. +Lin, T.-Y., Maire, M., Belongie, S., Hays, J., Perona, P., Ramanan, D., Dollar, P., and Zitnick, C. L. Microsoft coco: Common objects in context. In European conference on computer vision, pp. 740-755. Springer, 2014. +Liu, Z., Lin, Y., Cao, Y., Hu, H., Wei, Y., Zhang, Z., Lin, S., and Guo, B. Swin transformer: Hierarchical vision transformer using shifted windows. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 10012-10022, 2021. +Long, J., Shelhamer, E., and Darrell, T. Fully convolutional networks for semantic segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3431-3440, 2015. +Lopes, R. G., Yin, D., Poole, B., Gilmer, J., and Cubuk, E. D. Improving robustness without sacrificing accuracy with patch gaussian augmentation. arXiv preprint arXiv:1906.02611, 2019. +Madry, A., Makelov, A., Schmidt, L., Tsipras, D., and Vladu, A. Towards deep learning models resistant to adversarial attacks. *ICLR*, 2018. +Nguyen, K. and O'Connor, B. Posterior calibration and exploratory analysis for natural language processing models. arXiv preprint arXiv:1508.05154, 2015. +Nilsback, M.-E. and Zisserman, A. Automated flower classification over a large number of classes. In 2008 Sixth Indian Conference on Computer Vision, Graphics & Image Processing, pp. 722-729. IEEE, 2008. +Park, T., Efros, A. A., Zhang, R., and Zhu, J.-Y. Contrastive learning for unpaired image-to-image translation. In European Conference on Computer Vision, pp. 319-345. Springer, 2020. + +Qin, Y., Zhang, C., Chen, T., Lakshminarayanan, B., Beutel, A., and Wang, X. Understanding and improving robustness of vision transformers through patch-based negative augmentation. arXiv preprint arXiv:2110.07858, 2021. +Ren, S., He, K., Girshick, R., and Sun, J. Faster r-cnn: Towards real-time object detection with region proposal networks. Advances in neural information processing systems, 28:91-99, 2015. +Russakovsky, O., Deng, J., Su, H., Krause, J., Satheesh, S., Ma, S., Huang, Z., Karpathy, A., Khosla, A., Bernstein, M., et al. Imagenet large scale visual recognition challenge. International journal of computer vision, 115(3): 211-252, 2015. +Selvaraju, R. R., Cogswell, M., Das, A., Vedantam, R., Parikh, D., and Batra, D. 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. +Shocher, A., Cohen, N., and Irani, M. "zero-shot" superresolution using deep internal learning. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3118-3126, 2018. +Simonyan, K. and Zisserman, A. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014. +Sivic, J. and Zisserman, A. Video google: A text retrieval approach to object matching in videos. In Computer Vision, IEEE International Conference on, volume 3, pp. 1470-1470. IEEE Computer Society, 2003. +Srivastava, N., Hinton, G., Krizhevsky, A., Sutskever, I., and Salakhutdinov, R. Dropout: a simple way to prevent neural networks from overfitting. The journal of machine learning research, 15(1):1929-1958, 2014. +Szegedy, C., Vanhoucke, V., Ioffe, S., Shlens, J., and Wojna, Z. Rethinking the inception architecture for computer vision. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2818-2826, 2016. +Upchurch, P., Gardner, J., Pleiss, G., Pless, R., Snavely, N., Bala, K., and Weinberger, K. Deep feature interpolation for image content changes. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 7064-7073, 2017. +Wang, Y., Huang, G., Song, S., Pan, X., Xia, Y., and Wu, C. Regularizing deep networks with semantic data augmentation. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2021. + +Wightman, R. Pytorch image models. https://github.com/rwrightman/pytorch-image-models, 2019. +Xie, S., Girshick, R., Dollar, P., Tu, Z., and He, K. Aggregated residual transformations for deep neural networks. CVPR, 2017. +Yoo, J., Ahn, N., and Sohn, K.-A. Rethinking data augmentation for image super-resolution: A comprehensive analysis and a new strategy. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 8375-8384, 2020. +You, Y., Gitman, I., and Ginsburg, B. Large batch training of convolutional networks. arXiv preprint arXiv:1708.03888, 2017. +Yun, S., Han, D., Oh, S. J., Chun, S., Choe, J., and Yoo, Y. Cutmix: Regularization strategy to train strong classifiers with localizable features. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 6023-6032, 2019. +Zagoruyko, S. and Komodakis, N. Wide residual networks. In BMVC, 2016. +Zamir, S. W., Arora, A., Khan, S., Hayat, M., Khan, F. S., Yang, M.-H., and Shao, L. Multi-stage progressive image restoration. In CVPR, 2021. +Zhang, H., Cisse, M., Dauphin, Y. N., and Lopez-Paz, D. mixup: Beyond empirical risk minimization. arXiv preprint arXiv:1710.09412, 2017. +Zhong, Z., Zheng, L., Kang, G., Li, S., and Yang, Y. Random erasing data augmentation. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pp. 13001-13008, 2020. + +# A. Augmentations + +For all studied augmentations, we list a brief description and implementation details here. For YOCO, we do not modify the setting of augmentation operations (probability, magnitude, etc.) unless specified. We employ the Pytorch/Torchvision implementation for most augmentations. + +# A.1. Geometric transformation + +Horizontal flip. Flip the image in the horizontal direction. We apply Horizontal flip with a probability of 0.5 as our default training setting. + +Vertical flip. Flip the image in the vertical direction. We apply Vertical flip with a probability of 0.5. + +# A.2. Photometric transformation + +Color jitter. Adjust the brightness, contrast, saturation, and hue of the image. We set brightness = 0.4, contrast = 0.4, saturation = 0.4, and hue = 0.1. The probability of being applied is 0.5. + +Gaussian blur. Blur the image with Gaussian blur. We set sigma = (0.1, 2.0), kernel size as approximately 10% of the image size, that is, for CIFAR images (32 × 32 resolution), a kernel size of 3 for image-level augmentation and kernel sizes of either 1 or 3 for YOco. We apply Gaussian blur with a probability of 0.5. + +# A.3. Information dropping + +Random erasing. Select a rectangular region in the image and erases its pixels. For CIFAR, we employ scale = (0.02, 0.4), ratio = (0.3, 3.3), and value = 0. For ImageNet, we change scale from (0.02, 0.4) to (0.02, 0.33). Random erasing is applied with a probability of 0.5. + +Cutout. Drops the pixels of a square region in the image. The mask size for Cutout is set to $25\%$ of the image size $(8 \times 8$ for CIFAR, $56 \times 56$ for ImageNet) and the location for dropping out is uniformly sampled. The dropped pixel is filled with 0 pixel. The probability of being applied is 0.5. + +# A.4. Search-based + +AutoAug. Consists of 25 sub-policies (augmentations) searched from a pre-defined search space. Sub-policies span a wide range of augmentations. We employ the policy of CIFAR-10 and the policy of ImageNet for training on CIFAR datasets and ImageNet, respectively. + +RandAug. Consists of searched augmentations from a reduced search space, where the magnitude strength of augmentations is controllable. RandAug can be applied uniformly across different tasks. For both CIFAR and ImageNet, we leverage an identical setting: 2 augmentation operations and a magnitude of 9. + +# A.5. Mix-based + +Mixup. Produce an element-wise convex combination of two images. The label of training images changes with the mixing ratio and mixing images. We employ Mixup with a probability of 1, and a mixing ratio randomly sampled from $Beta(1,1)$ for both CIFAR and ImageNet. For YOCO, the mixing image is identical for each piece, but with different mixing ratios. This way produces a slightly better performance than involving two mixing images. When YOCO is applied, the ImageNet best top-1 accuracy is 77.81 for one mixing image while being 77.72 for two mixing images. + +CutMix. Combine Mixup and Cutout, randomly crops a patch from the mixing image, and pastes it into the corresponding position of the training image. Similar to Mixup, we employ CutMix with a probability of 1, and draw the mixing ratio from $Beta(1,1)$ for both the CIFAR and ImageNet. We also find one mixing image outperforms two mixing images. For PreResNet18 on CIFAR-100 dataset, the top-1 accuracy of one mixing image and two mixing images are 80.70 and 79.73, respectively. + +For group of augmentations, the setting of each augmentation is identical to that augmentation applied individually. + +# B. Classification + +Standard deviation. Table 11 reports the standard deviation of applying YOCO, and not applying YOCO, on every single model and every single dataset in classification tasks. Overall, image-level augmentation is more stable than YOCO on CIFAR-100. However, on CIFAR-10 and ImageNet, the stability of YOCO is on par to Image-level augmentation. + +
ModelsCIFAR-10CIFAR-100ImageNet
YOCOImage-levelYOCOImage-levelYOCOImage-level
PreResNet180.770.771.991.71--
Xception0.470.592.021.73--
DenseNet1210.650.551.841.72--
ResNext500.550.672.021.77--
WRN-28-100.540.491.921.40--
ViT0.740.702.031.67--
Swin0.700.621.971.67--
Resnet50----0.26/0.290.23/0.33
+ +Table 11. Standard deviation of YOCO and Image-level augmentation on every single model. For ImageNet, we report both best result (left) and last result (right). + +# C. Contrastive Learning + +# C.1. Implementation details + +Augmentations. We follow the augmentations used in MoCo v2 and SimSiam. The augmentation procedure includes: Random resized crop with scale in [0.2, 1.0], Color jitter with brightness = 0.4, contrast = 0.4, saturation = 0.4, hue = 0.1, and being applied with a probability of 0.5, Grayscale with a probability of 0.8, Gaussian blur with sigma = (0.1, 2.0) and is applied with a probability of 0.5. For convenience, we move Horizontal flip to the end, which is applied with a probability of 0.5. + +Pre-training. We follow the training setting of MoCo v2 and SimSiam. + +MoCo v2 is trained for 200 epochs with SGD as the optimizer. We use a weight decay of 0.0001 and a momentum of 0.9. The batch size is 256 and is distributed over 8 GPUs, and the initial learning rate is 0.03. The learning rate is multiplied by 0.1 at 120 and 160 epochs. The temperature is set to 0.2. + +SimSiam is trained for 100 epochs only. The optimizer is SGD with a momentum of 0.9. The weight decay is 0.0001. We train with 8 GPUs and a batch size of 256. The initial learning rate is scaled to 0.05 with a cosine decay schedule. + +Linear protocol. The linear protocol training setting follows MoCo v2 and SimSiam. + +For MoCo v2, we train the linear classifier for 100 epochs. The initial learning rate is 30 and is multiplied by 0.1 at epochs 60 and 80. SGD optimizer is with a momentum of 0.9. The weight decay is 0. The linear classifier is trained with 8 GPUs and a batch size of 256. + +SimSiam employs LARS optimizer (You et al., 2017). The linear classifier layer is trained for 90 epochs, and the initial learning rate is 0.2, which is scheduled with cosine decay. The weight decay is 0 and the momentum is 0.9. The batch size is 4096 and the training is distributed over 8 GPUs. + +Fine-tuning on ImageNet. We follow the semi-supervised fine-tuning setting used in Jigsaw Clustering (Chen et al., 2021). + +Pre-trained weights are fine-tuned for 100 epochs using SGD with a momentum of 0.9 as the optimizer. The batch size is 256 and we employ 4 GPUs for training. We do not apply any weight decay. The learning rate is multiplied by 0.1 at 30, 60, and 90 epochs. For $10\%$ label fraction, we set the trunk learning rate to 0.01 while the last layer learning rate is set to 0.2. For $1\%$ label fraction, the learning rate for the trunk is 0.02 and is 5 for the final layer. + +# D. Visualization + +Augmented images. We show uncurated random samples on ImageNet. Each quadruplet presents the original image, an augmented image produced by image-level augmentation, and two augmented images created by YOCO. Visualizations are presented in Figure 4. + +CAM visualization. We compute Grad-CAM (Selvaraju et al., 2017) for ResNet50 trained with YOCO and image-level + +![](images/69121b8d336912b5fb9d85afdeadce8beaa3cc6f441259e77494f8db2d529f21.jpg) +Figure 4. Augmented images. Randomly selected samples on ImageNet validation images. For each quadruplet, we show the original input image, augmented image from image-level augmentation, and two images from different cut dimensions produced by YOCO. + +augmentation. We take Horizontal flip as an example. Visualizations are presented in Figure 5. For these samples, when only partial information is available (Banjo, Anemone fish), YOCO tends to focus more on that partial region instead of larger spatially distributed regions. YOCO also attends to focus on multiple structurally comprehensive regions, as shown in Hare, Entlebucher, and Yawl, where YOCO noticed two objects while image-level pays attention to a certain one. However, YOCO sometimes fails to comprehensively localize class-related cues, as presented in Desktop computer. + +Differently classified images. To better understand the difference between image-level augmentation and YOCO. We present two collections containing randomly selected images that are differently classified by classifiers trained with YOCO and image-level augmentation. All images are taken from ImageNet validation set and images with private information are not presented. YOCO and image-level augmentation are both applied to Horizontal flip. Visualizations are presented in Figure 6. The set on the left side (image-level wrong, YOCO correct) contains more images that are with partial information only. + +![](images/323ffaa889c4a2bdfc8fd49bc5fcd2dd64cc29f8b3b52317a28aa5ea00f1e2f3.jpg) +Figure 5. Grad-CAM visualization. We present the Grad-CAM results of models that are trained with image-level augmentation and YOCO. + +![](images/3e69aa7e6f62efe39b62f1c0d87af641383ca0e8553910e889961adb0732ecbd.jpg) +Figure 6. Differently classified images. Uncurated ImageNet validation images that are differently classified by models trained with YOCO and image-level augmentation. + +![](images/034a42c08ca857f163e45f1bbf50fdc86e11b3a6bcf62b6b67d83108a55b5ac8.jpg) \ No newline at end of file diff --git a/youonlycutonceboostingdataaugmentationwithasinglecut/images.zip b/youonlycutonceboostingdataaugmentationwithasinglecut/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..e1d36e7c03711f782e10cbbfcd5aa5e7e0a9f347 --- /dev/null +++ b/youonlycutonceboostingdataaugmentationwithasinglecut/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:96253f5c760782b7670bc09f616370647e37b531bcf1ead8a8985b90cdeb25f0 +size 1570163 diff --git a/youonlycutonceboostingdataaugmentationwithasinglecut/layout.json b/youonlycutonceboostingdataaugmentationwithasinglecut/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..2855cae13a7c376cda685a1d7ec760e870408b0b --- /dev/null +++ b/youonlycutonceboostingdataaugmentationwithasinglecut/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d329e5b166270d8346c68711b3b91326c0a8776a2d3352f6c1512b5984374895 +size 522749 diff --git a/yourttstowardszeroshotmultispeakerttsandzeroshotvoiceconversionforeveryone/977b12e3-e79e-4434-85a4-f87b6ad16671_content_list.json b/yourttstowardszeroshotmultispeakerttsandzeroshotvoiceconversionforeveryone/977b12e3-e79e-4434-85a4-f87b6ad16671_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..9be85418a651048ce52b073b5df2762f9eb3af8f --- /dev/null +++ b/yourttstowardszeroshotmultispeakerttsandzeroshotvoiceconversionforeveryone/977b12e3-e79e-4434-85a4-f87b6ad16671_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:940bfb712d1bcd9ad30d8625eb0cfec5b32eb804e464f651fe3708f01e33106d +size 77820 diff --git a/yourttstowardszeroshotmultispeakerttsandzeroshotvoiceconversionforeveryone/977b12e3-e79e-4434-85a4-f87b6ad16671_model.json b/yourttstowardszeroshotmultispeakerttsandzeroshotvoiceconversionforeveryone/977b12e3-e79e-4434-85a4-f87b6ad16671_model.json new file mode 100644 index 0000000000000000000000000000000000000000..83568a6cec82fe084f73464c07284b1586b59f83 --- /dev/null +++ b/yourttstowardszeroshotmultispeakerttsandzeroshotvoiceconversionforeveryone/977b12e3-e79e-4434-85a4-f87b6ad16671_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f9204e86f8ef1579f2a1e3ac6bd99c1e3d9fb9f6d2fff058b8edb5351ac713de +size 96906 diff --git a/yourttstowardszeroshotmultispeakerttsandzeroshotvoiceconversionforeveryone/977b12e3-e79e-4434-85a4-f87b6ad16671_origin.pdf b/yourttstowardszeroshotmultispeakerttsandzeroshotvoiceconversionforeveryone/977b12e3-e79e-4434-85a4-f87b6ad16671_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..c5fd6b8268f23dd712ae5612d9a0510767047257 --- /dev/null +++ b/yourttstowardszeroshotmultispeakerttsandzeroshotvoiceconversionforeveryone/977b12e3-e79e-4434-85a4-f87b6ad16671_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:23b15f2a3fcd84461367bc64d03138191e760c20effb4603ce54c6b93beb9db9 +size 576346 diff --git a/yourttstowardszeroshotmultispeakerttsandzeroshotvoiceconversionforeveryone/full.md b/yourttstowardszeroshotmultispeakerttsandzeroshotvoiceconversionforeveryone/full.md new file mode 100644 index 0000000000000000000000000000000000000000..b9044ec75a809864d8cffa81b06ccfdb05e1ead9 --- /dev/null +++ b/yourttstowardszeroshotmultispeakerttsandzeroshotvoiceconversionforeveryone/full.md @@ -0,0 +1,266 @@ +# YourTTS: Towards Zero-Shot Multi-Speaker TTS and Zero-Shot Voice Conversion for Everyone + +Edresson Casanova $^{12}$ Julian Weber $^{32}$ Christopher Shulby $^{4}$ Arnaldo Candido Junior $^{5}$ Eren Gölgé $^{2}$ Moacir Antonelli Ponti $^{16}$ + +# Abstract + +YourTTS brings the power of a multilingual approach to the task of zero-shot multi-speaker TTS. Our method builds upon the VITS model and adds several novel modifications for zero-shot multispeaker and multilingual training. We achieved state-of-the-art (SOTA) results in zero-shot multispeaker TTS and results comparable to SOTA in zero-shot voice conversion on the VCTK dataset. Additionally, our approach achieves promising results in a target language with a single-speaker dataset, opening possibilities for zero-shot multispeaker TTS and zero-shot voice conversion systems in low-resource languages. Finally, it is possible to fine-tune the YourTTS model with less than 1 minute of speech and achieve state-of-the-art results in voice similarity and with reasonable quality. This is important to allow synthesis for speakers with a very different voice or recording characteristics from those seen during training. + +Index Terms: cross-lingual zero-shot multi-speaker TTS, text-to-speech, cross-lingual zero-shot voice conversion, speaker adaptation. + +# 1. Introduction + +Text-to-Speech (TTS) systems have significantly advanced in recent years with deep learning approaches, allowing successful applications such as speech-based virtual assistants. Most TTS systems were tailored from a single speaker's voice, but there is current interest in synthesizing voices for new speakers (not seen during training), employing only a + +$^{1}$ Instituto de Ciências Matemáticas e de Computação, Universidade de São Paulo, Brazil $^{2}$ Coqui, Germany $^{3}$ Sopra Banking Software, France $^{4}$ Defined.ai, United States of America $^{5}$ Federal University of Technology - Paraná, Brazil $^{6}$ Mercado Livre, Brazil. Correspondence to: Edresson Casanova . + +Proceedings of the $39^{th}$ International Conference on Machine Learning, Baltimore, Maryland, USA, PMLR 162, 2022. Copyright 2022 by the author(s). + +few seconds of speech. This approach is called zero-shot multi-speaker TTS (ZS-TTS) as in Jia et al. (2018); Cooper et al. (2020); Choi et al. (2020); Casanova et al. (2021). + +ZS-TTS using deep learning was first proposed by Arik et al. (2018) which extended the DeepVoice 3 method (Ping et al., 2017). Meanwhile, Tacotron 2 (Shen et al., 2018) was adapted using external speaker embeddings extracted from a trained speaker encoder using a generalized end-to-end loss (GE2E) (Wan et al., 2018), allowing for speech generation that resembles the target speaker (Jia et al., 2018). Similarly, Tacotron 2 was used with a different speaker embeddings methods (Cooper et al., 2020), with LDE embeddings (Cai et al., 2018) to improve similarity and naturalness of speech for unseen speakers (Snyder et al., 2018). The authors also showed that a gender-dependent model improves the similarity for unseen speakers (Cooper et al., 2020). In this context, Attentron (Choi et al., 2020) proposed a fine-grained encoder with an attention mechanism for extracting detailed styles from various reference samples and a coarse-grained encoder. As a result of using several reference samples, they achieved better voice similarity for unseen speakers. ZSM-SS (Kumar et al., 2021) is a Transformer-based architecture with a normalization architecture and an external speaker encoder based on Wav2vec 2.0 (Baevski et al., 2020). The authors conditioned the normalization architecture with speaker embeddings, pitch, and energy. Despite promising results, the authors did not compare the proposed model with any of the related works mentioned above. SC-GlowTTS (Casanova et al., 2021) was the first application of flow-based models in ZS-TTS. It improved voice similarity for unseen speakers in training with respect to previous studies while maintaining comparable quality. + +Despite these advances, the similarity gap between observed and unobserved speakers during training is still an open research question. ZS-TTS models still require a considerable amount of speakers for training, making it difficult to obtain high-quality models in low-resource languages. Furthermore, according to Tan et al. (2021), the quality of current ZS-TTS models is not sufficiently good, especially for target speakers with speech characteristics that differ from those seen in training. Although SC-GlowTTS (Casanova + +et al., 2021) achieved promising results with only 11 speakers from the VCTK dataset (Veaux et al., 2016), when one limits the number and variety of training speakers, it also further hinders the model generalization for unseen voices. + +In parallel with the ZS-TTS, multilingual TTS has also evolved aiming at learning models for multiple languages at the same time (Cao et al., 2019; Zhang et al., 2019; Nekvinda & Dušek, 2020; Li et al., 2021). Some of these models are particularly interesting as they allow for code-switching, i.e. changing the target language for some part of a sentence, while keeping the same voice (Nekvinda & Dušek, 2020). This can be useful in ZS-TTS as it allows using of speakers from one language to be synthesized in another language. Voice conversion is yet another task that may benefit from multilingual contexts (Choi et al., 2021). + +In this paper, we propose YourTTS with several novel ideas focused on zero-shot multi-speaker and multilingual training. We report state-of-the-art zero-shot multi-speaker TTS results, as well as results comparable to SOTA in zero-shot voice conversion for the VCTK dataset. + +Our novel zero-shot multi-speaker TTS approach includes the following contributions: + +- State-of-the-art results in the English Language; +- The first work proposing a multilingual approach in the zero-shot multi-speaker TTS scope; +- Ability to do zero-shot multi-speaker TTS and zero-shot Voice Conversion with promising quality and similarity in a target language using only one speaker in the target language during model training; +- Require less than 1 minute of speech to fine-tune the model for speakers who have voice/recording characteristics very different from those seen in model training, and still achieve good similarity and quality results. + +The audio samples for each of our experiments are available on the demo web-site1. For reproducibility, our source-code is available at the Coqui TTS2, as well as the model checkpoints of all experiments3. + +# 2. YourTTS Model + +YourTTS builds upon VITS (Kim et al., 2021), but includes several novel modifications for zero-shot multi-speaker and multilingual training. First, unlike previous work (Casanova et al., 2021; Kim et al., 2021), in our model we used raw text as input instead of phonemes. This allows more realistic results for languages without good open-source grapheme-to-phoneme converters available. + +As in previous works, e.g. (Kim et al., 2021), we use a transformer-based text encoder (Kim et al., 2020; Casanova et al., 2021). However, for multilingual training, we concatenate 4-dimensional trainable language embeddings into the embeddings of each input character. In addition, we also increased the number of transformer blocks to 10 and the number of hidden channels to 196. As a decoder, we use a stack of 4 affine coupling layers (Dinh et al., 2017) each layer is itself a stack of 4 WaveNet residual blocks (Oord et al., 2016), as in VITS model. + +As a vocoder we use the HiFi-GAN (Kong et al., 2020) version 1 with the discriminator modifications introduced by Kim et al. (2021). Furthermore, for efficient end2end training, we connect the TTS model with the vocoder using a variational autoencoder (VAE) (Kingma & Welling, 2013). For this, we use the Posterior Encoder proposed by Kim et al. (2021). The Posterior Encoder consists of 16 non-causal WaveNet residual blocks (Prenger et al., 2019; Kim et al., 2020). As input, the Posterior Encoder receives a linear spectrogram and predicts a latent variable, this latent variable is used as input for the vocoder and for the flow-based decoder, thus, no intermediate representation (such as mel-spectrograms) is necessary. This allows the model to learn an intermediate representation; hence, it achieves superior results to a two-stage approach system in which the vocoder and the TTS model are trained separately (Kim et al., 2021). Furthermore, to enable our model to synthesize speech with diverse rhythms from the input text, we use the stochastic duration predictor proposed in Kim et al. (2021). + +YourTTS during training and inference is illustrated in Figure 1, where $(\#)$ indicates concatenation, red connections mean no gradient will be propagated by this connection, and dashed connections are optional. We omit the Hifi-GAN discriminator networks for simplicity. + +To give the model zero-shot multi-speaker generation capabilities we condition all affine coupling layers of the flow-based decoder, the posterior encoder, and the vocoder on external speaker embeddings. We use global conditioning (Oord et al., 2016) in the residual blocks of the coupling layers as well as in the posterior encoder. We also sum the external speaker embeddings with the text encoder output and the decoder output before we pass them to the duration predictor and the vocoder, respectively. We use linear pro + +jection layers to match the dimensions before element-wise summations (see Figure 1). + +Also, inspired by Xin et al. (2021), we investigated Speaker Consistency Loss (SCL) in the final loss. In this case, a pre-trained speaker encoder is used to extract speaker embeddings from the generated audio and ground truth on which we maximize the cosine similarity. Formally, let $\phi(.)$ be a function outputting the embedding of a speaker, $cos\_sim$ be the cosine similarity function, $\alpha$ a positive real number that controls the influence of the SCL in the final loss, and $n$ the batch size, the SCL is defined as follows: + +$$ +L _ {S C L} = \frac {- \alpha}{n} \cdot \sum_ {i} ^ {n} \cos_ {-} \sin (\phi (g _ {i}), \phi (h _ {i})), \tag {1} +$$ + +where $g$ and $h$ represent, respectively, the ground truth and the generated speaker audio. + +During training, the Posterior Encoder receives linear spectrograms and speaker embeddings as input and predicts a latent variable $z$ . This latent variable and speaker embeddings are used as input to the GAN-based vocoder generator which generates the waveform. For efficient end-to-end vocoder training, we randomly sample constant length partial sequences from $z$ as in Kong et al. (2020); Binkowski et al. (2019); Ren et al. (2021); Kim et al. (2021). The Flow-based decoder conditions the latent variable $z$ and speaker embeddings with respect to the prior $P_{Zp}$ . To align the $P_{Zp}$ distribution with the output of the text encoder, we use the Monotonic Alignment Search (MAS) (Kim et al., 2020; 2021). The stochastic duration predictor receives as input speaker and language embeddings, and the duration obtained through MAS. To generate human-like rhythms of speech, the objective of the stochastic duration predictor is a variational lower bound of the log-likelihood of the phoneme duration (pseudo-phoneme in our case). + +During inference, MAS is not used. Instead, $P_{Zp}$ distribution is predicted by the text encoder and the duration is sampled from random noise through the inverse transformation of the stochastic duration predictor and then, converted to integer. In this way, a latent variable $z_{p}$ is sampled from the distribution $P_{Zp}$ . The inverted Flow-based decoder receives as input the latent variable $z_{p}$ and the speaker embeddings, transforming the latent variable $z_{p}$ into the latent variable $z$ which is passed as input to the vocoder generator, thus obtaining the synthesized waveform. + +# 3. Experiments + +# 3.1. Speaker Encoder + +As speaker encoder, we use the H/ASP model (Heo et al., 2020) publicly available, that was trained with the Prototypical Angular (Chung et al., 2020) plus Softmax loss functions in the VoxCeleb 2 (Chung et al., 2018) dataset. This + +model was chosen for achieving state-of-the-art results in VoxCeleb 1 (Nagrani et al., 2017) test subset. In addition, we evaluated the model in the test subset of Multilingual LibriSpeech (MLS) (Pratap et al., 2020) using all languages. This model reached an average Equal Error Rate (EER) of 1.967 while the speaker encoder used in the SC-GlowTTS paper (Casanova et al., 2021) reached an EER of 5.244. + +# 3.2. Audio Datasets + +We investigated 3 languages, using one dataset per language to train the model. For all datasets, pre-processing was carried out in order to have samples of similar loudness and to remove long periods of silence. All the audios to $16\mathrm{KHz}$ and applied voice activity detection (VAD) using Webrtcvad toolkit4 to trim the trailing silences. Additionally, we normalized all audio to $-27\mathrm{dB}$ using the RMS-based normalization from the Python package ffmpeg-normalize5. + +English: VCTK (Veaux et al., 2016) dataset, which contains 44 hours of speech and 109 speakers, sampled at $48\mathrm{kHz}$ . We divided the VCTK dataset into: train, development (containing the same speakers as the train set) and test. For the test set, we selected 11 speakers that are neither in the development nor the training set; following the proposal by Jia et al. (2018) and Casanova et al. (2021), we selected 1 representative from each accent totaling 7 women and 4 men (speakers 225, 234, 238, 245, 248, 261, 294, 302, 326, 335 and 347). Furthermore, in some experiments we used the subsets train-clean-100 and train-clean-360 of the LibriTTS dataset (Zen et al., 2019) seeking to increase the number of speakers in the training of the models. + +Portuguese: TTS-Portuguese Corpus (Casanova et al., 2022), a single-speaker dataset of the Brazilian Portuguese language with around 10 hours of speech, sampled at $48\mathrm{kHz}$ . As the authors did not use a studio, the dataset contains ambient noise. We used the FullSubNet model (Hao et al., 2021) as denoiser and resampled the data to $16\mathrm{kHz}$ . For development we randomly selected 500 samples and the rest of the dataset was used for training. + +French: fr_FR set of the M-AILABS dataset (Munich Artificial Intelligence Laboratories GmbH, 2017), which is based on LibriVox. It consists of 2 female (104h) and 3 male speakers (71h) sampled at 16KHz. + +To evaluate the zero-shot multi-speaker capabilities of our model in English, we use the 11 VCTK speakers reserved for testing. To further test its performance outside of the VCTK domain, we select 10 speakers (5F/5M) from subset test-clean of LibriTTS dataset (Zen et al., 2019). For Portuguese we select samples from 10 speakers (5F/5M) from + +![](images/270dea5eff6913179dbca9e660dadc4108de6964a87c474c416a4fba53b87a0c.jpg) +(a) Training procedure +Figure 1. YourTTS diagram depicting (a) training procedure and (b) inference procedure. + +![](images/b4c14956da365662ffb8e3397689109b04b698956d0fb1017710ea2c5e821f3c.jpg) +(b) Inference procedure + +the Multilingual LibriSpeech (MLS) (Pratap et al., 2020) dataset. For French, no evaluation dataset was used, see Section 4 for reasons. Finally, for speaker adaptation experiments, to mimic a more realistic setting, we used 4 speakers from the Common Voice dataset (Ardila et al., 2020). + +# 3.3. Experimental Setup + +We carried out four training experiments with YourTTS: + +- System 1: using VCTK dataset (monolingual); +- System 2: using both VCTK and TTS-Portuguese datasets (bilingual); +- System 3: using VCTK, TTS-Portuguese and M-AILABS french datasets (trilingual); +- System 4: starting with the model obtained in system 3 we continue training with 1,151 additional + +English speakers from both LibriTTS partitions train-clean-100 and train-clean-360. + +To accelerate training, in every experiment, we use transfer learning. In system 1, we start from a model trained 1M steps on LJSpeech (Ito et al., 2017) and continue the training for 200K steps with the VCTK dataset. However, due to the proposed changes, some layers of the model were randomly initialized due to the incompatibility of the shape of the weights. For systems 2 and 3, training is done by continuing from the previous experiment for approximately 140k steps, learning one language at a time. In addition, for each experiment a fine-tuning was performed for 50k steps using the Speaker Consistency Loss (SCL), described in section 2, with $\alpha = 9$ . Finally, for system 4, we continue training from the model from system 3 fine-tuned with the Speaker Consistency Loss. Note that, although the latest works in ZS-TTS (Cooper et al., 2020; Choi et al., 2020; + +Casanova et al., 2021) only use the VCTK dataset, this dataset has a limited number of speakers (109) and little variety of recording conditions. Thus, after training with VCTK only, in general, ZS-TTS models do not generalize satisfactorily to new speakers where recording conditions or voice characteristics are very different than those seen in the training (Tan et al., 2021). + +The models were trained using an NVIDIA TESLA V100 32GB with a batch size of 64. For the TTS model training and for the discrimination of vocoder HiFi-GAN we use the AdamW optimizer (Loshchilov & Hutter, 2017) with betas 0.8 and 0.99, weight decay 0.01 and an initial learning rate of 0.0002 decaying exponentially by a gamma of 0.999875 (Paszke et al., 2019). For the multilingual experiments, we use weighted random sampling (Paszke et al., 2019) to guarantee a language balanced batch. + +# 4. Results and Discussion + +In this paper, we evaluate synthesized speech quality using a Mean Opinion Score (MOS) study, as in (Ribeiro et al., 2011). To compare the similarity between the synthesized voice and the original speaker, we calculate the Speaker Encoder Cosine Similarity (SECS) (Casanova et al., 2021) between the speaker embeddings of two audios extracted from the speaker encoder. It ranges from -1 to 1, and a larger value indicates a stronger similarity (Cooper et al., 2020). Following previous works (Choi et al., 2020; Casanova et al., 2021), we compute SECS using the speaker encoder of the Resemblyzer (Jemine, 2019) package, allowing for comparison with those studies. We also report the Similarity MOS (Sim-MOS) following the works of Jia et al. (2018), Choi et al. (2020), and Casanova et al. (2021). + +Although we used 3 languages, due to the high cost of the MOS metrics, only two languages were used to compute such metrics: English, which has the largest number of speakers, and Portuguese, which has the smallest number. Also, following Casanova et al. (2021) we present such metrics only for speakers unseen during training. MOS scores were obtained with rigorous crowdsourcing7. For the calculation of MOS and the Sim-MOS in the English language, we use 276 and 200 native English contributors, respectively. For the Portuguese language, we use 90 native Portuguese contributors for both metrics. + +During evaluation we use the fifth sentence of the VCTK dataset (i.e, speakerID_005.txt) as reference audio for the extraction of speaker embeddings, since all test speakers uttered it and because it is a long sentence (20 words). For the LibriTTS and MLS Portuguese, we randomly draw one sample per speaker considering only those with 5 seconds or more, to guarantee a reference with sufficient duration. + +For the calculation of MOS, SECS, and Sim-MOS in English, we select 55 sentences randomly from the test-clean subset of the LibriTTS dataset, considering only sentences with more than 20 words. For Portuguese we use the translation of these 55 sentences. During inference, we synthesize 5 sentences per speaker in order to ensure coverage of all speakers and a good number of sentences. As ground truth for all test subsets, we randomly select 5 audios for each of the test speakers. For the SECS and Sim-MOS ground truth, we compared such randomly selected 5 audios per speaker with the reference audios used for the extraction of speaker embeddings during synthesis of the test sentences. + +Table 1 shows MOS and Sim-MOS with $95\%$ confidence intervals and SECS for all of our experiments in English for the datasets VCTK and LibriTTS and in Portuguese with the Portuguese sub-set of the dataset MLS. We also present the result of models SC-GlowTTS and Attentron for comparison on the VCTK dataset. + +# 4.1. VCTK Dataset + +For the VCTK dataset, the best similarity results were obtained with systems 1 (monolingual) and $2 + \mathrm{SCL}$ (bilingual). Both achieved the same SECS and a similar SimMOS. According to the Sim-MOS, the use of SCL did not bring any improvements; however, the confidence intervals of all experiments overlap, making this analysis inconclusive. On the other hand, according to SECS, using SCL improved the similarity in 2 out of 3 experiments. Also, for system 2, both metrics agree on the positive effect of SCL in similarity. + +Another noteworthy result is that SECS for all of our experiments on the VCTK dataset are higher than the ground truth. This can be explained by characteristics of the VCTK dataset itself which has, for example, significant breathing sounds in most audios. The speaker encoder may not be able to handle these features, hereby lowering the SECS of the ground truth. Overall, in our best experiments with VCTK, the similarity (SECS and Sim-MOS) and quality (MOS) results are similar to the ground truth. Our results in terms of MOS match the ones reported by the VITS article (Kim et al., 2021). However, we show that with our modifications, the model manages to maintain good quality and similarity for unseen speakers. Finally, our best experiments achieve superior results in similarity and quality when compared to Choi et al. (2020); Casanova et al (2021); therefore, achieving the SOTA in the VCTK dataset for zero-shot multi-speaker TTS. + +# 4.2. LibriTTS Dataset + +We achieved the best LibriTTS similarity in system 4. This result can be explained by the use of more speakers $(\sim 1.2k)$ than any other experiment ensuring a broader coverage of + +Table 1. SECS, MOS and Sim-MOS with $95\%$ confidence intervals for all our experiments. + +
VCTKLIBRITTSMLS-PT
SYSTEMSSECSMOSSIM-MOSSECSMOSSIM-MOSSECSMOSSIM-MOS
GROUND TRUTH0.8244.26±0.044.19±0.060.9314.22±0.054.22±0.060.90184.61±0.054.41±0.05
ATTENTRON ZS(0.731)(3.86±0.05)(3.30±0.06)------
SC-GLOWTTS(0.804)(3.78±0.07)(3.99±0.07)------
SYS. 10.8644.21±0.044.16±0.050.7544.25±0.053.98±0.07---
SYS. 1 + SCL0.8614.20±0.054.13±0.060.7654.21±0.044.05±0.07---
SYS. 20.8574.24±0.044.15±0.060.7624.22±0.054.01±0.070.7403.96±0.083.02±0.1
SYS. 2 + SCL0.8644.19±0.054.17±0.060.7734.23±0.054.01±0.070.7454.09±0.072.98±0.1
SYS. 30.8514.21±0.044.10±0.060.7614.21±0.044.01±0.050.7614.01±0.083.19±0.1
SYS. 3 + SCL0.8554.22±0.054.06±0.060.7784.17±0.053.98±0.070.7664.11±0.073.17±0.1
SYS. 4 + SCL0.8434.23±0.054.10±0.060.8564.18±0.054.07±0.070.7983.97±0.083.07±0.1
+ +voice and recording condition diversity. On the other hand, MOS achieved the best result for the monolingual case. We believe that this was mainly due to the quality of the training datasets. System 1 uses VCTK dataset only, which has higher quality when compared to other datasets added in other experiments. + +# 4.3. Portuguese MLS Dataset + +For the Portuguese MLS dataset, the highest MOS metric was achieved by system $3+\mathrm{SCL}$ , with MOS $4.11 \pm 0.07$ , although the confidence intervals overlap with the other experiments. It is interesting to observe that the model trained in Portuguese with a single-speaker dataset of medium quality, manages to reach a good quality in the zero-shot multi-speaker synthesis. System 3 is the best experiment according to Sim-MOS ( $3.19 \pm 0.10$ ) however, with an overlap with other ones considering the confidence intervals. In this dataset, Sim-MOS and SECS do not agree: based on the SECS metric, the model with higher similarity was obtained in system $4+\mathrm{SCL}$ . We believe this is due to the variety in the LibriTTS dataset. The dataset is also composed of audiobooks, therefore tending to have similar recording characteristics and prosody to the MLS dataset. We believe that this difference between SECS and Sim-MOS can be explained by the confidence intervals of Sim-MOS. Finally, Sim-MOS achieved in this dataset is relevant, considering that our model was trained with only one male speaker in the Portuguese language. + +Analyzing the metrics by gender, the MOS for system 4 considering only male and female speakers are respectively $4.14 \pm 0.11$ and $3.79 \pm 0.12$ . Also, the Sim-MOS for male and female speakers are respectively $3.29 \pm 0.14$ and $2.84 \pm 0.14$ . Therefore, the performance of our model in Portuguese is affected by gender. We believe that this happened because our model was not trained with female Portuguese speakers. Despite that, our model was able to produce female speech in the Portuguese language. Attentron achieved a Sim-MOS of $3.30 \pm 0.06$ after being trained with approximately 100 speakers in the English language. Considering confidence intervals, our model achieved a similar Sim + +MOS even when seeing only one male speaker in the target language. Hence, we believe that our approach can be the solution for the development of zero-shot multi-speaker TTS models in low-resourced languages. + +Including French (i.e. system 3) appear to have improved both quality and similarity (according to SECS) in Portuguese. The increase in quality can be explained by the fact that the M-AILABS French dataset has better quality than the Portuguese corpus; consequently, as the batch is balanced by language, there is a decrease in the amount of lower quality speech in the batch during model training. Also, increase in similarity can be explained by the fact that TTS-Portuguese is a single speaker dataset and with the batch balancing by language in system 2, half of the batch is composed of only one male speaker. When French is added, then only a third of the batch will be composed of the Portuguese speaker voice. + +# 4.4. Speaker Consistency Loss + +The use of Speaker Consistency Loss (SCL) improved similarity measured by SECS. On the other hand, for the SimMOS the confidence intervals between the experiments are inconclusive to assert that the SCL improves similarity. Nevertheless, we believe that SCL can help the generalization in recording characteristics not seen in training. For example, in system 1, the model did not see the recording characteristics of the LibriTTS dataset in training but during testing on this dataset, both the SECS and Sim-MOS metrics showed an improvement in similarity thanks to SCL. On the other hand, it seems that using SCL slightly decreases the quality of generated audio. We believe this is because with the use of SCL, our model learns to generate recording characteristics present in the reference audio, producing more distortion and noise. However, it should be noted that in our tests with high-quality reference samples, the model is able to generate high-quality speech. + +Table 2. MOS and Sim-MOS with ${95}\%$ confidence intervals for the zero-shot voice conversion experiments. + +
REF/TARM-MM-FF-FF-MALL
MOSSIM-MOSMOSSIM-MOSMOSSIM-MOSMOSSIM-MOSMOSSIM-MOS
EN-EN4.22±0.104.15±0.124.14±0.094.11±0.124.16±0.123.96±0.154.26±0.094.05±0.114.20±0.054.07±0.06
PT-PT3.84 ± 0.183.80 ± 0.153.46 ± 0.103.12 ± 0.173.66 ± 0.23.35 ± 0.193.67 ± 0.163.54 ± 0.163.64 ± 0.093.43 ± 0.09
EN-PT4.17±0.093.68 ± 0.104.24±0.083.54 ± 0.114.14±0.093.58 ± 0.124.12±0.103.58 ± 0.114.17±0.043.59 ± 0.05
PT-EN3.62 ± 0.163.8 ± 0.102.95 ± 0.23.67 ± 0.113.51 ± 0.183.63 ± 0.113.47 ± 0.183.57 ± 0.113.40 ± 0.093.67 ± 0.05
+ +# 5. Zero-Shot Voice Conversion + +As in the SC-GlowTTS (Casanova et al., 2021) model, we do not provide any information about the speaker's identity to the encoder, so the distribution predicted by the encoder is forced to be speaker independent. Therefore, YourTTS can convert voices using the model's Posterior Encoder, decoder and the HiFi-GAN Generator. Since we conditioned YourTTS with external speaker embeddings, it enables our model to mimic the voice of unseen speakers in a zero-shot voice conversion setting. + +Wang & Borth (2021) reported the MOS and Sim-MOS metrics for the AutoVC (Qian et al., 2019) and NoiseVC (Wang & Borth, 2021) models for 10 VCTK speakers not seen during training. To compare our results, we selected 8 speakers (4M/4F) from the VCTK test subset. Although Wang & Borth (2021) uses 10 speakers, due to gender balance, we were forced to use only 8 speakers. Furthermore, to analyze the generalization of the model for the Portuguese language, and to verify the result achieved by our model in a language where the model was trained with only one speaker, we used the 8 speakers (4M/4F) from the test subset of the MLS Portuguese dataset. Therefore, in both languages we use speakers not seen in the training. Following Qian et al. (2019) for a deeper analysis, we compared the transfer between male, female and mixed gender speakers individually. During the analysis, for each speaker, we generate a transfer in the voice of each of the other speakers, choosing the reference samples randomly, considering only samples longer than 3 seconds. In addition, we analyzed voice transfer between English and Portuguese speakers. We calculate the MOS and the Sim-MOS as described in Section 4. However, for the calculation of the sim-MOS when transferring between English and Portuguese (pt-en and en-pt), as the reference samples are in one language and the transfer is done in another language, we used evaluators from both languages (58 and 40, respectively, for English and Portuguese). + +Table 2 presents the MOS and Sim-MOS for these experiments. Samples of the zero-shot voice conversion are present in the demo page8. + +# 5.1. Intra-lingual Results + +For zero-shot voice conversion from one English-speaker to another English-speaker (en-en) our model achieved a MOS of $4.20 \pm 0.05$ and a Sim-MOS of $4.07 \pm 0.06$ . For comparison, Wang & Borth (2021) reported the MOS and Sim-MOS results for the AutoVC (Qian et al., 2019) and NoiseVC (Wang & Borth, 2021) models. For 10 VCTK speakers not seen during training, the AutoVC model achieved a MOS of $3.54 \pm 1.08^9$ and a Sim-MOS of $1.91 \pm 1.34$ . On the other hand, the NoiseVC model achieved a MOS of $3.38 \pm 1.35$ and a Sim-MOS of $3.05 \pm 1.25$ . Therefore, our model achieved results comparable to the SOTA in zero-shot voice conversion in the VCTK dataset. Although the model was trained with more data and speakers, the similarity results of the VCTK dataset in Section 4 indicate that the model trained with only the VCTK dataset (system 1) presents a better similarity than the model explored in this Section (system 4). Therefore, we believe that YourTTS can achieve a result very similar or even superior in zero-shot voice conversion when being trained and evaluated using only the VCTK dataset. + +For zero-shot voice conversion from one Portuguese speaker to another Portuguese speaker our model achieved a MOS of $3.64 \pm 0.09$ and a Sim-MOS of $3.43 \pm 0.09$ . We note that our model performs significantly worse in voice transfer similarity between female speakers $(3.35 \pm 0.19)$ compared to transfers between male speakers $(3.80 \pm 0.15)$ . This can be explained by the lack of female speakers for the Portuguese language during the training of our model. Again, it is remarkable that our model manages to approximate female voices in Portuguese without ever having seen a female voice in that language. + +# 5.2. Cross-lingual Results + +Apparently, the transfer between English and Portuguese speakers works as well as the transfer between Portuguese speakers. However, for the transfer of a Portuguese speaker to an English speaker (pt-en) the MOS scores drop in quality. This was especially due to the low quality of voice conversion from Portuguese male speakers to English female speakers. In general, as discussed above, due to the + +lack of female speakers in the training of the model, the transfer to female speakers achieves poor results. In this case, the challenge is even greater as it is necessary to convert audios from a male speaker in Portuguese to the voice of a English female speaker. + +In English, during conversions, the speaker's gender did not significantly influence the model's performance. However, for transfers involving Portuguese, the absence of female voices in the training of the model hindered generalization. + +# 6. Speaker Adaptation + +The different recording conditions are a challenge for the generalization of the zero-shot multi-speaker TTS models. Speakers who have a voice that differs greatly from those seen in training also become a challenge (Tan et al., 2021). Nevertheless, to show the potential of our model for adaptation to new speakers/recording conditions, we selected samples from 20 to 61 seconds of speech for 2 Portuguese and 2 English speakers (1M/1F) in the Common Voice (Ardila et al., 2020) dataset. Using these 4 speakers, we perform fine-tuning on the checkpoint from system 4 with Speaker Consistency Loss individually for each speaker. During fine-tuning, to ensure that multilingual synthesis is not impaired, we use all the datasets used in system 4. However, we use Weighted random sampling (Paszke et al., 2019) to guarantee that samples from adapted speakers appear in a quarter of the batch. The model is trained that way for 1,500 steps. For evaluation, we use the same approach described in Section 4. + +Table 3 shows the gender, total duration in seconds and number of samples used during the training for each speaker, and the metrics SECS, MOS and Sim-MOS for the ground truth (GT), zero-shot multi-speaker TTS mode (ZS), and the fine-tuning (FT) with speaker samples. + +In general, our model's fine-tuning with less than 1 minute of speech from speakers who have recording characteristics not seen during training achieved very promising results, significantly improving similarity in all experiments. + +In English, the results of our model in zero-shot multi-speaker TTS mode are already good and after fine-tuning both male and female speakers achieved Sim-MOS comparable to the ground truth. The fine-tuned model achieves greater SECS than the ground truth, which was already observed in previous experiments. We believe that this phenomenon can be explained by the model learning to copy the recording characteristics and reference sample's distortions, giving an advantage over other real speaker samples. + +In Portuguese, compared to zero-shot, fine-tuning seems to trade a bit of naturalness for a much better similarity. For the male speaker, the Sim-MOS increased from + +$3.35 \pm 0.12$ to $4.19 \pm 0.07$ after fine-tuning with just 31 seconds of speech for that speaker. For the female speaker, the similarity improvement was even more impressive, going from $2.77 \pm 0.15$ in zero-shot mode to $4.43 \pm 0.06$ after the fine-tuning with just 20 seconds of speech from that speaker + +Although our model manages to achieve high similarity using only seconds of the target speaker's speech, Table 3 seems to presents a direct relationship between the amount of speech used and the naturalness of speech (MOS). With approximately 1 minute of speech in the speaker's voice our model can copy the speaker's speech characteristics, even increasing the naturalness compared to zero-shot mode. On the other hand, using 44 seconds or less of speech reduces the quality/naturalness of the generated speech when compared to the zero-shot or ground truth model. Therefore, although our model shows good results in copying the speaker's speech characteristics using only 20 seconds of speech, more than 45 seconds of speech are more adequate to allow higher quality. Finally, we also noticed that voice conversion improves significantly after fine-tuning the model, mainly in Portuguese and French where few speakers are used in training. + +# 7. Conclusions, Limitations and Future Work + +In this work, we presented YourTTS, which achieved SOTA results in zero-shot multi-speaker TTS and zero-shot voice conversion in the VCTK dataset. Furthermore, we show that our model can achieve promising results in a target language using only a single speaker dataset. Additionally, we show that for speakers who have both a voice and recording conditions that differ greatly from those seen in training, our model can be adjusted to a new voice using less than 1 minute of speech. + +However, our model exhibits some limitations. For the TTS experiments in all languages, our model presents instability in the stochastic duration predictor which, for some speakers and sentences, generates unnatural durations. We also note that mispronunciations occur for some words, especially in Portuguese. Unlike Casanova et al. (2022; 2020); Kim et al (2021), we do not use phonetic transcriptions, making our model more prone to such problems. For Portuguese voice conversion, the speaker's gender significantly influences the model's performance, due to the absence of female voices in training. For Speaker Adaptation, although our model shows good results in copying the speaker's speech characteristics using only 20 seconds of speech, more than 45 seconds of speech are more adequate to allow higher quality. + +In future work, we intend to seek improvements to the duration predictor of the YourTTS model as well as training in more languages. Furthermore, explore the application of this model for data augmentation in the training of automatic + +Table 3. SECS, MOS and Sim-MOS with ${95}\%$ confidence intervals for the speaker adaptation experiments. + +
SEXDUR. (SAM.)MODESECSMOSSIM-MOS
ENM61s (15)GT0.8754.17±0.094.08±0.13
ZS0.8514.11±0.074.04±0.09
FT0.8804.17±0.074.08±0.09
F44s (11)GT0.8944.25±0.114.17±0.13
ZS0.8144.12±0.084.11±0.08
FT0.8964.10±0.084.17±0.08
PTM31s (7)GT0.8804.76±0.124.31±0.14
ZS0.8174.03±0.113.35±0.12
FT0.9153.74±0.124.19±0.07
F20s (5)GT0.8734.62±0.194.65±0.14
ZS0.7433.59±0.132.77±0.15
FT0.9303.48±0.134.43±0.06
+ +speech recognition models in low-resource settings. + +# Acknowledgements + +This study was financed in part by the Coordenação de Aperfeçoamento de Pessoal de Nível Superior - Brasil (CAPES) - Finance Code 001, FAPESP grant #2019/07316-0, CNPq (National Council of Technological and Scientific Development) grant 304266/2020-5, and Artificial Intelligence Excellence Center (CEIA) $^{10}$ . Also, we would like to thank the Defined.ai $^{11}$ for making industrial-level MOS testing so easily available. Finally, we would like to thank all contributors to the Coqui TTS repository $^{12}$ , this work was only possible thanks to the commitment of all. + +# References + +Ardila, R., Branson, M., Davis, K., Kohler, M., Meyer, J., Henretty, M., Morais, R., Saunders, L., Tyers, F., and Weber, G. Common voice: A massively-multilingual speech corpus. In Proceedings of the 12th Language Resources and Evaluation Conference, pp. 4218-4222, 2020. +Arik, S., Chen, J., Peng, K., Ping, W., and Zhou, Y. Neural voice cloning with a few samples. In Advances in Neural Information Processing Systems, pp. 10019-10029, 2018. +Baevski, A., Zhou, Y., Mohamed, A., and Auli, M. wav2vec 2.0: A framework for self-supervised learning of speech representations. Advances in Neural Information Processing Systems, 33, 2020. +Binkowski, M., Donahue, J., Dieleman, S., Clark, A., Elsen, E., Casagrande, N., Cobo, L. C., and Simonyan, K. High fidelity speech synthesis with adversarial networks. In International Conference on Learning Representations, 2019. +Cai, W., Chen, J., and Li, M. Exploring the encoding layer and loss function in end-to-end speaker and language recognition system. arXiv preprint arXiv:1804.05160, 2018. +Cao, Y., Wu, X., Liu, S., Yu, J., Li, X., Wu, Z., Liu, X., and Meng, H. End-to-end code-switched tts with mix of monolingual recordings. In ICASSP 2019-2019 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 6935-6939. IEEE, 2019. +Casanova, E., Junior, A. C., de Oliveira, F. S., Shulby, C., Teixeira, J. P., Ponti, M. A., and Aluisio, S. M. End-to-end speech synthesis applied to brazilian portuguese. arXiv preprint arXiv:2005.05144, 2020. +Casanova, E., Shulby, C., Gölge, E., Müller, N. M., de Oliveira, F. S., Candido Jr., A., da Silva Soares, A., Aluisio, S. M., and Ponti, M. A. SC-GlowTTS: An Efficient Zero-Shot Multi-Speaker Text-To-Speech Model. In Proc. Interspeech 2021, pp. 3645-3649, 2021. doi: 10.21437/Interspeech.2021-1774. +Casanova, E., Junior, A. C., Shulby, C., Oliveira, F. S. d., Teixeira, J. P., Ponti, M. A., and Aluisio, S. Tts-portuguese corpus: a corpus for speech synthesis in brazilian portuguese. Language Resources and Evaluation, pp. 1-13, 2022. +Choi, H.-S., Lee, J., Kim, W., Lee, J., Heo, H., and Lee, K. Neural analysis and synthesis: Reconstructing speech from self-supervised representations. Advances in Neural Information Processing Systems, 34, 2021. + +Choi, S., Han, S., Kim, D., and Ha, S. Attentron: Few-shot text-to-speech utilizing attention-based variable-length embedding. arXiv preprint arXiv:2005.08484, 2020. +Chung, J. S., Nagrani, A., and Zisserman, A. Vox-celeb2: Deep speaker recognition. In Proc. Interspeech 2018, pp. 1086-1090, 2018. doi: 10.21437/Interspeech.2018-1929. URL http://dx.doi.org/10.21437/Interspeech.2018-1929. +Chung, J. S., Huh, J., Mun, S., Lee, M., Heo, H. S., Choe, S., Ham, C., Jung, S., Lee, B.-J., and Han, I. In defence of metric learning for speaker recognition. In Interspeech, 2020. +Cooper, E., Lai, C.-I., Yasuda, Y., Fang, F., Wang, X., Chen, N., and Yamagishi, J. Zero-shot multi-speaker text-to-speech with state-of-the-art neural speaker embeddings. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 6184-6188. IEEE, 2020. +Dinh, L., Sohl-Dickstein, J., and Bengio, S. Density estimation using real NVP. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings. OpenReview.net, 2017. URL https://openreview.net/forum?id=HkpbnH91x. +Hao, X., Su, X., Horaud, R., and Li, X. Full-subnet: A full-band and sub-band fusion model for real-time single-channel speech enhancement. ICASSP 2021 - 2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), Jun 2021. doi: 10.1109/icassp39728.2021.9414177. URL http://dx.doi.org/10.1109/ICASSP39728.2021.9414177. +Heo, H. S., Lee, B.-J., Huh, J., and Chung, J. S. Clova baseline system for the voceleb speaker recognition challenge 2020. arXiv preprint arXiv:2009.14153, 2020. +Ito, K. et al. The lj speech dataset, 2017. +Jemine, C. Master thesis: Real-time voice cloning. 2019. +Jia, Y., Zhang, Y., Weiss, R., Wang, Q., Shen, J., Ren, F., Nguyen, P., Pang, R., Moreno, I. L., Wu, Y., et al. Transfer learning from speaker verification to multispeaker text-to-speech synthesis. In Advances in neural information processing systems, pp. 4480-4490, 2018. +Kim, J., Kim, S., Kong, J., and Yoon, S. Glow-tps: A generative flow for text-to-speech via monotonic alignment search. arXiv preprint arXiv:2005.11129, 2020. +Kim, J., Kong, J., and Son, J. Conditional variational autoencoder with adversarial learning for end-to-end text-to-speech. arXiv preprint arXiv:2106.06103, 2021. + +Kingma, D. P. and Welling, M. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013. +Kong, J., Kim, J., and Bae, J. Hifi-gan: Generative adversarial networks for efficient and high fidelity speech synthesis. arXiv preprint arXiv:2010.05646, 2020. +Kumar, N., Goel, S., Narang, A., and Lall, B. Normalization Driven Zero-Shot Multi-Speaker Speech Synthesis. In Proc. Interspeech 2021, pp. 1354-1358, 2021. doi: 10.21437/Interspeech.2021-441. +Li, S., Ouyang, B., Li, L., and Hong, Q. Light-tts: Lightweight multi-speaker multi-lingual text-to-speech. In ICASSP 2021-2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 8383-8387. IEEE, 2021. +Loshchilov, I. and Hutter, F. Decoupled weight decay regularization, 2017. +Munich Artificial Intelligence Laboratories GmbH. The m-ailabs speech dataset - caito, 2017. URL https://www.caito.de/2019/01/the-m-ailabs-speech-dataset/. +Nagrani, A., Chung, J. S., and Zisserman, A. Voxceleb: a large-scale speaker identification dataset. arXiv preprint arXiv:1706.08612, 2017. +Nekvinda, T. and Dusek, O. One model, many languages: Meta-learning for multilingual text-to-speech. Proc. Interspeech 2020, pp. 2972-2976, 2020. +Oord, A. v. d., Dieleman, S., Zen, H., Simonyan, K., Vinyals, O., Graves, A., Kalchbrenner, N., Senior, A., and Kavukcuoglu, K. Wavenet: A generative model for raw audio. arXiv preprint arXiv:1609.03499, 2016. +Paszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J., Chanan, G., Killeen, T., Lin, Z., Gimelshein, N., Antiga, L., et al. Pytorch: An imperative style, high-performance deep learning library. Advances in neural information processing systems, 32:8026-8037, 2019. +Ping, W., Peng, K., Gibiansky, A., Arik, S. O., Kannan, A., Narang, S., Raiman, J., and Miller, J. Deep voice 3: 2000-speaker neural text-to-speech. arXiv preprint arXiv:1710.07654, 2017. +Pratap, V., Xu, Q., Sriram, A., Synnaeve, G., and Collobert, R. MLS: A large-scale multilingual dataset for speech research. In Meng, H., Xu, B., and Zheng, T. F. (eds.), Interspeech 2020, 21st Annual Conference of the International Speech Communication Association, Virtual Event, Shanghai, China, 25-29 October 2020, pp. 2757-2761. ISCA, 2020. doi: 10.21437/Interspeech.2020-2826. URL https://doi.org/10.21437/Interspeech.2020-2826. + +Prenger, R., Valle, R., and Catanzaro, B. Waveglow: A flow-based generative network for speech synthesis. In ICASSP 2019-2019 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 3617-3621. IEEE, 2019. +Qian, K., Zhang, Y., Chang, S., Yang, X., and Hasegawa-Johnson, M. Autovc: Zero-shot voice style transfer with only autoencoder loss. In International Conference on Machine Learning, pp. 5210-5219. PMLR, 2019. +Ren, Y., Hu, C., Tan, X., Qin, T., Zhao, S., Zhao, Z., and Liu, T.-Y. Fastspeech 2: Fast and high-quality end-to-end text to speech. In International Conference on Learning Representations, 2021. +Ribeiro, F., Florencia, D., Zhang, C., and Seltzer, M. Crowdmos: An approach for crowdsourcing mean opinion score studies. In Acoustics, Speech and Signal Processing (ICASSP), 2011 IEEE International Conference on, pp. 2416-2419. IEEE, 2011. +Shen, J., Pang, R., Weiss, R. J., Schuster, M., Jaitly, N., Yang, Z., Chen, Z., Zhang, Y., Wang, Y., Skerrv-Ryan, R., et al. Natural tts synthesis by conditioning wavenet on mel spectrogram predictions. In 2018 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 4779-4783. IEEE, 2018. +Snyder, D., Garcia-Romero, D., Sell, G., Povey, D., and Khudanpur, S. X-vectors: Robust dnn embeddings for speaker recognition. In 2018 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 5329-5333. IEEE, 2018. +Tan, X., Qin, T., Soong, F., and Liu, T.-Y. A survey on neural speech synthesis. arXiv preprint arXiv:2106.15561, 2021. +Veaux, C., Yamagishi, J., MacDonald, K., et al. Superseded-cstr vctk corpus: English multi-speaker corpus for cstr voice cloning toolkit. University of Edinburgh. The Centre for Speech Technology Research (CSTR), 2016. +Wan, L., Wang, Q., Papir, A., and Moreno, I. L. Generalized end-to-end loss for speaker verification. In 2018 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 4879-4883. IEEE, 2018. +Wang, S. and Borth, D. Noisevc: Towards high quality zero-shot voice conversion. arXiv preprint arXiv:2104.06074, 2021. +Xin, D., Saito, Y., Takamichi, S., Koriyama, T., and Saruwatari, H. Cross-Lingual Speaker Adaptation Using Domain Adaptation and Speaker Consistency Loss for Text-To-Speech Synthesis. In Proc. Interspeech 2021, pp. 1614-1618, 2021. doi: 10.21437/Interspeech.2021-897. + +Zen, H., Dang, V., Clark, R., Zhang, Y., Weiss, R. J., Jia, Y., Chen, Z., and Wu, Y. Libritts: A corpus derived from librispeech for text-to-speech. arXiv preprint arXiv:1904.02882, 2019. +Zhang, Y., Weiss, R. J., Zen, H., Wu, Y., Chen, Z., Skerry-Ryan, R., Jia, Y., Rosenberg, A., and Ramabhadran, B. Learning to speak fluently in a foreign language: Multilingual speech synthesis and cross-language voice cloning. Proc. Interspeech 2019, pp. 2080-2084, 2019. \ No newline at end of file diff --git a/yourttstowardszeroshotmultispeakerttsandzeroshotvoiceconversionforeveryone/images.zip b/yourttstowardszeroshotmultispeakerttsandzeroshotvoiceconversionforeveryone/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..83f8391b7d63585405d35ae1df06be5772228e72 --- /dev/null +++ b/yourttstowardszeroshotmultispeakerttsandzeroshotvoiceconversionforeveryone/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3c30f322a6798b419c044c51cb7bd8b71f3486849506bccaec260e6b1ee03b41 +size 313629 diff --git a/yourttstowardszeroshotmultispeakerttsandzeroshotvoiceconversionforeveryone/layout.json b/yourttstowardszeroshotmultispeakerttsandzeroshotvoiceconversionforeveryone/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..8556741063253c833385f9fabf40bb6802acefd5 --- /dev/null +++ b/yourttstowardszeroshotmultispeakerttsandzeroshotvoiceconversionforeveryone/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a47dba467235754384477e9b8a504b79a70d3882de23203303eba3c47b1548df +size 343457 diff --git a/zeroshotautomlwithpretrainedmodels/ba80b5a1-d489-490a-8d21-68e4f393ff46_content_list.json b/zeroshotautomlwithpretrainedmodels/ba80b5a1-d489-490a-8d21-68e4f393ff46_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..ea4ac31fc56d1b8fb635513b40a1969074593d92 --- /dev/null +++ b/zeroshotautomlwithpretrainedmodels/ba80b5a1-d489-490a-8d21-68e4f393ff46_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d75004ef57617afb33b80edc04a82ce93ec9a6b2bff24fcdbe26090e70b51aa3 +size 105953 diff --git a/zeroshotautomlwithpretrainedmodels/ba80b5a1-d489-490a-8d21-68e4f393ff46_model.json b/zeroshotautomlwithpretrainedmodels/ba80b5a1-d489-490a-8d21-68e4f393ff46_model.json new file mode 100644 index 0000000000000000000000000000000000000000..d42a9187ed4dabcf591370c089412758a4852ce2 --- /dev/null +++ b/zeroshotautomlwithpretrainedmodels/ba80b5a1-d489-490a-8d21-68e4f393ff46_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:031687ba9725caea63c0e6d38b3f22f66eb1326f981408f00bfc7082b90266cc +size 136295 diff --git a/zeroshotautomlwithpretrainedmodels/ba80b5a1-d489-490a-8d21-68e4f393ff46_origin.pdf b/zeroshotautomlwithpretrainedmodels/ba80b5a1-d489-490a-8d21-68e4f393ff46_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..ba23c519b33478cb9eff77c797ca6eecfe8e34c7 --- /dev/null +++ b/zeroshotautomlwithpretrainedmodels/ba80b5a1-d489-490a-8d21-68e4f393ff46_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f8a3fd22724c0c4cb2b630cfb16aeeb5f2015ca9e26a2fc53ff6be9d91fd60b7 +size 2068602 diff --git a/zeroshotautomlwithpretrainedmodels/full.md b/zeroshotautomlwithpretrainedmodels/full.md new file mode 100644 index 0000000000000000000000000000000000000000..6224261fa2ab9e31ef42e676fb1cd5f9180908e3 --- /dev/null +++ b/zeroshotautomlwithpretrainedmodels/full.md @@ -0,0 +1,438 @@ +# Ekrem Öztürk\*1 Fabio Ferreira\*1 Hadi S. Jomaa\*2 Lars Schmidt-Thieme 2 Josif Grabocka Frank Hutter 13 + +# Abstract + +Given a new dataset $D$ and a low compute budget, how should we choose a pre-trained model to fine-tune to $D$ , and set the fine-tuning hyperparameters without risking overfitting, particularly if $D$ is small? Here, we extend automated machine learning (AutoML) to best make these choices. Our domain-independent meta-learning approach learns a zero-shot surrogate model, which, at test time, allows to select the right deep learning (DL) pipeline (including the pre-trained model and fine-tuning hyperparameters) for a new dataset $D$ given only trivial meta-features describing $D$ , such as image resolution or the number of classes. To train this zero-shot model, we collect performance data for many DL pipelines on a large collection of datasets and meta-train on this data to minimize a pairwise ranking objective. We evaluate our approach under the strict time limit of the vision track of the ChaLearn AutoDL challenge benchmark, clearly outperforming all challenge contenders. + +# 1. Introduction + +A typical problem in deep learning (DL) applications is to find a good model for a given dataset $D$ in a restrictive time budget. In the case of tabular data, a popular approach for solving this problem is automated machine learning (AutoML), as implemented, e.g., in Auto-sklearn (Feurer et al., 2015a) or Auto-Gluon (Erickson et al., 2020). However, in domains such as computer vision and natural language processing, a better solution, especially under low resource constraints, is typically to fine-tune an existing pre-trained model. This, at first glance, appears to render AutoML unnecessary for those domains. However, as we will demonstrate in this paper, AutoML and pre-trained models can be + +*Equal contribution 1University of Freiburg 2University of Hildesheim Bosch Center for Artificial Intelligence. Correspondence to: Fabio Ferreira . + +Proceedings of the $39^{th}$ International Conference on Machine Learning, Baltimore, Maryland, USA, PMLR 162, 2022. Copyright 2022 by the author(s). + +combined to yield much stronger performance than either of them alone. + +A great advantage of fine-tuning pre-trained models is strong anytime performance: the use of pre-trained models often allows to obtain very strong performance orders of magnitude faster than when training a model from scratch. In many practical applications, this strong anytime performance is crucial, e.g., for DL-based recognition systems in manufacturing, or automated DL (AutoDL) web services. The clock starts ticking as soon as a new dataset is available, and it would be far too costly to train a new model from scratch, let alone optimize its hyperparameters. The recent ChaLearn AutoDL competition (Liu et al., 2021) mimicked these tight time constraints, rewarding performance found in an anytime fashion. + +While fine-tuning pre-trained models enjoys strong anytime performance, it also introduces many additional degrees of freedom. Firstly, we need to select a pre-trained network to fine-tune. To obtain good anytime performance, we may even want to start by training a shallow model to obtain good results quickly, and at some point switch to fine-tuning a deeper model. There are many additional degrees of freedom in this fine-tuning phase, concerning learning rates, data augmentation, and regularization techniques. We refer to the combination of a pre-trained model and the fully specified fine-tuning phase, including its hyperparameters, as a DL pipeline. Which DL pipeline works best depends heavily on the dataset, for instance, datasets with high-resolution images may favor the use of more downsampling layers than the low-resolution images of the CIFAR dataset (Krizhevsky et al., 2009); likewise, datasets with few images may favor smaller learning rates. We, therefore, require an automated method for selecting the best DL pipeline based on the characteristics of the dataset at hand. + +In this paper, we tackle this problem by meta-learning a model across datasets that enables zero-shot DL pipeline selection. Specifically, we create a meta-dataset holding the performance of many DL pipelines on a broad range of datasets. Using this meta-dataset, we then learn a function that selects the right DL pipeline based on the properties of the dataset (e.g., the image resolution and the number of images) in a zero-shot setting. To learn this selection function, we first formulate DL pipeline selection as a classical + +algorithm selection (AS) problem (Rice, 1976) and then improve upon this formulation by recognizing DL pipelines as points in a geometric space that allows information about the performance of some pipelines to inform performance on others. We then train a deep neural network with a pairwise ranking objective to emphasize the rank of the DL pipeline predicted to perform best in a manner that automatically normalizes across datasets. Note, that we use the zero-shot nomenclature not to refer to samples of unseen classes but to express that we cannot even afford a single exploratory evaluation of a pipeline but need to directly select a suitable one in a zero-shot manner. + +Our contributions can be summarized as: + +- We extend AutoML to best exploit pre-trained models by meta-learning to select the best DL pipeline conditional on dataset meta-features. +- We introduce a large meta-dataset with the performances of 525 DL pipelines across 35 image-classification datasets and 15 augmentations each. With $525*35*15$ entries, it is, to our best knowledge, the first DL meta-dataset for image classification of this size, being over 1000 times larger than previous meta-datasets (Triantafillou et al., 2019). +- We go beyond a standard formulation as an algorithm selection problem by formulating the new problem of selecting a DL pipeline as a point in a geometric space to exploit similarities between DL pipelines. +- We introduce a novel zero-shot AutoDL method that addresses this pipeline selection problem with a pairwise ranking loss. +- In the setting of the recent ChaLearn AutoDL challenge (Liu et al., 2021), our zero-shot AutoDL approach dominates all competitors on a broad range of 35 image datasets, as well as in the challenge itself. + +To foster reproducibility, we make our PyTorch (Paszke et al., 2019) code, models, and data publicly available under this URL. + +# 2. Related Work + +Algorithm selection Assume a set $\mathcal{P}$ of algorithms $\mathcal{A} \in \mathcal{P}$ (e.g., classifiers or neural network hyperparameter configurations), a set of instances $i \in \mathcal{I}$ (e.g., dataset features), and a cost metric $m: \mathcal{P} \times \mathcal{I} \to \mathbb{R}$ . Specifying the loss of algorithm $\mathcal{A} \in \mathcal{P}$ on instance $i \in \mathcal{I}$ with $m(\mathcal{A}, i)$ , the algorithm selection problem (Rice, 1976; Smith-Miles, 2009; Kotthoff et al., 2012; Bischl et al., 2016) is to find a mapping $s: \mathcal{I} \rightarrow \mathcal{P}$ that minimizes the cost metric $\sum_{i \in \mathcal{I}} m(s(i), i)$ across instances $\mathcal{I}$ . Algorithm selection has been applied to achieve state-of-the-art results in many hard combinatorial problems, most prominently Boolean satisfiability + +solving (SAT), where SATzilla (Xu et al., 2008) won several competitions by learning to select the best SAT solver on a per-instance basis. There are many methods for solving algorithm selection, based on regression (Xu et al., 2008), k-nearest neighbours (Kadioglu et al., 2011), cost-sensitive classification (Xu et al., 2012), and clustering (Kadioglu et al., 2010; Malitsky et al., 2013). AutoFolio (Lindauer et al., 2015) is a state-of-the-art algorithm selection system that combines all of these approaches in one and chooses between them using algorithm configuration (Hutter et al., 2011). We will use AutoFolio as one of our methods for selecting DL pipelines based on dataset meta-features. + +Hyperparameter optimization (HPO) HPO plays an integral role in fine-tuning any machine learning algorithm. Beyond simple strategies, such as random search (Bergstra & Bengio, 2012), conventional techniques typically involve fitting (probabilistic) surrogate models of the true response, e.g. Gaussian Process (Rasmussen & Williams, 2006), random forests (Hutter et al., 2011), neural networks (Springenberg et al., 2016), or some hybrid techniques (Snoek et al., 2015), and selecting configurations that optimize predefined acquisition functions (Wilson et al., 2018). Recently, approaches started taking into account the dissimilarity between pre-training and downstream domains (Li et al., 2020). HPO multi-fidelity methods further reduce the wall-clock time necessary to arrive at optimal configurations (Li et al., 2017; Falkner et al., 2018; Awad et al., 2021). + +Transfer HPO Transfer learning can be used in HPO to leverage knowledge from previous experiments to yield a strong surrogate model with few observations on the target dataset. For example, Wistuba & Grabocka 2021 and Jomaa et al. 2021a both propose a meta-initialization strategy by optimizing a deep kernel Gaussian process surrogate model (Wilson et al., 2016) across meta-train datasets to allow for fast adaptation given a few observations. Similarly, Salinas et al. 2020 learns a Gaussian Copula (Wilson & Ghahramani, 2010) and addresses the heterogeneous scales of the responses across datasets, whereas Perrone et al. 2018 pre-trains a shared layer in a multi-task setting. Transfer HPO is also possible based on meta-features (Vanschoren, 2018), i.e. dataset characteristics which can be either engineered (Feurer et al., 2015b; Wistuba et al., 2016) or learned (Jomaa et al., 2021b) to warm-start HPO. + +Zero-shot HPO The conventional setting of zero-shot learning aims to recognize samples whose instances may not have been seen during training (Xian et al., 2018; Verma et al., 2018; Radford et al., 2021). In the setting of zero-shot HPO, in contrast, the focus lies on improving sample efficiency for hyperparameter optimization. Contrary to techniques in previous sections that improve their sample efficiency by increasing the number of trials, zero-shot HPO + +has emerged as a more efficient approach that does not require any observations of the response on the target dataset. Wistuba et al. 2015 design a sequential model-free approach that optimizes the ranks of hyperparameter configurations based on their average performance over a collection of datasets. Winkelmolen et al. 2020 propose a Bayesian optimization solution for zero-shot HPO, whereby a surrogate model is fit to the dataset and hyperparameters and optimized by minimizing a ranking meta-loss. We note that both these approaches return a fixed set of hyperparameter configurations without using meta-features, which is undesirable as the AutoDL setting used in this work only allows for running a single model. Related to our work is (Tornede et al., 2020), who also describe datasets and pipelines as joint feature vectors. They use these to assess the learning of zero-shot models with algorithm selection and ranking-based objectives in a benchmark of tabular datasets and shallow base models in a sparse cost-matrix setting. In this paper, we propose a novel zero-shot HPO solution inspired by the success of algorithm selection techniques that learns to select the best DL pipeline based on both parametric choices inside the DL pipeline and dataset meta-features of complex vision datasets, by optimizing a ranking objective jointly across datasets. + +AutoDL Competition ChaLearn's AutoDL Challenge (Liu et al., 2021) evaluated competitors in an anytime setting with strict time limits, leading to the prominent use of pre-trained models by the participants. We focus on the challenge's image-track and summarize the winning approaches here and give more details in Section 5.3. In the 2019 AutoCV/CV2 competition, the winning approach (Baek et al., 2020) used a ResNet-18 (He et al., 2015) pre-trained on ImageNet (Krizhevsky et al., 2012) with Fast AutoAugment (Lim et al.). All image-track winning solutions used the AutoCV winner code as a skeleton and built their methods on top. Their modifications ranged from switching to a more stable ResNet-9 during training (DeepWisdom), ensembling predictions (DeepBlueAI) to data-adaptive pre-processing (PASA NJU). + +Meta-learning Meta-learning (Finn et al., 2017) can be used to solve tasks where the training dataset is small. Sun et al. 2019 meta-learn to transfer large-scale pre-trained DNN weights to solve few-shot learning tasks. Verma et al. 2019 tackle Zero-Shot Learning by meta-learning a generative model for synthesizing examples from unseen classes conditioned on class attributes. Laadan et al. 2019 generate (shallow model) pipelines on diverse datasets and use dataset meta-features to rank the pipelines to create a meta-dataset of pipelines and their performance results. + +Despite the abundance of meta-learning methods, and in contrast to the large benchmarks for tabular data (Pineda- + +Arango et al., 2021), few meta-learning benchmarks exist for image datasets. Zhai et al. 2019 introduced a set of 19 vision tasks and evaluated 18 representation learning methods. Triantafillou et al. 2019 also introduced a metadata-set of 10 few-shot image tasks and a growing set of baselines, currently comprising 11 and 18 evaluations on two different settings. Dumoulin et al. 2021 combines these two benchmarks and compares Big Transfer (Kolesnikov et al., 2020) against the baselines of Triantafillou et al. 2019. As we will show, our DL meta-dataset for image tasks is far larger than all previous meta-learning benchmarks. + +# 3. Zero-Shot AutoML with Pretained Models + +# 3.1. Notation and Problem Definition + +Let $\mathcal{X} \coloneqq \{x_n\}_{n=1}^N$ denote a set of $N$ distinct deep learning (DL) pipelines. Every DL pipeline $x_n \coloneqq (M_n, \theta_n)$ comprises a pre-trained model $M_n \in \mathcal{M}$ and fine-tuning hyperparameters $\theta_n \in \Theta$ that are used to fine-tune $M_n$ to a given dataset. Furthermore, let $\mathcal{D} = \{D_i\}_{i=1}^I$ denote a collection of $I$ datasets, where each dataset $D_i \in \mathcal{D}$ is split into disjoint training, validation and testing subsets $D_i \coloneqq D_i^{(\mathrm{tr})} \cup D_i^{(\mathrm{val})} \cup D_i^{(\mathrm{test})}$ . For each dataset, we are given a vector of $K$ descriptive characteristics (a.k.a. meta-features), such as the number of data points and the image resolution, as $\phi_i \in \Phi \subseteq \mathbb{R}^K$ (see Section 4.1 for the full set of meta-features we used in our experiments). We denote by $x_n^{(\mathrm{ft})} \coloneqq \mathrm{Tune}(x_n, D^{(\mathrm{tr})}, D^{(\mathrm{val})})$ the model resulting from fine-tuning the pre-trained model $M_n$ with hyperparameters $\theta_n$ on training data $D^{(\mathrm{tr})}$ using validation data $D^{(\mathrm{val})}$ for early stopping. Then, denoting the loss of a fine-tuned model $x_n^{(\mathrm{ft})}$ on the test split of the same dataset $D$ as $\mathcal{L}(x_n^{(\mathrm{ft})}, D^{(\mathrm{test})})$ , the test cost of DL pipeline $x_n$ on $D$ is defined as: + +$$ +C \left(x _ {n}, D\right) = \mathcal {L} \left(\operatorname {T u n e} \left(x _ {n}, D ^ {\left(\mathrm {t r}\right)}, D ^ {\left(\mathrm {v a l}\right)}\right), D ^ {\left(\mathrm {t e s t}\right)}\right). \tag {1} +$$ + +Definition 1. Given a set of $N$ DL pipelines $\mathcal{X} \coloneqq \{x_n\}_{n=1}^N$ and a collection of $I$ datasets $\mathcal{D} = \{D_i\}_{i=1}^I$ with meta-features $\phi_i$ for dataset $D_i \in \mathcal{D}$ , and a $N \times I$ matrix of costs $C(x_n, D_i)$ representing the cost of pipeline $x_n$ on dataset $D_i$ , the problem of zero-shot AutoML with pre-trained models (ZAP) is to find a mapping $f: \Phi \to \mathcal{X}$ that yields minimal expected cost over $\mathcal{D}$ : + +$$ +\operatorname {a r g m i n} _ {f} \mathbb {E} _ {i \sim \{1, \dots , I \}} \left[ C (f (\phi_ {i}), D _ {i}) \right]. \tag {2} +$$ + +# 3.2. ZAP via Algorithm Selection (ZAP-AS) + +The problem of zero-shot AutoML with pre-trained models from Definition 1 can be directly formulated as an algorithm selection problem: the DL pipelines $\mathcal{X} \coloneqq \{x_n\}_{n=1}^N$ are the algorithms $\mathcal{P}$ , the datasets $\{D_i\}_{i=1}^I$ are the instances $\mathcal{I}$ , and the test cost $C(x_n, D)$ of DL pipeline $x_n$ on $D$ defines the cost metric $m: \mathcal{P} \times \mathcal{I} \to \mathbb{R}$ . We use the state-of-the-art + +![](images/8032338fdca5a787f85a50d1ca76d0ccda67acdaff0aa5cdcf965c747a949752.jpg) +Figure 1. ZAP consists of two stages. In the meta-train stage, the cost matrix on the source tasks is leveraged to learn a joint response surface conditioned on the meta-features and pipelines. During the meta-test stage, ZAP assigns scores to the pipelines of the unseen datasets and the highest-scoring pipeline is selected. + +algorithm selection system AutoFolio to learn a selector between our predefined DL pipelines, since it subsumes approaches based on regression, classification, clustering, and cost-sensitive classification, and selects the best one for the data at hand (Lindauer et al., 2015). + +While this formulation of zero-shot AutoML with pretrained models as algorithm selection will turn out to already yield very strong performance, it has one limitation: algorithm selection abstracts away our DL pipelines as uncorrelated algorithms, losing all information about the pre-trained models they are based on, and which hyperparameters are being used for fine-tuning. This information, e.g., allows us to predict the cost of DL pipelines to other DL pipelines with similar settings without ever having run them. Thus, we next introduce a novel approach for exploiting this knowledge. + +# 3.3. ZAP via Zero-Shot HPO (ZAP-HPO) + +We now describe a variant of our formulation of zero-shot AutoML that exploits the fact that the DL pipelines between which we select are points in a geometric space, and that we can see the space of DL pipelines we consider as a search space for hyperparameter optimization (HPO), with a categorical value for the choice of pre-trained model and continuous fine-tuning hyperparameters; we can then use concepts from zero-shot HPO to tackle this problem. + +We define $M$ as a finite collection of $N$ pre-trained models and represent each instance, $M_{n}$ , as a one-hot encoded vector, and $\theta_{n} \in \Theta \subseteq \mathbb{R}^{L}$ as a vector of continuous variables defining its respective hyperparameters. For instance, $\Theta$ can represent the continuous space of learning rates and dropout values of a pre-trained neural network model in $\mathcal{M} \in \{0,1\}^{|N|}$ . Consequently, the DL pipelines are pro + +jected to the geometric space defined by $\mathcal{X} \subseteq \mathcal{M} \times \Theta$ and can be viewed as a hyperparameter configuration space where pre-trained models are simply categorical variables. + +Denote by $f_{\psi}$ a parametric surrogate with parameters $\psi$ that estimates the test cost observed by fine-tuning the DL pipeline $x_{j}$ on dataset $D_{i}$ with meta-features $\phi_{i}$ . The surrogate captures the fusion of (i) pipeline hyperparameters (i.e. $x$ represented by the pre-trained model's one-hot-encoding indicator $\mathcal{M} \in \{1, \dots, M\}$ and the fine-tuning hyperparameters $\theta \in \Theta$ ) with (ii) dataset meta-features $\phi$ , in order to estimate the cost after fine-tuning. Formally, that is: + +$$ +f (\psi) _ {i, j} := f \left(x _ {j}, \phi_ {i}; \psi\right): \mathcal {M} \times \Theta \times \Phi \rightarrow \mathbb {R} _ {+} \tag {3} +$$ + +A unique aspect of searching for efficient pipelines is that we are concerned with the relative cost of the pipelines, to find the best one. As such, we propose to utilize the surrogate model as a proxy function for the rank of configurations, and learn the pairwise cost ranking of pairs of pipelines. In this perspective, pairwise ranking strategies use the relative ordering between pairs of configurations to optimize the probability that the rank of the $j$ -th pipeline is lower than the $k$ -th pipeline on the $i$ -th dataset. Therefore, using given pre-computed cost $C_{i,j} = C(x_j, D_i)$ we define the set of triples $\mathcal{E} := \{(i,j,k) \mid C(x_j, D_i) < C(x_k, D_i)\}$ . Every triple $(i,j,k)$ denotes a pair $(x_j, x_k)$ , where the cost of $x_j$ is smaller (better pipeline) than $x_k$ on the $i$ -th dataset. Correspondingly, we want our surrogate to predict $f(\psi)_{i,j}$ to be lower than $f(\psi)_{i,k}$ ; we thus meta-learn our surrogate with a ranking loss as: + +$$ +\underset {\psi} {\arg \min } \sum_ {(i, j, k) \in \mathcal {E}} \log \left(\sigma \left(f (\psi) _ {i, j} - f (\psi) _ {i, k}\right)\right), \tag {4} +$$ + +with $\sigma(\cdot)$ as the sigmoid function which prevents the difference from exploding to negative infinity as we minimize the loss. Equation 4 maximizes the gap between the surrogate scores, by decreasing the surrogate score for the good DL pipelines with low costs, while at the same time increasing the surrogate score of bad pipelines with high costs. As a result, the score of the best DL pipeline with the lowest cost will be maximally decreased. Furthermore, Figure 2 presents a visual description of our proposed ranking loss. + +![](images/adc1a6ecad40ccbb2693896b7e24e28c74c2332cf63785f599559f15dc2e9c5a.jpg) +Figure 2. Overview of our pairwise ranking objective + +Once we meta-learn the surrogate, we can transfer it to a new dataset $D^{(\mathrm{new})}$ with meta-features $\phi^{(\mathrm{new})}$ in a zero-shot HPO mechanism using Equation 5. The full meta-learn and meta-test procedure is depicted in Figure 1. + +$$ +x ^ {(\text {n e w})} := \underset {x _ {n}, n \in \{1, \dots , N \}} {\arg \min } f \left(x _ {n} ^ {(\mathrm {f t})}, \phi^ {(\text {n e w})}; \psi\right) \tag {5} +$$ + +For an empirical motivation on the benefits of learning surrogates with pairwise ranking losses, we compare to the same surrogate model optimized with a least-squares loss: + +$$ +\underset {\psi} {\arg \min } \sum_ {i = 1} ^ {I} \sum_ {n = 1} ^ {N} \left(f (\psi) _ {i, n} - C \left(x _ {n}, D _ {i}\right)\right) ^ {2} \tag {6} +$$ + +As a sanity check, we also compare the performance of randomly selecting a pipeline. In this experiment, we evaluate the performance of the pipeline having the largest estimated value by the surrogate (Equation 5) across all the $I$ -many source datasets. The results of Figure 3 demonstrate that the surrogate trained with Equation 4 is significantly better than the regression-based variant of Equation 6 in terms of identifying the best pipeline. Further details about the evaluation protocol are found in Section 5.1. + +![](images/4d8489765639f119e0e711a61e6cca1aa9f7bf17de841dbeb21cc189edef9500.jpg) +Figure 3. Critical difference diagram comparing loss functions using the Wilcoxon-Holm signed-rank (5% significance level). + +# 4. ZAP Meta-Dataset Design + +In this section, we introduce a novel meta-dataset (Pineda-Arango et al., 2021), that will ultimately allow us to perform zero-shot AutoML with pre-trained models (ZAP). The meta-data required for the ZAP problem includes a set of datasets with meta-features, a set of DL pipelines, and the test costs for these pipelines on these datasets. Correspondingly, we describe how we curated a set of 35 image datasets, with 15 augmentations each (4.1); define a space of DL pipelines (4.2); and find strong instantiations in it for each of the datasets, each of which we evaluate on all datasets to obtain a $525 \times 525$ matrix of test costs (4.3). + +# 4.1. A Set of Image Datasets for ZAP + +The set of datasets should be chosen to be representative of the datasets that will eventually be tackled by the ZAP system building on them. While all our pre-trained networks are pre-trained on ImageNet (Deng et al., 2009), during the fine-tuning stage also smaller and specialized datasets are + +to be expected. Consequently, we chose both small and large, as well as diverse datasets that cover a wide range of domains (objects, medical, aerial, drawings, etc.) with varying formats, i.e. colored and black-and-white images and datasets with varying image resolutions or the number of classes. With this preference in mind, we retrieved 35 core datasets provided by the TensorFlow (Abadi et al., 2015) Datasets (TFDS) utility library (Google, 2021) and applied a dataset augmentation process (Stoll, 2020) that takes a TFDS core dataset as input and outputs a subset of that differs in the number of classes and the number of train/test samples per class. Note that this dataset augmentation process does not perform augmentations on a sample level. We repeat this subset retrieval 15 times for each dataset, resulting in 525 datasets $\mathcal{D}$ . Further details about the augmentation process are found in Appendix A.2. + +To represent a dataset, we use only extremely cheap and readily available dataset-dependent meta-features (Hutter et al., 2020) $\phi$ : number of training images, number of image channels, image resolution, and number of classes. + +# 4.2. DL Pipeline Design Space for ZAP on Image Data + +The DL pipelines we employ should be chosen to be diverse and achieve high performance on the aforementioned datasets since the optimum we can hope for is to choose the best of these pipelines on a per-dataset basis. To obtain strong pipelines, we started from the code base of the winner of the AutoCV competition (Baek et al., 2020), which fine-tuned a pre-trained ResNet-18 model. We then built a highly-parameterized space of DL pipelines around this by exposing a wide range of degrees of freedom. These included fine-tuning hyperparameters, such as learning rate, percentage of frozen parameters, weight decay, and batch size. Additionally, we exposed hyperparameters for the online execution that were previously hard-coded and that control, e.g., the number of samples used or when to evaluate progress with the validation dataset. To span a more powerful space with diverse pipelines, we also added additional architectural, optimization, as well as fine-tuning choices, including: + +- A binary choice between an EfficientNet (Tan & Le, 2019) pre-trained on ImageNet (Russakovsky et al., 2015) or the previously-used ResNet-18; +- The proportion of weights frozen when fine-tuning; +- Additional stochastic optimizers (Adam (Kingma & Ba, 2015), AdamW (Loshchilov & Hutter, 2018), Nesterov accelerated gradient (Nesterov, 1983)) and learning rate schedules (plateau, cosine (Loshchilov & Hutter, 2017)); +- A choice of using a simple classifier (either a SVM, + +random forest or logistic regression) that can be trained and used within the first 90 seconds of run-time in order to improve anytime performance. + +Overall, our DL pipeline space $\mathcal{X}$ is comprised of 26 hyperparameters of the types real and integer-valued, categorical, and conditional. A condensed version is presented in Table 6. + +Table 1. The search space of our DL pipelines consisting of general DL hyperparameters, training-strategy hyperparameters and fine-tuning strategy hyperparameters. A more detailed version can be found in Appendix A.1. + +
NameType, ScaleRange
Batch sizeint, log[16, 64]
Learning ratefloat, log[10-5, 10-1]
Weight decayfloat, log[10-5, 10-2]
Momentumfloat[0.01, 0.99]
Optimizercat{SGD, Adam, AdamW}
Schedulercat{plateau, cosine}
Architecturecat{ResNet18, EffNet-b0, EffNet-b1, EffNet-b2}
Steps per epochint, log[5, 250]
Early epochint[1, 3]
CV ratiofloat[0.05, 0.2]
Max valid countint, log[128, 512]
Skip valid thresh.float[0.7, 0.95]
Test freq.int[1, 3]
Max inner loopfloat[0.1, 0.3]
# init samplesint, log[128, 512]
Max input sizeint[5, 7]
1stsimple modelcat{true, false}
Simple modelcat{SVC, NuSVC, RF, LR}
+ +# 4.3. Selection and Evaluation of DL Pipelines + +With the 525 datasets and our 26-dimensional DL pipeline space at our disposal, we now explain how we generated the DL pipeline candidates that we evaluated on the datasets. Instead of uniformly or randomly sampling the 26-dimensional DL pipeline space, to focus on DL pipelines that are strong at least on one dataset, we ran an optimization process to find a (near-)optimal DL pipeline for one dataset at a time. Specifically, we used the hyperparameter optimization method BOHB (Falkner et al., 2018), which supports high-dimensional and categorical hyperparameter spaces, to find a (near)-optimal instantiation of our DL pipeline space for each dataset. We optimized the anytime Area under the Learning Curve (ALC) score (introduced in the AutoDL challenge (Liu et al., 2021) and described in more detail in Section 5.1) via BOHB, with a budget of five minutes for evaluating one DL pipeline on one dataset. We repeated each of these runs three times and used the mean to handle the substantial noise in these evaluations. This process resulted in one optimized DL pipeline per dataset; + +we thus have $N = D = 525$ DL pipelines that comprise the set $\mathcal{X}$ of DL pipelines in our ZAP formulation. + +Given this set of 525 DL pipelines $\mathcal{X}$ , and the set of our 525 datasets $\mathcal{D}$ , let us now explain the evaluation procedure. We ran each pipeline $x \in \mathcal{X}$ on each dataset $D \in \mathcal{D}$ , computing the ALC score the pipelines reached within 10 minutes, and again computing the mean of three runs to reduce noise. While the AutoDL competition used a budget of 20 minutes, we used a shorter time of 10 minutes here (and 5 minutes for the runs of BOHB above) for two reasons: First, to limit the substantial computational overhead for carrying out these $525 \cdot 525 = 275$ , 625 evaluations of (DL pipeline, dataset) pairs; still, it required 2,871 GPU days to collect this data. Second, due to the typically monotonically increasing anytime ALC score, performance after 5 and 10 minutes can be expected to be a good proxy for the full 20 minutes. + +Finally, we record every pairs' average-of-three ALC score in the cost matrix $C \in \mathbb{R}^{NxI}$ (in our case with $N = I = 525$ since we found one DL pipeline per dataset). This cost matrix is visualized in Figure 4. From the cost matrix, we directly see that there are easy datasets (at the top, where all pipelines achieve high scores) and hard ones at the bottom (where only very few pipelines reach high scores). Likewise, there are overall strong pipelines (to the left, with good scores on most datasets) and poor ones (on the right, with good scores on only a few datasets). The most interesting pattern for ZAP is that there exists substantial horizontal and vertical striping, indicating that different datasets are hard for different pipelines. This points to the usefulness of selecting pipelines in a dataset-dependent manner in ZAP. + +![](images/8de0084fa2546debd688cb9699ccb4fd57d1150d5ebb054a9108231d43bccd3f.jpg) +Figure 4. Cost matrix C as a heatmap Color indicates the ALC score (higher is better). We observe that some datasets (dark rows) are more complex and some pipelines (dark columns) generalize worse across datasets systematically than others. + +# 5. Experiments + +Our experiments are designed to evaluate the performance of an AutoDL system based on ZAP. We use the anytime + +evaluation protocol of the ChaLearn AutoDL Challenge (Liu et al., 2021) and demonstrate that our ZAP methods perform substantially better than the winners of that competition, both in our ZAP evaluation benchmark grounded on our ZAP meta-dataset as well as in the original AutoDL challenge benchmark. We also carry out a range of ablations to better understand the root of our gains. + +# 5.1. Evaluation Protocol + +Let us first describe the restrictions of the evaluation protocol under which we evaluate different AutoDL methods (our ZAP approach and various baselines). The main restriction is the anytime learning metric to score participants with the Area under the Learning Curve (ALC): at each time step, an AutoDL system can update its predictions on test data, and in a post hoc evaluation phase, the accuracy of these predictions is averaged over the entire learning curve. A second core aspect of the challenge is the limited time budget of 20 minutes for training models and making predictions on test data. In light of the large training times of conventional deep learning models, this short time window encourages the use of efficient techniques, particularly the use of pretrained models. The performance measurement starts with the presentation of the training data (and the inputs of the test split), and the AutoDL system can train in increments and interleave test predictions; however, the time for making predictions also counts as part of the run-time budget. Consequently, AutoDL systems need to decide when to make predictions to improve performance. + +For a formal description of the metric, as well as an example of a learning curve plot under the competition metric, please see Appendix A.3. + +# 5.2. Benchmarks and Training Protocol + +Overall, we evaluate our ZAP methods under two benchmarks: one based on the ZAP meta-dataset which we refer to as ZAP benchmark and the original AutoDL benchmark. For the AutoDL benchmark, we submit our ZAP methods trained on the ZAP meta-dataset. The following describes how we train and evaluate our methods on the ZAP benchmark. We evaluate in a "leave-one-core-dataset-out protocol" that avoids any possibility of an information leak across augmented datasets. Specifically, we meta-train our methods on 34 out of the original 35 datasets, plus their augmented versions, and test on the held-out original dataset. We average the resulting performance over 35 outer loop iterations holding out a different core dataset each time. We further apply 5-fold inner cross-validation to optimally identify the best stopping epoch while monitoring validation performance. We evaluate each method (including the baselines) 10 times with different seeds and report averages, standard deviations, boxplots, and statistical tests over these 10 results. + +For evaluation under the AutoDL benchmark, we upload our ZAP methods trained on the ZAP meta-dataset as well as the baselines to the submission board, made available to us by the challenge organizers. We report the performances on the five undisclosed final datasets of different domains (objects, aerial, people, medical, handwriting recognition) across 10 submissions. Here, we used the same hyperparameters from the ZAP benchmark. + +# 5.3. Baselines + +To assess the performance of our proposed method, we compare it against multiple baselines, which we describe here. Aside from a random selection of one of our 525 carefully designed DL pipelines, and the single best pipeline on average across the datasets, we chose the top-3 winners of the 2019 ChaLearn AutoDL Challenge: DeepWisdom, DeepBlueAI, and PASA NJU. + +Given a novel dataset and our 525 selected DL pipelines, random selection uniformly samples one of these pipelines and single-best picks the one which performs best on average over $\mathcal{D}$ . We average the random selection baseline over three random selections. + +Table 2. Summary of winner techniques All contenders use ImageNet pre-trained networks and FAA denotes Fast AutoAugment. + +
SolutionAugmentationML technique
DeepWisdomFAAResNet18/9Meta-trained solution agents
DeepBlueAIFAAResNet18Adaptive ensemble learning
PASA NJUSimpleResNet18/SeResnext50Data adaptive preprocessing
+ +The challenge winner baselines build their methods on top of AutoCLIENT (Baek et al., 2020), with the following modifications (summarized in Table 2): + +- DeepWisdom initially caches mini-batches with a pre-trained ResNet-18 model and quickly switches to a pre-trained ResNet-9 by inputting cached batches first. They initialize the networks with ImageNet pre-trained parameters except for the batch normalization and bias layers. After an initial optimization phase, they turn on Fast AutoAugment (Lim et al.). +- DeepBlueAI initializes a pre-trained ResNet-18 network and adapts some of the model hyperparameters (image size, steps per epoch, epoch after which starting validating and fusing results, etc.) to the target dataset. They also ensemble the latest $n$ predictions to stabilize them. Later in the procedure, they augment the dataset by Fast AutoAugment for a limited budget. +- PASA NJU pre-processes the data with a data-adaptive strategy by first sampling images to analyze. Then + +they crop images to a standard shape and apply image flip augmentations. They start the training with a pretrained ResNet-18 and switch to SeResNext-50 (Hu et al., 2017) when no further improvement is expected on the validation score. + +# 5.4. Results on the ZAP Benchmark + +In Figure 5, we depict the performance of our ZAP methods ZAP-AS and ZAP-HPO compared to the winner baselines of the AutoDL challenge. Our algorithm-selection-based ZAP-AS method already outperforms the competition winners, and our geometry-aware ranking-based model, ZAP-HPO, performs even significantly better. + +In Table 3, we report the rank of the scores identifying the winners across the two main metrics. Our proposed method wins in both ALC score, i.e., the metric for which it was optimized, but also in terms of the normalized area under the curve (Normalized AUC). + +![](images/dbc91d42b54fda587d713ede83ceacb5c5e5206b966a2a1e8b906c1f53fc89d4.jpg) +Figure 5. ALC scores of our approach vs. winner baselines over 525 datasets and 10 repetitions. Our ZAP methods clearly improve over the challenge winners (higher is better), by almost 1 point. Our geometry-aware zero-shot HPO version of ZAP with its binary pairwise ranking objective works best. + +Table 3. Ranking our approach vs. winner baselines on the ZAP benchmark. We rank the solutions per test dataset and report average ranks over the 525 datasets (averages over 10 repetitions). ZAP clearly performs best (lower is better), both in terms of ALC (which it was optimized for) and also in terms of Normalized AUC. + +
SolutionRank (ALC)Rank(Normalized AUC)
DeepWisdom2.53 ± 0.062.63 ± 0.03
DeepBlueAI2.64 ± 0.042.73 ± 0.03
PASA NJU2.76 ± 0.032.56 ± 0.03
ZAP-HPO2.07 ± 0.052.08 ± 0.03
+ +# 5.5. Results for a Sparsely-filled Cost Matrix + +To further investigate the source of the gains in our model, we propose a more realistic setting, where the cost matrix includes missing values. While algorithm selection methods, such as ZAP-AS, require the dense cost matrix, our geometry-aware rank-based ZAP-HPO method handled missing values gracefully. To evaluate this quantitatively, next to ZAP-AS and ZAP-HPO with the full cost matrix, we also evaluate ZAP-HPO based on cost matrices that only have $75\%$ , $50\%$ , and $25\%$ of the entries (dropped at random) remaining. As Figure 6 shows, ZAP-HPO's performance loss due to missing entries is quite small, and even with only $25\%$ remaining entries, it still performs similarly to ZAP-AS. We believe that ZAP-HPO's low sensitivity to missing values stems from the capacity of the model to capture the correlation across the pipelines in the geometric space. It can hereby generalize well and "impute" missing values of the cost matrix. Furthermore, as shown in Table 4, even with missing values in the cost matrix, ZAP-HPO clearly outperforms the winners of the AutoDL competition. + +![](images/7d12923022ac457363fc51fe02ec8a6d1f3eb0c7c00cb612bd12e3b60197188d.jpg) +Figure 6. ALC scores of ZAP-HPO when meta-trained on a full (dense) vs. sparse cost matrix over 525 datasets and 10 repetitions. The density of the matrices are denoted as $75\%$ , $50\%$ , and $25\%$ . + +Table 4. The ranking of ZAP-HPO when optimized with a sparse cost matrix shows we still outperform the AutoDL challenge winner solutions. + +
Solution75% filled50% filled25% filled
DeepWisdom2.52 ± 0.062.52 ± 0.052.52 ± 0.05
DeepBlueAI2.64 ± 0.052.64 ± 0.042.63 ± 0.04
PASA NJU2.75 ± 0.032.75 ± 0.042.75 ± 0.04
ZAP-HPO (sparse)2.09 ± 0.062.09 ± 0.052.10 ± 0.04
+ +# 5.6. Results on the AutoDL Benchmark + +In Table 5 we report the average rank performances for the AutoDL benchmark on the five undisclosed datasets across 10 submissions. We highlight that, unlike the winner baselines, we did not use the challenge feedback datasets to optimize the base model and zero-shot model hyperparameters for the final submission but reused (only) the ones from the ZAP benchmark. Due to a difference in distributions between these benchmarks, it cannot be taken for granted that our method generalizes to the AutoDL competition datasets. However, as Table 5 shows, ZAP-HPO clearly outperforms the winner baselines on this AutoDL setting. It also clearly outperforms the single-best and random baselines (which have ranks $2.7(\pm 0.1)$ and $3.42(\pm 0.68)$ , respectively). In this setting of generalizing out of distribution, the more conservative ZAP-AS method performs even slightly better than ZAP-HPO, with average ranks of $1.81(\pm 0.3)$ vs. $2.16(\pm 0.15)$ . + +Table 5. Ranking our approach vs. winner baselines on the AutoDL benchmark. We rank the solutions per test dataset and report average ranks over the five AutoDL benchmark final datasets (averages over 10 submissions). + +
SolutionRank (ALC)
DeepWisdom2.46 ± 0.13
DeepBlueAI2.76 ± 0.08
PASA NJU2.62 ± 0.11
ZAP-HPO2.16 ± 0.15
+ +# 6. Conclusion + +In this paper we extend the realm of AutoML to address the common problem of fine-tuning pre-trained Deep Learning (DL) models on new image classification datasets. Concretely, we focus on deciding which pre-trained model to use and how to set the many hyperparameters of the fine-tuning procedure, in a regime where strong anytime performance is essential. We formalize the problem as Zero-shot AutoML with Pre-trained Models (ZAP), which transfers knowledge from a meta-dataset of a number of DL pipelines + +evaluated on a set of image datasets. In that context, we open-source the largest meta-dataset of evaluations for finetuning DL pipelines with 275K evaluated pipelines on 35 popular image datasets (2871 GPU days of compute). Furthermore, we propose two approaches for tackling ZAP: (i) formulating it as an instance of the algorithm selection (AS) problem and using AS methods, and (ii) a novel zero-shot hyperparameter optimization method trained with a ranking objective. Our methods clearly achieve the new state of the art in terms of anytime Automated Deep Learning (AutoDL) performance and significantly outperform all the solutions of the 2019 ChaLearn AutoDL Challenge. + +# 7. Limitations + +As mentioned before, computing the cost matrix is expensive. In particular, when training deep models, early optimization phases are often noisy and the final performance of a model is difficult to predict. Consequently, the accuracy of the cost matrix is directly coupled to the duration of the deep model training. Applying early-stopping methods to reduce the expenses of determining a cost matrix is thus challenging. Another limitation we observed is the sensitivity to the zero shot model's hyperparameters. For example, we noticed that using a least-squares or a triplet margin objective performed significantly worse than our ZAP-HPO objective. Lastly, it is not clear a-priori which attributes best describe the DL pipelines in order to achieve the best performance and selecting a sub-optimal set may lead to a deterioration of performance. + +# Acknowledgements + +This paper builds on and extends our original submission to the AutoDL challenge, and we are indebted to everyone who helped with that submission; in particular, we would like to thank Danny Stoll for his help on the initial hyperparameter configuration space design and data augmentation as well as Marius Lindauer for his help with AutoFolio. We also thank Dipti Sengupta for her help in reviewing both code and the paper. Moreover, we acknowledge funding by Robert Bosch GmbH, by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) under grant number 417962828, by the state of Baden-Württemberg through bwHPC, and the German Research Foundation (DFG) through grant no INST 39/963-1 FUGG, by TAILOR, a project funded by the EU Horizon 2020 research, and innovation programme under GA No 952215, and by European Research Council (ERC) Consolidator Grant "Deep Learning 2.0" (grant no. 101045765). Funded by the European Union. Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union or the ERC. Neither the European Union nor the ERC can be held responsible for them. + +# References + +Abadi, M., Agarwal, A., Barham, P., Brevdo, E., et al. TensorFlow: Large-scale machine learning on heterogeneous systems, 2015. URL https:// www.tensorflow.org/. +Awad, N., Mallik, N., and Hutter, F. DEHB: Evolutionary hyperband for scalable, robust and efficient hyperparameter optimization. In Proc. of IJCAI'21, pp. 2147-2153, 2021. +Baek, W., Kim, I., Kim, S., and Lim, S. AutoCLINT: The Winning Method in AutoCV Challenge 2019. volume abs/2005.04373, 2020. +Bergstra, J. and Bengio, Y. Random search for hyperparameter optimization. 13:281-305, 2012. +Bischl, B., Kerschke, P., Kotthoff, L., Lindauer, M., Malitsky, Y., Frechette, A., Hoos, H., Hutter, F., Leyton-Brown, K., Tierney, K., and Vanschoren, J. ASlib: A benchmark library for algorithm selection. 237:41-58, 2016. +Chrabaszcz, P., Loshchilov, I., and Hutter, F. A downsampled variant of imagenet as an alternative to the cifar datasets. arXiv preprint arXiv:1707.08819, 2017. +Clanuwat, T., Bober-Irizar, M., Kitamoto, A., Lamb, A., Yamamoto, K., and Ha, D. Deep learning for classical japanese literature, 2018. +Cohen, G., Afshar, S., Tapson, J., and Schaik, A. V. Emmist: Extending mnist to handwritten letters. 2017 International Joint Conference on Neural Networks (IJCNN), 2017. doi: 10.1109/ijCNN.2017.7966217. +Das, N., Reddy, J. M., Sarkar, R., Basu, S., Kundu, M., Nasipuri, M., and Basu, D. K. A statistical-topological feature combination for recognition of handwritten numerals. Appl. Soft Comput., 12(8):2486-2495, August 2012a. ISSN 1568-4946. URL http://dx.doi.org/10.1016/j.asoc.2012.03.039. +Das, N., Sarkar, R., Basu, S., Kundu, M., Nasipuri, M., and Basu, D. K. A genetic algorithm based region sampling for selection of local features in handwritten digit recognition application. Appl. Soft Comput., 12(5):1592-1606, May 2012b. URL http://dx.doi.org/10.1016/j.asoc.2011.11.030. +Deng, J., Dong, W., Socher, R., Li, L., Li, K., and Fei-Fei, L. ImageNet: A Large-Scale Hierarchical Image Database. In Proc. of CVPR'09, pp. 248-255, 2009. +Dumoulin, V., Houlsby, N., Evci, U., Zhai, X., Goroshin, R., Gelly, S., and Larochelle, H. Comparing transfer and meta learning approaches on a unified few-shot classification benchmark. CoRR, abs/2104.02638, 2021. URL https://arxiv.org/abs/2104.02638. + +Elson, J., Douceur, J. J., Howell, J., and Saul, J. Asirra: A captcha that exploits interest-aligned manual image categorization. In Proceedings of 14th ACM Conference on Computer and Communications Security (CCS). Association for Computing Machinery, Inc., October 2007. +Erickson, N., Mueller, J., Shirkov, A., Zhang, H., Larroy, P., Li, M., and Smola, A. Autogluon-tabular: Robust and accurate automl for structured data. arXiv:2003.06505 [stat.ML], 2020. +Falkner, S., Klein, A., and Hutter, F. BOHB: Robust and efficient hyperparameter optimization at scale. In Proc. of ICML'18, pp. 1437-1446, 2018. +Feurer, M., Klein, A., Eggensperger, K., Springenberg, J., Blum, M., and Hutter, F. Efficient and robust automated machine learning. In Proc. of NeurIPS'15, pp. 2962-2970, 2015a. +Feurer, M., Springenberg, J., and Hutter, F. Initializing Bayesian hyperparameter optimization via meta-learning. In Proc. of AAAI'15, pp. 1128-1135, 2015b. +Finn, C., Abbeel, P., and Levine, S. Model-agnostic meta-learning for fast adaptation of deep networks. In Precup, D. and Teh, Y. W. (eds.), Proceedings of the 34th International Conference on Machine Learning, volume 70 of Proceedings of Machine Learning Research, pp. 1126-1135. PMLR, 06-11 Aug 2017. +Google. TensorFlow Datasets, a collection of ready-to-use datasets. https://www.tensorflow.org/datasets, 2021. +He, K., Zhang, X., Ren, S., and Sun, J. Deep residual learning for image recognition. arXiv:1512.03385 [cs.CV], 2015. +Helber, P., Bischke, B., Dengel, A., and Borth, D. Eurosat: A novel dataset and deep learning benchmark for land use and land cover classification, 2017. +Howard, J. Imagenette. URL https://github.com/fastai/imagenette/. +Hu, J., Shen, L., and Sun, G. Squeeze-and-excitation networks. CoRR, abs/1709.01507, 2017. +Hutter, F., Hoos, H., and Leyton-Brown, K. Sequential model-based optimization for general algorithm configuration. In Proc. of LION'11, pp. 507-523, 2011. +Hutter, F., Kotthoff, L., and Vanschoren, J. (eds.). Meta-Learning, pp. 35-61. Springer International Publishing, 2020. + +Jomaa, H. S., Arango, S. P., Schmidt-Thieme, L., and Grabocka, J. Transfer learning for bayesian hpo with end-to-end landmark meta-features. In *Fifth Workshop on Meta-Learning at the Conference on Neural Information Processing Systems*, 2021a. +Jomaa, H. S., Schmidt-Thieme, L., and Grabocka, J. Dataset2vec: Learning dataset meta-features. Data Mining and Knowledge Discovery, pp. 964–985, 2021b. +Kadioglu, S., Malitsky, Y., Sellmann, M., and Tierney, K. ISAC - instance-specific algorithm configuration. In Proc. of ECAI'10, pp. 751-756, 2010. +Kadioglu, S., Malitsky, Y., Sabharwal, A., Samulowitz, H., and Sellmann, M. Algorithm selection and scheduling. In Proc. of CP'11, pp. 454-469, 2011. +Kather, J. N., Weis, C.-A., Bianconi, F., Melchers, S. M., Schad, L. R., Gaiser, T., Marx, A., and Z"ollner, F. G. Multi-class texture analysis in colorectal cancer histology. Scientific reports, 6:27988, 2016. +Khosla, A., Jayadevaprakash, N., Yao, B., and Fei-Fei, L. Novel dataset for fine-grained image categorization. In First Workshop on Fine-Grained Visual Categorization, CVPR'11, 2011. +Kingma, D. and Ba, J. Adam: A method for stochastic optimization. In Proc. of ICLR'15, 2015. +Kolesnikov, A., Beyer, L., Zhai, X., Puigcerver, J., Yung, J., Gelly, S., and Houlsby, N. Big transfer (bit): General visual representation learning. In Proc. of ECCV'20, pp. 491-507, 2020. +Kotthoff, L., Gent, I., and Miguel, I. An evaluation of machine learning in algorithm selection for search problems. 25(3):257-270, 2012. +Krause, J., Stark, M., Deng, J., and Fei-Fei, L. 3d object representations for fine-grained categorization. In 4th International IEEE Workshop on 3D Representation and Recognition (3dRR-13), Sydney, Australia, 2013. +Krizhevsky, A., Hinton, G., et al. Learning multiple layers of features from tiny images. 2009. +Krizhevsky, A., Sutskever, I., and Hinton, G. ImageNet classification with deep convolutional neural networks. In Proc. of NeurIPS'12, pp. 1097-1105, 2012. +Laadan, D., Vainshtein, R., Curiel, Y., Katz, G., and Rokach, L. Rankml: A meta learning-based approach for pre-ranking machine learning pipelines. arXiv preprint arXiv:1911.00108, 2019. + +Lake, B. M., Salakhutdinov, R., and Tenenbaum, J. B. Human-level concept learning through probabilistic program induction. Science, 350(6266):1332-1338, 2015. +LeCun, Y., Cortes, C., and Burges, C. Mnist handwritten digit database. ATT Labs [Online]. Available: http://yann.lecun.com/exdb/mnist, 2, 2010. +Li, H., Chaudhari, P., Yang, H., Lam, M., Ravichandran, A., Bhotika, R., and Soatto, S. Rethinking the hyperparameters for fine-tuning. In Proc. of ICLR'20, 2020. +Li, L., Jamieson, K., DeSalvo, G., Rostamizadeh, A., and Talwalkar, A. Hyperband: Bandit-based configuration evaluation for hyperparameter optimization. In Proc. of ICLR'17, 2017. +Lim, S., Kim, I., Kim, T., Kim, C., and Kim, S. Fast AutoAugment. +Lindauer, M., Hoos, H., Hutter, F., and Schaub, T. Autofolio: Algorithm configuration for algorithm selection. In Proc. of Workshops at AAAI'15, 2015. +Liu, Z., Pavao, A., Xu, Z., Escalera, S., Ferreira, F., Guyon, I., Hong, S., Hutter, F., Ji, R., Junior, J. C. S. J., Li, G., Lindauer, M., et al. Winning solutions and postchallenge analyses of the chalearn autodl challenge 2019. In TPAMI'21, pp. 3108-3125, 2021. +Loshchilov, I. and Hutter, F. SGDR: Stochastic gradient descent with warm restarts. In Proc. of ICLR'17, 2017. +Loshchilov, I. and Hutter, F. Fixing weight decay regularization in adam. In Proc. of ICLR'18, 2018. +Malitsky, Y., Sabharwal, A., Samulowitz, H., and Sellmann, M. Algorithm portfolios based on cost-sensitive hierarchical clustering. In Proc. of IJCAI'13, pp. 608-614, 2013. +Moroney, L. Horses or humans dataset, feb 2019a. URL http://laurencemoroney.com/horses-or-humans-dataset. +Moroney, L. Rock, paper, scissors dataset, feb 2019b. URL http://laurencemoroney.com/ rock-paper-scissors-dataset. +Mwebaze, E., Gebru, T., Frome, A., Nsumba, S., and Tusubira, J. icassava 2019 fine-grained visual categorization challenge, 2019. +Nene, S. A., Nayar, S. K., Murase, H., et al. Columbia object image library (coil-20). 1996. +Nesterov, Y. A method of solving a convex programming problem with convergence rate $\mathrm{O}(1 / \mathrm{sqr}(\mathbf{k}))$ . Soviet Mathematics Doklady, 27:372-376, 1983. + +Netzer, Y., Wang, T., Coates, A., Bissacco, A., Wu, B., and Ng, A. Y. Reading digits in natural images with unsupervised feature learning. 2011. +Paszke, A., Gross, S., Massa, F., Lerer, A., et al. PyTorch: An imperative style, high-performance deep learning library. In Proc. of NeurIPS'19, pp. 8024-8035, 2019. +Perrone, V., Jenatton, R., Seeger, M., and Archambeau, C. Scalable hyperparameter transfer learning. In Proc. of NeurIPS'18, pp. 6845-6855, 2018. +Pineda-Arango, S., Jomaa, H. S., Wistuba, M., and Grabocka, J. HPO-B: A large-scale reproducible benchmark for black-box HPO based on openml. volume abs/2106.06257, 2021. +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 supervision. In Proc. of ICML'21, pp. 8748-8763, 2021. +Rajaraman, S., Antani, S. K., Poostchi, M., Silamut, K., Hossain, M. A., Maude, R. J., Jaeger, S., and Thoma, G. R. Pre-trained convolutional neural networks as feature extractors toward improved malaria parasite detection in thin blood smear images. PeerJ, 6:e4568, 2018. +Rasmussen, C. and Williams, C. Gaussian Processes for Machine Learning. The MIT Press, 2006. +Rice, J. The algorithm selection problem. Advances in Computers, 15:65-118, 1976. +Russakovsky, O., Deng, J., Su, H., Krause, J., Satheesh, S., Ma, S., Huang, Z., Karpathy, A., Khosla, A., Bernstein, M., et al. Imagenet large scale visual recognition challenge. International journal of computer vision, 115(3): 211-252, 2015. +Salinas, D., Shen, H., and Perrone, V. A quantile-based approach for hyperparameter transfer learning. In Proc. of ICML'20, pp. 8438-8448, 2020. +Smith-Miles, K. Cross-disciplinary perspectives on meta-learning for algorithm selection. ACM Computing Surveys, 41(1):6:1-6:25, January 2009. +Snoek, J., Rippel, O., Swersky, K., Kiros, R., Satish, N., Sundaram, N., Patwary, M., Prabhat, and Adams, R. Scalable Bayesian optimization using deep neural networks. In Proc. of ICML'15, pp. 2171-2180, 2015. +Springenberg, J., Klein, A., Falkner, S., and Hutter, F. Bayesian optimization with robust Bayesian neural networks. In Lee, D., Sugiyama, M., von Luxburg, U., Guyon, I., and Garnett, R. (eds.), Proc. of NeurIPS'16, 2016. + +Stoll, D. Icgen, 2020. URL https://github.com/automl/ICGen. +Sun, Q., Liu, Y., Chua, T.-S., and Schiele, B. Meta-transfer learning for few-shot learning. In Proc. of CVPR'19, pp. 403-412, 2019. +Tan, M. and Le, Q. EfficientNet: Rethinking model scaling for convolutional neural networks. In Proc. of ICML'19, pp. 6105-6114, 2019. +Team, T. T. Flowers, jan 2019. URL http:// download.tensorflow.org/example_images/ flowerphotos.tgz. +Tornede, A., Wever, M., and Hüllermeier, E. Extreme algorithm selection with dyadic feature representation. In Proc. of DS'20, pp. 309-324, 2020. +Triantafillou, E., Zhu, T., Dumoulin, V., Lamblin, P., Xu, K., Goroshin, R., Swersky, C. G. K., Manzagol, P., and Larochelle, H. Meta-dataset: A dataset of datasets for learning to learn from few examples. CoRR, abs/1903.03096, 2019. +Vanschoren, J. Meta-learning: A survey. CoRR, abs/1810.03548, 2018. +Verma, V. K., Arora, G., Mishra, A., and Rai, P. Generalized zero-shot learning via synthesized examples. In Proc. of CVPR'18, pp. 4281-4289, 2018. +Verma, V. K., Brahma, D., and Rai, P. A meta-learning framework for generalized zero-shot learning. In Proc. of AAAI'19, pp. 6062-6069, 2019. +Wilson, A. G. and Ghahramani, Z. Copula Processes. In Proc. of NeurIPS'10, pp. 2460-2468, 2010. +Wilson, A. G., Hu, Z., Salakhutdinov, R., and Xing, E. P. Deep kernel learning. In Proc. of AISTATS'16, pp. 370-378, 2016. +Wilson, J., Hutter, F., and Deisenroth, M. Maximizing acquisition functions for Bayesian optimization. In Proc. of NeurIPS'18, pp. 741-749, 2018. +Winkelmolen, F., Ivkin, N., Bozkurt, H. F., and Karnin, Z. S. Practical and sample efficient zero-shot HPO. volume abs/2007.13382, 2020. +Wistuba, M. and Grabocka, J. Few-shot bayesian optimization with deep kernel surrogates. In Proc. of ICLR'21, 2021. +Wistuba, M., Schilling, N., and Schmidt-Thieme, L. Sequential Model-free Hyperparameter Tuning. In Proc. of ICDM '15, pp. 1033-1038, 2015. + +Wistuba, M., Schilling, N., and Schmidt-Thieme, L. Two-stage transfer surrogate model for automatic hyperparameter optimization. In Proc. of ECML/PKDD'16, pp. 199-214, 2016. +Xian, Y., Lorenz, T., Schiele, B., and Akata, Z. Feature generating networks for zero-shot learning. In Proc. of CVPR'18, pp. 5542-5551, 2018. +Xiao, H., Rasul, K., and Vollgraf, R. Fashion-MNIST: a Novel Image Dataset for Benchmarking Machine Learning Algorithms. CoRR, abs/1708.07747, 2017. +Xu, L., Hutter, F., Hoos, H., and Leyton-Brown, K. SATzilla: Portfolio-based algorithm selection for SAT. 32:565-606, 2008. +Xu, L., Hutter, F., Hoos, H., and Leyton-Brown, K. Evaluating component solver contributions to portfolio-based algorithm selectors. In Proc. of SAT'12, pp. 228-241, 2012. +Yang, Y. and Newsam, S. Bag-of-visual-words and spatial extensions for land-use classification. In ACM SIGSPATIAL International Conference on Advances in Geographic Information Systems (ACM GIS), 2010. +Zhai, X., Puigcerver, J., Kolesnikov, A., Ruyssen, P., et al. The Visual Task Adaptation Benchmark. CoRR, abs/1910.04867, 2019. +Zhu, J., Park, T., Isola, P., and Efros, A. A. Unpaired image-to-image translation using cycle-consistent adversarial networks. CoRR, abs/1703.10593, 2017. + +# A. Appendix + +# A.1. Search Space of DL Pipelines + +We list the search space of the DL pipelines clustered into two groups. The first group are general DL hyperparameters including the architecture and fine-tuning strategy. The second group defines the early stopping, validation and test strategies during the 20 minutes of training, including set sizes and evaluation timings. + +Table 6. The search space of our DL pipelines clustered into two groups. The first group are general DL hyperparameters including the architecture and fine-tuning strategy. The second group defines the early stopping, validation and test strategies during the 20 minutes of training, including set sizes and evaluation timings. + +
NameType, ScaleRange
Batch sizeint, log[16, 64]
Learning ratefloat, log[10-5, 10-1]
Min learn. ratefloat, log[10-8, 10-5]
Weight decayfloat, log[10-5, 10-2]
Momentumfloat[0.01, 0.99]
Optimizercat{SGD, Adam, AdamW}
Nesterovcat{true, false}
Amsgradcat{true, false}
Schedulercat{plateau, cosine}
Freeze portioncat{0.0, 0.1, . . ., 0.5}
Warm-up mult.cat{1.0, 1.5, . . ., 3.0}
Warm-up epochint[3, 6]
Architecturecat{ResNet18, EffNet-b0 +EffNet-b1, EffNet-b2}
Steps per epochint, log[5, 250]
Early epochint[1, 3]
CV ratiofloat[0.05, 0.2]
Max valid countint, log[128, 512]
Skip valid thresh.float[0.7, 0.95]
Test freq.int[1, 3]
Test freq. maxint[60, 120]
Test freq. stepint[2, 10]
Max inner loopfloat[0.1, 0.3]
# init samplesint,log[128, 512]
Max input sizeint[5, 7]
1stsimple modelcat{true, false}
Simple modelcat{SVC, NuSVC, RF, LR}
+ +# A.2. Dataset Augmentation + +In the following Table 7 we list all TFDS datasets we used for creating our 525 datasets with their respective domains. For each dataset $\mathcal{D}_{\text{original}}$ we create 15 subsets by sampling number of classes from range [2, 100] and min/max number of samples per class from range [20, 10^5] such that $\mathcal{D}_i \subseteq \mathcal{D}_{\text{original}}, \forall i \in \{1, \dots, 15\}$ (Figure 7). Remark that there is no procedure on sample level, meaning that subsets inherit image resolutions and channels from the original dataset as given in the Tables 8 and 9. Figure 8 contains the number of sample and class distributions of these subsets along with the AutoDL Challenge benchmark datasets. + +# A.3. AutoDL: Area Under the Learning Curve (ALC) Metric + +In the 2019 ChaLearn AutoDL challenge and also in all our experiments, the main performance metric is the Area under the Learning Curve (ALC). Formally, we test the currently trained model on a test set $p_i$ at time $t_i$ by calculating a scalar score, + +Table 7. Domains of the original datasets + +
DomainDatasets
ObjectsCifar100 (Krizhevsky et al., 2009), Cifar10, Horses or Humans (Moroney, 2019a), CycleGAN Horse2zebra (Zhu et al., 2017), CycleGAN Facades, CycleGAN Apple2orange, Imagenette (Howard), Coil100 (Nene et al., 1996), Stanford Dogs (Khosla et al., 2011), Rock, Paper and Scissors (Moroney, 2019b), TF Flowers (Team, 2019), Cassava (Mwebaze et al., 2019), Fashion MNIST (Xiao et al., 2017), Cars196 (Krause et al., 2013), Cats vs Dogs (Elson et al., 2007), ImageNet Resized 32x32 (Chrabaszcz et al., 2017)
CharactersCmaterdb Devanagari (Das et al., 2012a;b), Cmaterdb Bangla, MNIST(LeCun et al., 2010), KMNIST (Clanuwat et al., 2018), EMNIST Byclass (Cohen et al., 2017), EMNIST MNIST, Cmaterdb Telugu, EMNIST Balanced, Omniglot (Lake et al., 2015), SVHN Cropped (Netzer et al., 2011)
MedicalColorectal Histology (Kather et al., 2016), Malaria (Rajaraman et al., 2018)
AerialUc Merced (Yang & Newsam, 2010), CycleGAN Maps, Eurosat RGB (Helber et al., 2017)
Drawings/PicturesCycleGAN Vangogh2photo, CycleGAN Ukiyoe2photo
+ +![](images/c4f5409158ed11ec98f83d3b7581904651387a88b38a1ca0612a10f0e858d068.jpg) +Figure 7. Dataset augmentation flow + +the Normalized Area Under ROC Curve (AUC): + +$$ +s _ {i} = 2 * A U C \left(\vec {p} _ {i}\right) - 1 \tag {7} +$$ + +We then convert this score to a time-sensitive step function + +$$ +s (t) = \operatorname {s t e p} _ {-} f n (\vec {s}) \tag {8} +$$ + +and we also transform the time non-linearly between $[0,1]$ such that the performance on the first minute is weighted roughly the same as the last 10 minutes of the budget: + +$$ +\tilde {t} (t) = \frac {\log (1 + t / t _ {0})}{\log (1 + T / t _ {0})} \tag {9} +$$ + +where $T = 1200$ is the total default training budget and $t_0 = 60$ is the default reference time. + +Finally, we measure the ALC by: + +$$ +A L C = \int_ {0} ^ {1} s (t) d \tilde {t} (t) \tag {10} +$$ + +For more details on the metric, we refer the reader to (Liu et al., 2021). We depict an example of an ALC plot in Figure 9. + +![](images/a992f34f80053836dad279bc578b091313395975104e263d13f488037e99fcb7.jpg) +Figure 8. Distribution of the meta-features where each point corresponds to a dataset. Blue points come from our meta-dataset, whilst red ones are the datasets provided by AutoDL challenge. Star and point markers are public AutoDL datasets and private AutoDL datasets (from feedback and final phases), respectively. + +# A.4. Hardware Setup + +Due to the anytime performance measurements of the AutoDL challenge's training and evaluation protocol and the resulting importance on wall clock time, we ensured that all experiments in this work were run on machines with the same hardware setup. The specification of our machines is the following: AMD EPYC 7502 32-Core Processor, NVIDIA GeForce RTX 2080 Ti, 500GB RAM, CUDA version 11.5, Ubuntu 20.04.3 LTS. + +# Statement of Contributions + +Ekrem Öztürk: Methodology, Software (extending the AutoDL 2019 challenge submission base code from Fabio with more datasets), Validation (running all ZAP-AS experiments after the challenge deadline starting June 2020 and also the ZAP-HPO rebuttal experiments), Investigation, Data Curation, Writing: Original Draft, Writing: Review and Editing, Visualization + +Fabio Ferreira: Conceptualization, Methodology, Software (providing the base code for the AutoDL challenge 2019 submission), Validation (and running all ZAP-AS experiments up to the challenge deadline on March 14 2020), Investigation, + +Table 8. Resolution Distribution of datasets + +
Resolution# of Datasets
28 × 2890
32 × 32105
64 × 6415
105 × 10515
128 × 12815
150 × 15015
256 × 25690
300 × 30030
600 × 60015
Varying135
+ +Table 9. Image channels distribution of datasets + +
Channel# of Datasets
B&W90
RGB435
+ +![](images/1b8fa0bafeebca1ed12999c4b9a32151f86252eeed2362d7833e700609a86a52.jpg) +Figure 9. Learning curve of a task is the step function of normalized AUC (NAUC) scores received during the 20 minutes and the light blue area underneath is the area under the learning curve(ALC). Every dark blue point (steps) corresponds to a set of predictions made and y-axis to its NAUC score. When the procedure stops early, the final NAUC is interpolated to the end with a horizontal line. Top x-axis is the time limited to 1200 seconds and the bottom axis is the transformed version between [0, 1]. Visualization clearly shows that the first 60 seconds contributes to more than $20\%$ of the total score and has the same weight as the last 600 seconds. Remark that total budget $T = 1200$ and reference time constant $t_0 = 60$ here, the same values as in our experiments. + +Data Curation, Writing: Original Draft, Writing: Review and Editing, Visualization, Supervision of Ekrem Öztürk + +Hadi S. Jomaa: (todo) Methodology, Software (providing the ZAP-HPO code), Validation (running the ZAP-HPO experiments for the initial paper submission), Writing: Original Draft, Visualization + +Lars Schmidt-Thieme: Writing: Review and Editing + +Josif Grabocka: Conceptualization, Methodology, Writing: Original Draft, Writing: Review and Editing, Supervision of Hadi S. Jomaa, Project management + +Frank Hutter: Conceptualization (proposing the original ideas for tackling the problem specification of the AutoDL challenge), Methodology, Resources, Writing: Original Draft, Writing: Review and Editing, Supervision of Fabio Ferreira, Project management, Funding acquisition + +# Signatures + +
Ekrem ÖztürkDate
Fabio FerreiraDate
Hadi S. JomaaDate
Lars Schmidt-ThiemeDate
Josif GrabockaDate
Frank HutterDate
\ No newline at end of file diff --git a/zeroshotautomlwithpretrainedmodels/images.zip b/zeroshotautomlwithpretrainedmodels/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..773d166434c77183ea194575716e4fd806441478 --- /dev/null +++ b/zeroshotautomlwithpretrainedmodels/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6f97f3492f8c8cba24a6a94cf80bcc447ea90bf681494a64b092108d59706cfa +size 657369 diff --git a/zeroshotautomlwithpretrainedmodels/layout.json b/zeroshotautomlwithpretrainedmodels/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..fc43b2eb11312ed7fdafb8a7d4e7ba1338fcacd0 --- /dev/null +++ b/zeroshotautomlwithpretrainedmodels/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:580e44dea64e0fd31b1de18dcbe8fe61962d0e447cd7c44f8b2903fa396d396f +size 551471 diff --git a/zeroshotrewardspecificationviagroundednaturallanguage/99bb1b08-c339-4582-9ad2-9020dbabca0a_content_list.json b/zeroshotrewardspecificationviagroundednaturallanguage/99bb1b08-c339-4582-9ad2-9020dbabca0a_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..a6331c390ec858884992fd178ff30c5d6af8dbe6 --- /dev/null +++ b/zeroshotrewardspecificationviagroundednaturallanguage/99bb1b08-c339-4582-9ad2-9020dbabca0a_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b521559a0872e4d419e5bc5307da8538c843b0b9416e1152b46a9e0fec5a4776 +size 67664 diff --git a/zeroshotrewardspecificationviagroundednaturallanguage/99bb1b08-c339-4582-9ad2-9020dbabca0a_model.json b/zeroshotrewardspecificationviagroundednaturallanguage/99bb1b08-c339-4582-9ad2-9020dbabca0a_model.json new file mode 100644 index 0000000000000000000000000000000000000000..e7ff753047e5c17b2a3a6d783ed94387580f869c --- /dev/null +++ b/zeroshotrewardspecificationviagroundednaturallanguage/99bb1b08-c339-4582-9ad2-9020dbabca0a_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:67efa9969bd888cab58c04503f660a9460e21294876a08b2e49f10d304609c46 +size 82376 diff --git a/zeroshotrewardspecificationviagroundednaturallanguage/99bb1b08-c339-4582-9ad2-9020dbabca0a_origin.pdf b/zeroshotrewardspecificationviagroundednaturallanguage/99bb1b08-c339-4582-9ad2-9020dbabca0a_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..452d7ae102bb5516e7faf551913f63907bf7455a --- /dev/null +++ b/zeroshotrewardspecificationviagroundednaturallanguage/99bb1b08-c339-4582-9ad2-9020dbabca0a_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:68f7a858c3a2a772f5444f2720b58861de67426a4526ef9610514ccd7819d9a0 +size 1352542 diff --git a/zeroshotrewardspecificationviagroundednaturallanguage/full.md b/zeroshotrewardspecificationviagroundednaturallanguage/full.md new file mode 100644 index 0000000000000000000000000000000000000000..d359708e0b4247c109c4235c2b5111653fafbc21 --- /dev/null +++ b/zeroshotrewardspecificationviagroundednaturallanguage/full.md @@ -0,0 +1,258 @@ +# Zero-Shot Reward Specification via Grounded Natural Language + +Parsa Mahmoudieh $^{1}$ Deepak Pathak $^{2}$ Trevor Darrell + +# Abstract + +Reward signals in reinforcement learning are expensive to design and often require access to the true state which is not available in the real world. Common alternatives are usually demonstrations or goal images which can be labor-intensive to collect. On the other hand, text descriptions provide a general, natural, and low-effort way of communicating the desired task. However, prior works in learning text-conditioned policies still rely on rewards that are defined using either true state or labeled expert demonstrations. We use recent developments in building large-scale visuolanguage models like CLIP to devise a framework that generates the task reward signal just from goal text description and raw pixel observations which is then used to learn the task policy. We evaluate the proposed framework on control and robotic manipulation tasks. Finally, we distill the individual task policies into a single goal text conditioned policy that can generalize in a zero-shot manner to new tasks with unseen objects and unseen goal text descriptions. + +# 1 Introduction + +Previous efforts have explored image-based goal specification, with significant successes in visual navigation and manipulation tasks (Pathak et al., 2018; Nair et al., 2018; Fu et al., 2018; Singh et al., 2019). Yet existing image-based goal specification paradigms are limited because they are typically limited to a particular scene instance in an environment, whereas a semantic goal comprises multiple possible scene configurations. Reinforcement learning offers one of the most appealing premises in the study of AI: from a reward signal alone, algorithms which learn optimal policies that maximize expected reward can learn to perform navigation, dexterous manipulation, and host of other impactful + +![](images/fbc19ba37edf4a8ece3cdb68658d23c7f09e94f30091d698164a0b773c0d865e.jpg) + +![](images/e52faded86a02e8973a34ab35f6fd61ead80a671f77240df67c330a8d517e6e6.jpg) +Figure 1. Our method uses only goal text from user and images from the environment at training time. We train several agents on several tasks and distill their policies into a single goal text conditioned policy that can generalize to new tasks with an unseen goal text description in a zero-shot manner. We assume no access to environment reward, state, demonstrations, or goal images at either train or test time. + +tasks. However, discovering or specifying a reward function for a given task is often a very challenging problem, especially when one is considering agents that can learn from un-instrumented environments, e.g., from raw image observations alone. We wish to have an agent that can learn purely from pixels, with no access to the underlying state of the environment at any point during learning or task execution. Achieving this goal without access to an instrumented reward function has been exceedingly challenging. + +One can use image-based reward specification to cause a robot agent to navigate to a particular chair next to a specific tall plant, but that agent may not always succeed at the generic task of "go to a chair next to a tall flowering plant": e.g., if the goal specification image shows a red chair next to a plant with a yellow flower the agent may + +navigate away from a scene with a blue chair next to a red flower, depending on the model's underlying image representation. To be sure that the true goal is properly specified irrespective of the invariances of the model's underlying perceptual representation, a user may have to provide a set of goal image examples that cover the variation of the target concept, potentially a very expensive undertaking to collect or generate. + +We advocate semantic reward specification via grounded natural language, where a user describes a goal configuration in the world using a natural language description referring to entities in the world. This direction has long been a "holy grail" of AI research and a presumed capability of AI science fiction—the ability to instruct a robot with natural language—yet attempts have been limited by the state of the art in grounded language perception. It also falls under the general umbrella of leveraging large-scale passive data to bootstrap embodied learning, where we rely on language as a means to provide necessary reward signal which might be missing in visual data alone. + +Prior work has explored reward functions or policies that take natural language as for goal description (Oh et al., 2017; Bahdanau et al., 2018; Zhou & Small, 2020; Goyal et al., 2020; Fu et al., 2019; Hermann et al., 2017; Shao et al., 2020). However, they rely on reward signals that have access to state of the system or demonstrations of the task distribution they are training on. There are works that use human videos to learn reward functions to train their agent (Shao et al., 2020; Sermanet et al., 2018; 2016), but they require a curated dataset of humans performing the tasks. + +Recently however, the advent of large-scale multimodal training data together with large capacity language and vision deep learning models has significantly advanced the state of the art. A steady series of innovations have advanced grounded language modeling, from early work on multimodal translation and fusion models (Barnard et al., 2003; Quattoni et al., 2007; Guadarrama et al., 2016), to large-scale joint embedding models (Frome et al., 2013; Radford et al., 2021), to the plethora of multimodal transformer models currently under investigation (Su et al., 2019; Lu et al., 2019; Chen et al., 2019; Hu & Singh, 2021). CLIP, in particular, demonstrated a transformative advance on zero-shot object recognition (Radford et al., 2021). + +One way to communicate text-based goal to a robot is by simply offering a description of the goal configuration in natural language and using the CLIP embedding dot product with an observed image to evaluate proximity to goal state. Surprisingly, this can work in simple cases, for examples see the top example in figure 5. However, for more complex goals, such as those involving spatial relationships, the simple solution has poor performance as shown in the bottom example of figure 5. + +To overcome these limitations and scale to complex manipulation tasks, we spatially ground the natural language goal in the image. We factor 'what' vs 'where/how' aspects of goal state, and offer a novel spatial-salience scheme to generate data using this factorization (Figure 2 top). We argue that existing (e.g., CLIP-like) models can be used to ground the what aspects of a goal quite effectively, including appropriate attribute and concept-level generalization, while a separate where/how module can ground spatial relationship aspects of goal configuration. On this generated data, we first learn our Zero-Shot Reward Model (ZSRM) and then use ZSRM to learn individual text-conditioned policies. Finally, the individual task policies are distilled into a single goal-text-conditioned policy which is multi-task in nature and can execute unseen tasks in a zero-shot fashion – from a natural language description of task – without having to train a new policy for every new task. + +# 2 Method + +In our work we assume an agent only has access to a text description of the goal desired by the user and image observations from the environment. At no point during training or testing does the agent have access to demonstrations, goal images, or reward from the environment. The agent only has access to a reward model that takes images and goal text as input to provide progress towards goal text description with a reward score output. The reward is then used to teach the agent how to achieve the goal described by the text with online reinforcement learning. Given these assumptions we will now describe how we provide a zero-shot reward model by leveraging CLIP and how we learn a text conditioned policy with this model. + +# 2.1 Vanilla Dot-product Visuolinguistic Base Reward Model + +Our base model is the most intuitive way to use the CLIP model to compute reward. Our base model simply computes reward by taking a dot product between the goal text feature and image observation feature through CLIP's language and image encoders respectively: $r_t = E_I(I_t) \cdot E_L(g)$ . A subset of tasks can be learned with this reward model. We visualize the limits of this model on two tasks in Figure 5. One significant limitation of CLIP is that it cannot distinguish spatial relationship of objects in images. This limits our base reward model from being useful for tasks that have spatial goals. Our full zero-shot reward model remedies this issue by leveraging CLIP in a very different way. + +# 2.2 Spatially Grounded Visuolinguistic Zero-Shot Reward Model (ZSRM) + +Data Generation via CLIP-Saliency Phrase Grounding We use a simple method that generates texts with spatial + +![](images/c42914b99968ff39d09e86016bf78e71d9bf5f3acacf224931a47a089743442b.jpg) +Data Generation +ZSRM deployment for RL + +![](images/ab6dbde908dcf4db79c2d1d5fcd8c55955b138fa274a31d054c46c35a0693abd.jpg) +Training ZSRM with Captioned Data + +![](images/d3529dd0a81e1e2b8d447e23e6b7a81cb3323e0950954e9c8c598543a11f9dfa.jpg) +Figure 2. Our Zero-Shot Reward Model (ZSRM) is made by first generating spatial text labels of random exploration collected images with random initial states of arm and objects. We train ZSRM with the generated data in the same style of CLIP. We then use a discretized dot product of current image observation embedding and goal text embedding as our zero-shot reward. We train an agent via Reinforcement Learning with our reward model that is computed using only goal text and current observation as input. We assume no access to environment reward, state, demonstrations, or goal images at train or test time. + +information for images using phrase grounding and spatial relationship processing. We assume we have access to the noun phrases that will be used by the user to specify their full goal text. Figure 2 illustrates how the object noun phrases are passed through CLIP's language encoder and the current image observation is passed through CLIP's image encoder. We use the language encodings as class embeddings of each object noun phrase to perform a saliency analysis (using Grad-CAM (Selvaraju et al., 2017)) on the image encoding of the observation on the last convolutional layer (specifically, the ReLU layer of CLIP's ResNet-50 backbone). Saliency models such as Grad-CAM generally output a heatmap of the features that indicate a class exists in the current image input. The state extractor in Figure 2 computes the "state" of each object using the argmax of the saliency heatmap (see Figure 3). Once we have the object states (object pixel coordinates), we use the criteria described in the next section to generate a full text description of the image describing the spatial relationship between the objects. The images we use to label are randomly sampled robot arm and object locations with random actions taken by the agent to move the arm. + +Spatial Language Grounding Criteria We generate a spatial text label using the object pixel coordinates of one or more camera views as input to match various criteria. The criteria that matches our object state determines the text + +label of the image. The text labels used are the simplest spatial descriptions we could think of. We did not engineer what text labels to use. + +Our spatial language grounding criteria is defined in Table 2.2. The first set (left of, right of, on top of, below, and in between) assume coordinates in a front camera view and the semantics are defined in that camera view with positive y in the upward direction and positive x in the right direction. The second set (in front of & behind) has access to a left camera view with coordinate x2 pointing towards the right which is towards the front in the first camera view and y2 pointing upward similar to the first camera view. The second camera is needed to know if the object is placed in the front or behind another object correctly. The third set (close to & inside of) require access to a front camera view with a $45^{\circ}$ downward tilt towards the ground. This camera view is needed to see if the object is getting closer to another object in two orthogonal directions at once where as a left only or front view only allows you to determine one dimension of closeness. For "inside of" a $45^{\circ}$ camera helps the agent see if the object is going inside another object without occlusion. The $\epsilon$ threshold for "inside of" is much smaller than for "close to" since the centroid can come much closer when an object goes inside a container object. + +Full Reward Model Training and Usage After generating spatial language labels for randomly collected images + +
Spatial Language LabelLabel Grounding Criteria
Obj1 on the left of Obj2Ox2 > Ox1
Obj1 on the right of Obj2Ox1 > Ox2
Obj1 on top of Obj2|Ox1 - Ox2| < ε1 & Oy2 < Oy1 < Oy2 + ε2
Obj1 below Obj2|Ox1 - Ox2| < ε1 & Oy1 < Oy2 < Oy1 + ε2
Obj1 in between Obj2, Obj3min(Ox2, Ox3) < Ox1 < max(Ox2, Ox3)
Obj1 in front of Obj2Ox12 > Ox2
Obj1 behind Obj2Ox2 > Ox1
Obj1 close to Obj2||Oxy1 - Oxy2||2 < ε
Obj1 inside of Obj2||Oxy1 - Oxy2||2 < ε
+ +Table 1. Spatial Language Grounding Criteria. + +using CLIP-saliency phrase grounding, we train our full reward model similar to CLIP (Radford et al., 2021) with the similar visuolinguistic contrastive loss where the model essentially predicts which caption matches which image in every batch. The cosine similarity of the image and text embeddings of the correct pairs in the batch are maximized while the cosine similarity of the embeddings of the incorrect pairs are minimized. We initialized our model with the pretrained language and image encoders from CLIP. This, what we call 'full reward model', is essentially same as the base reward model but now it has been "fine-tuned" with spatial-grounded text-image data generated automatically. To prevent catastrophic forgetting and overfitting to just the new data, one could maintain a distillation loss with respect to the old model. However, we found that training the model from scratch on this new data to work well. Finally, the dot product of our new model can directly be used as reward but we found thresholding the dot product to obtain binarized reward to work better. In order to avoid engineering the threshold of our binarized reward we computed the dot product of positive and negative goal texts and if the highest dot product (argmax) was our positive goal text we output a reward of 1 and a reward of 0 otherwise. We found this to give us the best results. This finetuned zero-shot reward model can be used for a broad set of manipulation tasks to push or place objects to semantic locations which we showcase in our results. + +# 2.3 Language Conditioned Multi-task Policy + +Now that we have a method for learning tasks in a zero-shot reward fashion, we would like to be able to not require training a new policy for every new task and ideally have a language conditioned multi-task policy that takes in the goal text description of an unseen task and executes the task without needing any new samples from the environment. + +To approach this goal, we first learn several tasks via reinforcement learning using our zero-shot reward model. We then create a large dataset of the rollouts of those polices and pair each trajectory with the goal text description of the + +tasks it was trained to learn. We then use behavioral cloning (supervised learning for predicting actions) to learn a policy that takes images and text goal task description as input and actions as target outputs. We use CLIP's language encoder as the text goal embedding that is fed to the multi-task policy. In addition we use image augmentation techniques to aid behavioral cloning in learning more robust policies. + +# 3 Experiments + +# 3.1 Phrase grounding and Base Zero-shot Reward Model Visualization + +Object detectors are one way to extract object states for our spatial text generator, however, they are usually not used off the shelf and need to be fine-tuned with in domain data. In Figure 3, we show pretrained Mask R-CNN (He et al., 2017) outputs on different camera views for the block stack environment. As you can see in the first two subfigures, the blocks are not proposed as objects with Mask R-CNN from both far and close camera views. This is a demonstration of the need for in-domain fine-tuning of object detectors to work in the environment you want to use. Our Grad-CAM output from CLIP however, highlights exactly the objects we are interested in from the object noun phrases that describes each object in the last two subfigures. Another limitation with Mask R-CNN is that even if the object proposals were good, it would not necessarily classify objects it has not been trained for and therefore not output a filtered set of object proposals. In other words, we would not know which object is which if the detector hasn't been trained with the label of objects we care about. + +In Figure 5 we show what our base reward model outputs on two goal descriptions: 1. inverted pendulum 2. yellow object close to a blue object. For the first goal description we observe that the dot product increases as the pendulum becomes more inverted from either side as desired. For the second goal description we observe that as the blue object gets closer to the yellow object the dot product increases except for the closest image where it dips which results in an undesired output. We observed this example and many others that the base reward model is not sufficient for recognizing object spatial relationships. The encoders are good at identifying what objects are in the image however, which is what we leverage to generate paired language image data for our full reward model. + +# 3.2 Full Zero-shot Reward Model Results + +In this section, we evaluate our full Zero-shot Reward Model on pushing, picking, and placing manipulation tasks performed in a planar setup. We train each task using our full zero-shot reward model output as reward for the PPO reinforcement learning algorithm (Schulman et al., 2017). We + +![](images/11ca0523c00a471da4de88160591c4dd83c4246f25f2130de328330b13c1747e.jpg) +Figure 3. a) Mask R-CNN object detection results b) Mask R-CNN detection results on far view c) Mask R-CNN instance segmentation results on far view d) Grad-CAM result with 'red block' text input (white being highest intensity) e) Grad-CAM result with 'yellow block' text input (white being highest intensity). + +![](images/021237f2a026a1a82dce405fdbb693a86f8387d4d996cee46e2fa579245af0b5.jpg) + +![](images/017e54506ed589d380e8bc43e0d7ec0a39d7c1e3a9f42d5485dc723ad0d17282.jpg) + +![](images/b4446642d8661c744293ff88d3725c591ba8c09a7acd5066de03677f73dd631f.jpg) + +![](images/ecd046905f43745509e042279c28d9fe50be4679996192b083f30a415fe9d684.jpg) + +![](images/938b9bf4681c4789810e2beeda72f947bfbcc01dc64b206d8ccc6bb0f5951106.jpg) +Double Inverted Pendulum +Figure 4. We showcase our base reward model trained policy in Double Inverted Pendulum performing slightly better than oracle reward. We average our results over 3 seeds per task. + +then train for the same tasks with other types of reward functions as baselines or privileged methods for comparison: + +a) Oracle reward (privileged): this reward function has direct access to state to determine task completion. In other words it uses true x,y,z spatial positions of the objects to determine if the desired spatial relationship is reached and outputs 1 to the RL algorithm for every timestep the conditions of the task are met. +b) VICE (privileged): VICE(Fu et al., 2018) is used as a privileged method that has access to task goal image for comparison. We train the VICE reward model as a binary goal classifier that is trained with true goal images of the task such as "red block on top of yellow block" as positive images and images that aren't in the correct goal configuration as negative images. We discretize the model to output 1 if it determines the current image is positive and 0 otherwise. +c) Ours-base: Our base zero-shot reward model that uses the dot product between the goal text feature and image observation feature of CLIP as reward. +d) Curiosity-RL (Pathak et al., 2017; Burda et al., 2018): Curiosity is used as a baseline since it only has access to images similar to our method for computing reward, but has only been successful for videogames such as Atari and Mario or locomotion where exploring new states leads to + +progressing through the task (going further in levels of game for example). It is less privileged however, in that it does not use language input for task specification. + +Environment Reward Details for Oracle Evaluation: The oracle reward function for Double-Inverted-Pendulum is alive bonus minus distance penalty minus velocity penalty. The oracle for SawyerSimRobot-Pushing is a sparse reward that outputs one when the centroid distance between two pucks are below a threshold. The oracle reward for FetchSimRobot-Stacking is a sparse reward that outputs one when a yellow block is within a horizontal and vertical threshold distance of a red block. The oracle reward for FetchSimRobot-Placing is a sparse reward that outputs one when a yellow block is correctly placed on the right of a red block. See Figs. 3 & 5 for image observation examples of FetchSimRobot and SawyerSimRobot. + +In Figure 6 we show how our full reward model performs on three planar manipulation tasks. We observe that our Full Reward Model performs as well as oracle reward and VICE both of which are privileged on SawyerSimRobot-Pushing (pushing a blue puck close to a yellow puck), FetchSimRobot-Stacking (stacking a yellow block on top of a red block), and FetchSimRobot-Placing (placing a yellow block on the right of a red block). For Curiosity-RL we see that it learns the pushing pucks close together task but then starts learning separation of the pucks which reemphasizes that curiosity is only useful for tasks where exploring new dynamics leads to going farther in the task. Curiosity also has some trouble learning the double inverted pendulum task because the dynamics of the pendulum swinging can be hard to predict and therefore have misleading higher reward. Curiosity also does not learn the other manipulation tasks (stacking and placing) as those are more complex tasks that are harder to reach by exploration. + +For Double inverted pendulum (Fig. 4) our base reward model does better than oracle by chance which we speculate is because the oracle reward was originally designed for state input and was not tuned for learning image to reward mapping. Our base reward model fails for pushing, stacking, and placing, which take "an image of a yellow block on top of a red block", "an image of a yellow object close to a blue + +![](images/11c8e0cc2e5f1b7e8a20aae4568200c06b290d53534ba96d26251896b9edde90.jpg) +0 + +1 +![](images/cd903996d7f4dc79d066a6710c25f83348a7bdda3b33ab582e9c930709b2083f.jpg) +Image index + +![](images/69aae4c8f7b7921cbfe1fb2bd9952a4ffbfb754e17e9a79a9a4e34cd7d51d78b.jpg) +2 + +![](images/c0464cfaf82e21476bda8de20280627765c09f2ad05b97fbde1420a8195499cc.jpg) +3 + +![](images/d598a380fe8e400d073099f235a827c5fba92f9c0fa5b29aa02f3b2d01ca3b07.jpg) +4 + +![](images/74c6a2cfa738db755305ed6a66f3e97ea8247dac7b4a4ad20b28a0420f586d99.jpg) +Base Reward Model Response to text: 'Image of Inverted Pendulum' + +0 +![](images/49c041284138e3d92e36acc57728be12a287ebc53f85f0b96fe865597f742df1.jpg) +Image index + +![](images/d7237a675642dd6a7bbde59ef2ac930614436b4276e523e59b3489ebd048ae5b.jpg) +1 + +![](images/fb7ba43c74ffd3593377b6b1029a6f171492e07e93ed42e79ed0226f36c47857.jpg) +2 + +![](images/f24e459d6032ca39742fedaf9d6398a676aa5b7680b33b1dfd9207b4c74f3e51.jpg) +3 + +![](images/ffe608cea2cf92592b621042481b196cbe0b14cfa0e7ec38e0629596eb95caf9.jpg) +4 + +![](images/a7eb964c6574e20d7c19ce4d9ae601e011dcfa31ab75ce16d75ba15bf4174b82.jpg) +Figure 5. We visualize the results of the base reward model which is a trivial dot product between the goal language description and image observation. The top row (green box) displays a successful utilization of the base reward model and the bottom row (red box) shows a failure case. The x-axis represents image index. + +object", and "an image of a yellow block on the right of a red block" as language input for those tasks respectively. + +# 3.3 Multi-task Policy Results + +In order to avoid having to train a new policy for every new task we want to learn, we train a multi-task policy with a set of training tasks and then show that it can generalize to a set of unseen test tasks by leveraging CLIP's language model to encode the goal text description of the tasks as conditioning input to our multi-task policy. + +In FetchSimRobot env, we train 18 tasks with PPO for 200K steps with our zero-shot reward model described in the previous section and show generalization results for 18 unseen test tasks by training a language conditioned policy with behavior cloning on rollouts of the 18 training tasks. We collect 5000 steps (i.e., 50 trajectories) per task. We do this for pickplace-left, pickplace-right, and stack tasks for different object combinations. The object training colors are red, green, and yellow, and the test color is blue. The multi-task policy has never seen blue block in text input or image input. (There are 18 training tasks because there are 3 relationship types and 6 different combinations of choosing two out of three training colors where order matters. There are 18 test tasks because there are 3 relationship types and 6 different combinations of pairing the test color to one of three training colors where order matters.) + +In evaluation, we average episode rewards over 50 seeds. + +We then average across all training tasks to get the train metric and across all test tasks to get the test metric respectively. We compare our language conditioned policy with a policy trained without task labels, and one trained with a primitive code as the conditioning input. The latter baseline simply labels the training tasks with integers 0 to 17. Since the Primitive code conditioned policy has only been trained with primitive codes of the training tasks, when evaluating it for test tasks we allow the policy to use CLIP's language embedding to find the closest corresponding training primitive code. This is done by comparing the text description embedding of all the training tasks to the test task text description embedding and choosing the training task primitive code corresponding to the smallest L2 distance. + +We use the same oracle reward that has direct access to state in figure 6 to measure the performance of our multi-task models. Every timestep the objects are in the correct target text description the agent is rewarded 1 point. The objects never start in the correct target state. Therefore it always takes several timesteps for the policy to move the objects to the correct state. All episodes timeout after 100 timesteps or if one of the objects falls off the table. In RL training and in policy rollout collection for behavior cloning each object has a one block width of variation in starting point location. We tested the policies on same distribution of start point variation interval (seen initial state distribution) and double the start point variation interval (unseen initial state distribution). + +![](images/5cf565d17a4d3c15fd2a033f29fab0fe40e3060ef509800821d125be2a026067.jpg) + +![](images/dc5047c0402b43a098aed387c9b7dd9fa4aec93633970289495a7a21bec56310.jpg) + +![](images/5dc546a3f970f0c13dca69d2a4a95192ef59d48ada6a2d71bf05079568164309.jpg) + +![](images/3a87aec9b920dce60a228e968b24cd7c21e6dfdaac8a316ea20427b3363fdafa.jpg) +Figure 6. We showcase our Full Reward Model performing as well as oracle reward and VICE both of which are privileged on SawyerSimRobot-Pushing (pushing a blue puck close to a yellow puck), FetchSimRobot-Stacking (stacking a yellow block on top of a red block), and FetchSimRobot-Placing (placing a yellow block on the right of a red block). We average results over 3 seeds per task. Oracle reward is privileged with true state information used to compute proximity to goal. VICE is privileged with true goal images used to train its reward model in classifying observations as close to goal or not. + +
Seen distributionUnseen distribution
train taskstest taskstrain taskstest tasks
(episode reward stats)means.e.means.e.means.e.means.e.
No Conditioning17.911.1114.820.9714.811.0210.790.85
Primitive Code Cond.26.711.2317.201.0317.031.0711.740.87
Language Cond.29.891.2822.411.0921.141.1615.690.98
+ +Table 2. Multi-task Policy Performance Results: We report multi-task average and standard error performance across all 18 training tasks and all 18 test tasks (unseen object color in goal text or image) for seen and unseen initial state distributions with no conditioning, primitive code conditioning, and language conditioning. The values reported are the episode reward averaged across 50 seeds per task policy rollout. The tasks are robotic arm manipulation of objects to different target semantic relationships of each other in the FetchSimRobot environment. While the policies were trained using our full zero-shot reward model, the reward metric reported is oracle reward to evaluate true performance. + +In Table 2 we see that no conditioning policy has the lowest performance as expected since there is full ambiguity in what task to perform given only an image. However, since the no conditioning policy has been trained across many different object colors going to different target states it has learned general displacement of blocks to different semantic locations randomly that can sometimes be moved to the correct semantic location by chance during testing. For the training tasks it has higher performance than testing tasks since it can memorize to execute some of the training tasks that have almost the exact same initial states sampled during testing as those in the behavior cloning dataset and thereby execute correctly as memorized. We observe that the primitive code conditioned policy has much higher training performance than the no conditioning policy since it can disambiguate what task it needs to execute. + +We observe that the language conditioned policy performs + +significantly better on test tasks than the primitive code conditioned policy since it can use the language embedding to infer the target task determined by the goal text description. The primitive code conditioning policy has access to the language embedding only to determine the closest training primitive code to the target task description. It's interesting to observe that the primitive code conditioning performs better than no conditioning on the test tasks because the closest primitive code can sometimes lead to a successful execution of the test task since it has some signal towards the correct task. One such example is that the test goal description task of "a blue block on the right of a yellow block" is mapped to the primitive code of the training goal description task of "a red block on the right of a yellow block". In Table 2 we also observe the same trend in the policy performances in unseen initial state distribution: the no conditioning policy performing the poorest on train and test tasks, the primitive code conditioned policy performing + +significantly better on both, the language conditioned policy performing the best at training and test tasks via its language structured specification of tasks. + +We train the language conditioned policy with ResNet18 image encoding that is concatenated with CLIP language encoding both of which are pushed through an fc layer before concatenation. The concatenated vector is then inserted into two fc layers before predicting actions. The primitive code conditioned policy swaps the CLIP language encoding with an integer from 0-17 representing the primitive code input. The no conditioned policy only has two fc layers on top of the same image encoding as the other two policies. We apply an L2 regression loss on the output for predicting continuous actions (behavior cloning). The policy is trained using Adam optimizer with AMS grad with learning rate of 1e-4. The images are augmented with PyTorch RandomResizedCrop of 0.95 to 1.0 area and 0.98 to 1.02 aspect ratio randomization and resized to original image dimensions of 128x128. All the policies are trained for 300 epochs. + +# 4 Related Work: + +Goal conditioned policies Goal conditioned policies allow a user to specify the agent's goal. States (Schaul et al., 2015; Andrychowicz et al., 2017) and Images (Pathak et al., 2018; Nair et al., 2018; Fu et al., 2018; Singh et al., 2019; Mendonca et al., 2021) are one way of specifying goal. However, they assume that the user has access to a photo or state of the completed task to give to the agent. We assume no access to goal images or state and use language which provides a natural form of supervision. + +Goal text conditioned policies Several previous efforts train reward functions or policies that take natural language as input for goal description (Oh et al., 2017; Bahdanau et al., 2018; Zhou & Small, 2020; Goyal et al., 2020; Fu et al., 2019; Hermann et al., 2017; Shao et al., 2020). They all however rely on reward signals that have access to state of the system or demonstrations of the task distribution they are training on. + +Learning reward functions There are works that use human videos to learn reward functions to train their agent with (Sermanet et al., 2018; 2016; Shao et al., 2020). We however, don't need a curated dataset of humans performing the tasks we want our agent to train with. Having humans perform all tasks we are interested in may not scale well with the amount of labor needed for recording and curating those datasets. CLIP has the advantage of learning a caption model from 400 million image, text pairs from the publicly available sources on the internet WIT. + +No Environment Reward There have been recent work on methods that use no reward signal from the environment + +to train for specific tasks, for instance, curiosity (Pathak et al., 2017), DIAYN (Eysenbach et al., 2018), intrinsic goals (Nair et al., 2018; Mendonca et al., 2021), etc. These methods have different ways to go from self-directed exploration to solving tasks at test time, and rely on reward function or goal images to be given by the user. Such a signal could be unnatural and costly to obtain. Our method however, can learn a subset of manipulation tasks by specifying end goal with language. + +Utility of large vision language models in RL Recent works leverage CLIP to do diverse manipulation tasks (Shridhar et al., 2021) and using GPT-3 to perform navigation (Huang et al., 2022). However, former has access to labeled expert demonstrations for training their policy and latter requires predefined action primitives. We assume no access to demonstrations or goal images at training or test time and operate with direct low-level actions. + +# 5 Discussion + +In this work, we presented a method for learning a set of object manipulation tasks without access to state of the system by computing reward from pixels conditioned on text goal description alone. Our method doesn't use goal images or demonstrations at either training time or test time. We devised a zero-shot reward model that leverages a language vision model (CLIP) that has been trained on a very large dataset of captioned images on the internet to compute progress (reward) towards a goal text description. We use this zero-shot-reward model to collect data on many tasks to then supervise a language conditioned multi-task policy that can execute new tasks without need of extra training. There are many future directions that can expand the abilities of our reward model such as taking into account pose of objects and state of objects (such as closed door). + +Finally we must address the ethical perils inherent in our leverage of models trained on large-scale vision and language datasets. Such datasets are well known to suffer from dataset bias that can cause failure or unintended harm (Buolamwini & Gebru, 2018). While the near-term risks appear to be limited with the robotic applications presently envisioned, practitioners should continuously monitor systems for bias against underrepresented groups and ensure that robotic systems work across all socioeconomic domains. Techniques for bias assessment and debiasing should be employed whenever possible to ensure this remains the case. + +# Acknowledgements + +We would like to thank members of BAIR for fruitful discussions and grateful to Sayna Ebrahimi, Abhishek Gupta, Ashvin Nair, Kelvin Xu, and Vitchyr Pong for constructive feedback and discussions. + +# References + +Andrychowicz, M., Wolski, F., Ray, A., Schneider, J., Fong, R., Welinder, P., McGrew, B., Tobin, J., Abbeel, P., and Zaremba, W. Hindsight experience replay. arXiv preprint arXiv:1707.01495, 2017. +Bahdanau, D., Hill, F., Leike, J., Hughes, E., Hosseini, A., Kohli, P., and Grefenstette, E. Learning to understand goal specifications by modelling reward. arXiv preprint arXiv:1806.01946, 2018. +Barnard, K., Duygulu, P., Forsyth, D., De Freitas, N., Blei, D. M., and Jordan, M. I. Matching words and pictures. 2003. +Buolamwini, J. and Gebru, T. Gender shades: Intersectional accuracy disparities in commercial gender classification. In Conference on fairness, accountability and transparency, pp. 77-91. PMLR, 2018. +Burda, Y., Edwards, H., Pathak, D., Storkey, A., Darrell, T., and Efros, A. A. Large-scale study of curiosity-driven learning. arXiv preprint arXiv:1808.04355, 2018. +Chen, Y.-C., Li, L., Yu, L., El Kholy, A., Ahmed, F., Gan, Z., Cheng, Y., and Liu, J. Uniter: Learning universal image-text representations. 2019. +Eysenbach, B., Gupta, A., Ibarz, J., and Levine, S. Diversity is all you need: Learning skills without a reward function. arXiv preprint arXiv:1802.06070, 2018. +Frome, A., Corrado, G., Shlens, J., Bengio, S., Dean, J., Ranzato, M., and Mikolov, T. Devise: A deep visual-semantic embedding model. 2013. +Fu, J., Singh, A., Ghosh, D., Yang, L., and Levine, S. Variational inverse control with events: A general framework for data-driven reward definition. arXiv preprint arXiv:1805.11686, 2018. +Fu, J., Korattikara, A., Levine, S., and Guadarrama, S. From language to goals: Inverse reinforcement learning for vision-based instruction following. arXiv preprint arXiv:1902.07742, 2019. +Goyal, P., Niekum, S., and Mooney, R. J. Pix12r: Guiding reinforcement learning using natural language by mapping pixels to rewards. arXiv preprint arXiv:2007.15543, 2020. +Guadarrama, S., Rodner, E., Saenko, K., and Darrell, T. Understanding object descriptions in robotics by open-vocabulary object retrieval and detection. The International Journal of Robotics Research, 35(1-3):265-280, 2016. + +He, K., Gkioxari, G., Dollar, P., and Girshick, R. Mask cnn. In Proceedings of the IEEE international conference on computer vision, pp. 2961-2969, 2017. +Hermann, K. M., Hill, F., Green, S., Wang, F., Faulkner, R., Soyer, H., Szepesvari, D., Czarnecki, W. M., Jaderberg, M., Teplyashin, D., et al. Grounded language learning in a simulated 3d world. arXiv preprint arXiv:1706.06551, 2017. +Hu, R. and Singh, A. Unit: Multimodal multitask learning with a unified transformer. arXiv preprint arXiv:2102.10772, 2021. +Huang, W., Abbeel, P., Pathak, D., and Mordatch, I. Language models as zero-shot planners: Extracting actionable knowledge for embodied agents. arXiv preprint arXiv:2201.07207, 2022. +Lu, J., Batra, D., Parikh, D., and Lee, S. Vilbert: Pretraining task-agnostic visiolinguistic representations for vision-and-language tasks. arXiv preprint arXiv:1908.02265, 2019. +Mendonca, R., Rybkin, O., Daniilidis, K., Hafner, D., and Pathak, D. Discovering and achieving goals via world models. Advances in Neural Information Processing Systems, 34:24379-24391, 2021. +Nair, A. V., Pong, V., Dalal, M., Bahl, S., Lin, S., and Levine, S. Visual reinforcement learning with imagined goals. In NeurIPS, 2018. +Oh, J., Singh, S., Lee, H., and Kohli, P. Zero-shot task generalization with multi-task deep reinforcement learning. In International Conference on Machine Learning, pp. 2661-2670. PMLR, 2017. +Pathak, D., Agrawal, P., Efros, A. A., and Darrell, T. Curiosity-driven exploration by self-supervised prediction. In International Conference on Machine Learning, pp. 2778-2787. PMLR, 2017. +Pathak, D., Mahmoudieh, P., Luo, G., Agrawal, P., Chen, D., Shentu, Y., Shelhamer, E., Malik, J., Efros, A. A., and Darrell, T. Zero-shot visual imitation. In Proceedings of the IEEE conference on computer vision and pattern recognition workshops, pp. 2050-2053, 2018. +Quattoni, A., Collins, M., and Darrell, T. Learning visual representations using images with captions. In 2007 IEEE Conference on Computer Vision and Pattern Recognition, pp. 1-8. IEEE, 2007. +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 supervision. arXiv preprint arXiv:2103.00020, 2021. + +Schaul, T., Horgan, D., Gregor, K., and Silver, D. Universal value function approximators. In ICML, 2015. +Schulman, J., Wolski, F., Dhariwal, P., Radford, A., and Klimov, O. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017. +Selvaraju, R. R., Cogswell, M., Das, A., Vedantam, R., Parikh, D., and Batra, D. 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. +Sermanet, P., Xu, K., and Levine, S. Unsupervised perceptual rewards for imitation learning. arXiv preprint arXiv:1612.06699, 2016. +Sermanet, P., Lynch, C., Chebotar, Y., Hsu, J., Jang, E., Schaal, S., Levine, S., and Brain, G. Time-contrastive networks: Self-supervised learning from video. In 2018 IEEE International Conference on Robotics and Automation (ICRA), pp. 1134–1141. IEEE, 2018. +Shao, L., Migimatsu, T., Zhang, Q., Yang, K., and Bohg, J. Concept2robot: Learning manipulation concepts from instructions and human demonstrations. In Proceedings of Robotics: Science and Systems (RSS), 2020. +Shridhar, M., Manuelli, L., and Fox, D. CIoport: What and where pathways for robotic manipulation. arXiv preprint arXiv:2109.12098, 2021. +Singh, A., Yang, L., Hartikainen, K., Finn, C., and Levine, S. End-to-end robotic reinforcement learning without reward engineering. arXiv preprint arXiv:1904.07854, 2019. +Su, W., Zhu, X., Cao, Y., Li, B., Lu, L., Wei, F., and Dai, J. Vl-bert: Pre-training of generic visual-linguistic representations. arXiv preprint arXiv:1908.08530, 2019. +Zhou, L. and Small, K. Inverse reinforcement learning with natural language goals. arXiv preprint arXiv:2008.06924, 2020. \ No newline at end of file diff --git a/zeroshotrewardspecificationviagroundednaturallanguage/images.zip b/zeroshotrewardspecificationviagroundednaturallanguage/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..599f1b50a546848bc93611992359ab195b2b4496 --- /dev/null +++ b/zeroshotrewardspecificationviagroundednaturallanguage/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a55ba533599667d61ceb204387dca9bbeca89efeed81554010efad409fc24a40 +size 335564 diff --git a/zeroshotrewardspecificationviagroundednaturallanguage/layout.json b/zeroshotrewardspecificationviagroundednaturallanguage/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..e99bed1e40f0cadc05452eb895b527716d189ae9 --- /dev/null +++ b/zeroshotrewardspecificationviagroundednaturallanguage/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:426fcd765b822866a2b8c2e404110d00c8c88160aa8652da0ae9be333be05e02 +size 278837